Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233
  1. const Schwifty = require('@hapipal/schwifty')
  2. const Joi = require('joi')
  3. const User = require('./user')
  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 Joi.object({
  26. match_queue_id: Joi.number(),
  27. profile_id: Joi.number().required(),
  28. target_id: Joi.number().required(),
  29. is_deleted: Joi.boolean().required(),
  30. })
  31. }
  32. }