import { Entity, model, property, hasMany } from '@loopback/repository'; import { UserGroup, UserToGroup, UserToGroupWithRelations, UserEndPointPermission, UserEndPointPermissionWithRelations, } from '../../data'; @model({settings: {strict: false}}) export class User extends Entity { @property({ type: 'number', id: true, required: true, }) id: number; @property({ type: 'string', required: true, }) firstname: string; @property({ type: 'string', required: true, }) lastname: string; @property({ type: 'string', required: true, index: true, }) username: string; @property({ type: 'string', required: true, index: true, }) email: string; @property({ type: 'string', required: true, }) password: string; @hasMany(() => UserToGroup, { "keyTo": "userId" }) toGroups: UserToGroup[]; @hasMany(() => UserEndPointPermission, { "keyTo": "userId" }) permissions: UserEndPointPermission[]; [prop: string]: any; constructor(data?: Partial) { super(data); } } export interface UserRelations { toGroups?: UserToGroupWithRelations; permissions?: UserEndPointPermissionWithRelations; } export type UserWithRelations = User & UserRelations;