const Schwifty = require('@hapipal/schwifty') const ProfileModel = require('./profile') const userSchema = require('../schemas/users') /** * @typedef User */ module.exports = class User extends Schwifty.Model { static get tableName() { return 'users' } static get relationMappings() { return { profiles: { relation: Schwifty.Model.HasManyRelation, modelClass: ProfileModel, join: { from: 'user.profile_id', to: 'profiles.profile_id', }, }, } } static get joiSchema() { return userSchema.single } }