Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
jsonbArray: { type: ['array', 'null'] }
}
}
// This object defines the relations to other models.
static relationMappings = {
ceos: {
relation: Model.BelongsToOneRelation,
modelClass: path.join(__dirname, '/people'),
join: {
from: 'companies.ceo',
to: 'people.id'
}
},
employees: {
relation: Model.HasManyRelation,
modelClass: path.join(__dirname, '/employee'),
join: {
from: 'companies.id',
to: 'employees.companyId'
}
},
clients: {
relation: Model.HasManyRelation,
modelClass: path.join(__dirname, '/client'),
join: {
from: 'companies.id',
to: 'clients.companyId'
}
}
}
}
static get relationMappings() {
const Review = require('./Review');
const Movie = require('./Movie');
return {
reviews: {
relation: Model.HasManyRelation,
modelClass: Review,
join: {
from: 'Person.id',
to: 'Review.reviewerId',
},
},
movies: {
relation: Model.ManyToManyRelation,
modelClass: Movie,
join: {
from: 'Person.id',
through: {
from: 'Person_Movie.personId',
to: 'Person_Movie.movieId',
},
return {
attributeTypes: {
relation: Model.ManyToManyRelation,
modelClass: IdAttributeType,
join: {
from: `${this.tableName}.id`,
through: {
from: 'repository_attribute_types.repositoryId',
to: 'repository_attribute_types.attributeTypeId'
},
to: `${IdAttributeType.tableName}.id`
}
},
uiSchemas: {
relation: Model.HasManyRelation,
modelClass: UiSchema,
join: {
from: `${this.tableName}.id`,
to: `${UiSchema.tableName}.repositoryId`
}
}
};
}
modelClass: VerificationToken,
join: {
from: 'user.id',
to: 'verification_token.user_id',
},
},
resetToken: {
relation: Model.HasOneRelation,
modelClass: ResetToken,
join: {
from: 'user.id',
to: 'reset_token.user_id',
},
},
comments: {
relation: Model.HasManyRelation,
modelClass: Comment,
join: {
from: 'user.id',
to: 'comment.comment_author_id',
},
},
};
}
from: `${Character.tableName}.id`,
to: `${Weapon.tableName + Character.CHARID}`
}
},
spells: {
relation: Model.HasManyRelation,
modelClass: Spell,
join: {
from: `${Character.tableName}.id`,
to: `${Spell.tableName + Character.CHARID}`
}
},
skills: {
relation: Model.HasManyRelation,
modelClass: Skill,
join: {
from: `${Character.tableName}.id`,
to: `${Skill.tableName + Character.CHARID}`
}
},
saves: {
relation: Model.HasManyRelation,
modelClass: Save,
join: {
from: `${Character.tableName}.id`,
to: `${Save.tableName + Character.CHARID}`
}
},
import { Address } from 'fmg-core';
import { Model } from 'objection';
import AllocatorChannel from './allocatorChannel';
export default class Rule extends Model {
static tableName = 'rules';
static idColumn = 'address';
static relationMappings = {
channels: {
relation: Model.HasManyRelation,
modelClass: AllocatorChannel,
join: {
to: 'allocator_channels.rule_id',
from: 'rules.id',
},
},
};
readonly id!: string;
readonly address!: Address;
readonly name!: string;
}
static get relationMappings()
{
const RoomsChangePoints = require('./change-points-model');
const RoomsReturnPoints = require('./return-points-model');
return {
rooms_change_points: {
relation: Model.HasManyRelation,
modelClass: RoomsChangePoints,
join: {
from: 'rooms.id',
to: 'rooms_change_points.room_id'
}
},
rooms_return_points: {
relation: Model.HasManyRelation,
modelClass: RoomsReturnPoints,
join: {
from: 'rooms.id',
to: 'rooms_return_points.room_id'
}
},
next_room: {
relation: Model.BelongsToOneRelation,
import AllocatorChannel from './allocatorChannel';
export default class AllocatorChannelCommitment extends Model {
static tableName = 'allocator_channel_commitments';
static relationMappings = {
allocatorChannel: {
relation: Model.BelongsToOneRelation,
modelClass: `${__dirname}/allocatorChannel`,
join: {
from: 'allocator_channel_commitments.allocator_channel_id',
to: 'allocator_channels.id',
},
},
allocations: {
relation: Model.HasManyRelation,
modelClass: `${__dirname}/allocation`,
join: {
from: 'allocator_channel_commitments.id',
to: 'allocations.allocator_channel_commitment_id',
},
},
};
static get columnNameMappers() {
return snakeCaseMappers();
}
readonly id!: number;
allocatorChannel!: AllocatorChannel;
allocatorChannelId!: number;
turnNumber!: Uint32;
static get relationMappings()
{
const RoomsModel = require('../../rooms/server/model');
const PlayersModel = require('../../users/server/players-model');
return {
chat_room: {
relation: Model.HasManyRelation,
modelClass: RoomsModel,
join: {
from: 'room.id',
to: 'rooms.id'
}
},
chat_player_id: {
relation: Model.HasManyRelation,
modelClass: PlayersModel,
join: {
from: 'player_id',
to: 'players.id'
}
},
chat_private_player_id: {
relation: Model.HasManyRelation,
import { Model } from 'objection'
import Card from './Card'
export default class Game extends Model {
static tableName = 'games'
static relationMappings = {
cards: {
relation: Model.HasManyRelation,
modelClass: Card,
join: {
from: 'games.id',
to: 'cards.game_id'
}
}
}
}