Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

grouping.js 873B

1234567891011121314151617181920212223242526272829
  1. const Schwifty = require('@hapipal/schwifty')
  2. const groupingSchema = require('../schemas/groupings')
  3. const User = require('./user')
  4. const Profile = require('./profile')
  5. module.exports = class Grouping extends Schwifty.Model {
  6. static get tableName() {
  7. return 'groupings'
  8. }
  9. static get relationMappings() {
  10. return {
  11. profiles: {
  12. relation: Schwifty.Model.ManyToManyRelation,
  13. modelClass: Profile,
  14. join: {
  15. from: 'groupings.grouping_id',
  16. through: {
  17. from: 'memberships.grouping_id',
  18. to: 'memberships.profile_id'
  19. },
  20. to: 'profiles.profile_id'
  21. },
  22. },
  23. }
  24. }
  25. static get joiSchema() {
  26. return groupingSchema.single
  27. }
  28. }