Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

user.js 686B

12345678910111213141516171819202122232425262728
  1. const Schwifty = require('@hapipal/schwifty')
  2. const ProfileModel = require('./profile')
  3. const userSchema = require('../schemas/users')
  4. /**
  5. * @typedef User
  6. */
  7. module.exports = class User extends Schwifty.Model {
  8. static get tableName() {
  9. return 'users'
  10. }
  11. static get relationMappings() {
  12. return {
  13. profiles: {
  14. relation: Schwifty.Model.HasManyRelation,
  15. modelClass: ProfileModel,
  16. join: {
  17. from: 'user.profile_id',
  18. to: 'profiles.profile_id',
  19. },
  20. },
  21. }
  22. }
  23. static get joiSchema() {
  24. return userSchema.single
  25. }
  26. }