UNPKG

@teikei/api

Version:

Teikei API server. Teikei is the software that powers ernte-teilen.org, a website that maps out Community-supported Agriculture in Germany.

34 lines (27 loc) 648 B
import { joiSchemas } from '@teikei/schemas' import { BaseModel } from './base' export default class User extends BaseModel { static tableName = 'users' // eslint-disable-next-line class-methods-use-this type() { return 'User' } link() { return `/users/${this.id}` } static jsonSchema = joiSchemas.user static relationMappings = { roles: { relation: BaseModel.ManyToManyRelation, modelClass: `${__dirname}/roles`, join: { from: 'users.id', through: { from: 'users_roles.user_id', to: 'users_roles.role_id' }, to: 'roles.id' } } } }