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.

38 lines (34 loc) 870 B
import { BaseModel } from '../base' export default class Initiative extends BaseModel { static tableName = 'initiatives' // eslint-disable-next-line class-methods-use-this type() { return 'Initiative' } static relationMappings = { ownerships: { relation: BaseModel.ManyToManyRelation, modelClass: `${__dirname}/users`, join: { from: 'initiatives.id', through: { from: 'initiatives_users.initiative_id', to: 'initiatives_users.user_id' }, to: 'users.id' } }, goals: { relation: BaseModel.ManyToManyRelation, modelClass: `${__dirname}/goals`, join: { from: 'initiatives.id', through: { from: 'initiatives_goals.initiative_id', to: 'initiatives_goals.goal_id' }, to: 'goals.id' } } } }