Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
object: { type: 'string' }
}
},
'first.founder': { type: ['string', 'null'] }
}
},
jsonArray: { type: ['array', 'null'] },
jsonbObject: { type: ['object', 'null'] },
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,
static get relationMappings()
{
// to avoid require loop:
const Players = require('./players-model');
return {
parent_player: {
relation: Model.BelongsToOneRelation,
modelClass: Players,
join: {
from: 'players_state.player_id',
to: 'players.id'
}
}
}
}
static relationMappings = () => ({
owner: {
relation: Model.BelongsToOneRelation,
// The related model.
modelClass: Person,
join: {
from: 'animals.ownerId',
to: 'persons.id'
}
}
})
}
static get relationMappings() {
return {
tokens: {
relation: Model.BelongsToOneRelation,
modelClass: User,
join: {
from: 'token.user_id',
to: 'user.id',
},
},
};
}
static get relationMappings() {
const Wallet = require('./wallet').default;
return {
wallet: {
relation: Model.BelongsToOneRelation,
modelClass: Wallet,
join: {
from: `${this.tableName}.walletId`,
to: `${Wallet.tableName}.id`
}
}
};
}
static get relationMappings(): RelationMappings {
return {
project: {
relation: Model.BelongsToOneRelation,
modelClass: `${__dirname}/Project`,
join: {
from: 'entryTag.projectId',
to: 'project.id'
}
},
entries: {
relation: Model.ManyToManyRelation,
modelClass: `${__dirname}/Entry`,
join: {
from: 'entryTag.id',
through: {
from: 'entry_entryTag.entryTagId',
to: 'entry_entryTag.entryId'
},
to: 'entry.id'
static get relationMappings() {
return {
link: {
relation: Model.BelongsToOneRelation,
modelClass: Link,
join: {
from: 'navigation_link.link_id',
to: 'link.id',
},
},
navigation: {
relation: Model.BelongsToOneRelation,
modelClass: Navigation,
join: {
from: 'navigation_link.navigation_id',
to: 'navigation.id',
},
},
};
}
static get relationMappings() {
const Wallet = require('../wallet/wallet').default;
return {
wallet: {
relation: Model.BelongsToOneRelation,
modelClass: Wallet,
join: {
from: `${this.tableName}.walletId`,
to: `${Wallet.tableName}.id`
}
}
};
}