const Schwifty = require('@hapipal/schwifty') const Joi = require('joi') const User = require('./user') module.exports = class MatchQueue extends Schwifty.Model { static get tableName() { return 'match_queues' } static get relationMappings() { return { user: { relation: Schwifty.Model.HasOneThroughRelation, modelClass: User, join: { from: 'match_queues.target_id', through: { from: 'profiles.profile_id', to: 'profiles.user_id', }, to: 'users.user_id', }, }, } } static get joiSchema() { return Joi.object({ match_queue_id: Joi.number(), profile_id: Joi.number().required(), target_id: Joi.number().required(), is_deleted: Joi.boolean().required(), }) } }