All files / src/models user.profile.ts

84.62% Statements 11/13
100% Branches 0/0
0% Functions 0/2
81.82% Lines 9/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x         1x         1x                 1x                   1x           1x           1x                  
import {StringUtils} from '@logchain/utils/string';
import {Model, model, property} from '@loopback/repository';
import {Transform} from 'class-transformer';
 
@model({
  strict: true,
})
export class UserProfile extends Model {
  @property({
    type: 'string',
    required: true,
  })
  name: string;
 
  @Transform(({value}) => StringUtils.getS3Url(value))
  @property({
    type: 'string',
    jsonSchema: {
      example: 'assets/eccbe50b-54cc-45f5-8692-76b11d080d71.png',
    },
  })
  avatar?: string;
 
  @property({
    type: 'string',
    required: true,
    jsonSchema: {
      format: 'email',
      transform: ['toLowerCase'],
    },
  })
  contact_email: string;
 
  @property({
    type: 'string',
    required: true,
  })
  contact_number: string;
 
  @property({
    type: 'boolean',
    default: false,
  })
  contact_number_overwrite?: boolean;
 
  company_id?: number;
  role_id?: number;
 
  constructor(data?: Partial<UserProfile>) {
    super(data);
  }
}