| 12345678910111213141516171819202122232425262728 |
- const Schwifty = require('@hapipal/schwifty')
-
- const ProfileModel = require('../profiles')
- 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
- }
- }
|