| 12345678910111213141516171819202122232425262728 |
- const Schwifty = require('@hapipal/schwifty')
- const groupingSchema = require('../schemas/groupings')
- const Profile = require('./profile')
-
- module.exports = class Grouping extends Schwifty.Model {
- static get tableName() {
- return 'groupings'
- }
- static get relationMappings() {
- return {
- profiles: {
- relation: Schwifty.Model.ManyToManyRelation,
- modelClass: Profile,
- join: {
- from: 'groupings.grouping_id',
- through: {
- from: 'memberships.grouping_id',
- to: 'memberships.profile_id'
- },
- to: 'profiles.profile_id'
- },
- },
- }
- }
- static get joiSchema() {
- return groupingSchema.single
- }
- }
|