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 Role extends BaseModel { static tableName = 'roles' // eslint-disable-next-line class-methods-use-this type() { return 'Role' } link() { return `/roles/${this.id}` } static jsonSchema = joiSchemas.role static relationMappings = { users: { relation: BaseModel.ManyToManyRelation, modelClass: `${__dirname}/users`, join: { from: 'roles.id', through: { from: 'users_roles.role_id', to: 'users_roles.user_id' }, to: 'users.id' } } } }