the0938

Untitled

Mar 18th, 2022 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {
  2.   ModelAttribute,
  3.   NameAttribute,
  4.   TypeAttribute,
  5.   IdAttribute,
  6.   BelongsToType,
  7.   DateTimeType,
  8.   NonEmptyStringType,
  9.   EmailStringType,
  10.   PhoneStringType,
  11.   BooleanType,
  12.   exposeApi,
  13. } from "@carrier-io/orm";
  14.  
  15. @ModelAttribute("user")
  16. export class UserModel {
  17.   @NameAttribute("id")
  18.   @TypeAttribute(new IdType())
  19.   @IdAttribute()
  20.   id;
  21.  
  22.   @NameAttribute("companyId")
  23.   @TypeAttribute(new BelongsToType(() => CompanyModel))
  24.   company;
  25.  
  26.   @NameAttribute("createdAt")
  27.   @TypeAttribute(new DateTimeType())
  28.   createdAt;
  29.  
  30.   @NameAttribute("updatedAt")
  31.   @TypeAttribute(new DateTimeType())
  32.   updatedAt;
  33.  
  34.   @NameAttribute("disabled")
  35.   @TypeAttribute(new BooleanType())
  36.   disabled;
  37.  
  38.   @NameAttribute("firstName")
  39.   @TypeAttribute(new NonEmptyStringType())
  40.   firstName;
  41.  
  42.   @NameAttribute("lastName")
  43.   @TypeAttribute(new NonEmptyStringType())
  44.   lastName;
  45.  
  46.   @NameAttribute('email')
  47.   @TypeAttribute(new EmailStringType())
  48.   email;
  49.  
  50.   @NameAttribute('phone')
  51.   @TypeAttribute(new PhoneStringType())
  52.   phone;
  53.  
  54.   @NameAttribute("status")
  55.   @TypeAttribute(new NonEmptyStringType({ optional: true }))
  56.   status;
  57. }
  58.  
  59. exposeApi(UserModel);
  60.  
Add Comment
Please, Sign In to add comment