You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

match-queue.js 822B

1234567891011121314151617181920212223242526272829
  1. const Schwifty = require('@hapipal/schwifty')
  2. const User = require('./user')
  3. const queueSchema = require('../schemas/match-queues')
  4. module.exports = class MatchQueue extends Schwifty.Model {
  5. static get tableName() {
  6. return 'match_queues'
  7. }
  8. static get relationMappings() {
  9. return {
  10. user: {
  11. relation: Schwifty.Model.HasOneThroughRelation,
  12. modelClass: User,
  13. join: {
  14. from: 'match_queues.target_id',
  15. through: {
  16. from: 'profiles.profile_id',
  17. to: 'profiles.user_id',
  18. },
  19. to: 'users.user_id',
  20. },
  21. },
  22. }
  23. }
  24. static get joiSchema() {
  25. return queueSchema.single
  26. }
  27. }