login.interface.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { ApiProperty } from '@midwayjs/swagger';
  2. import { Rule, RuleType } from '@midwayjs/validate';
  3. import { get } from 'lodash';
  4. export enum LoginType {
  5. Admin = 'Admin',
  6. }
  7. export class LoginDTO {
  8. @ApiProperty({ description: '账号' })
  9. @Rule(RuleType['string']().required())
  10. account: string = undefined;
  11. @ApiProperty({ description: '密码' })
  12. @Rule(RuleType['string']().required())
  13. password: string = undefined;
  14. }
  15. export class UPwdDTO {
  16. @ApiProperty({ description: '用户数据id' })
  17. @Rule(RuleType['string']().required())
  18. _id: string = undefined;
  19. @ApiProperty({ description: '密码' })
  20. @Rule(RuleType['string']().required())
  21. password: string = undefined;
  22. }
  23. export class LoginVO {
  24. constructor(data: object) {
  25. this._id = get(data, '_id');
  26. this.nick_name = get(data, 'nick_name');
  27. this.openid = get(data, 'openid');
  28. this.role = get(data, 'role');
  29. this.is_super = get(data, 'is_super');
  30. }
  31. _id: string;
  32. nick_name: string;
  33. openid: string;
  34. role: string;
  35. is_super: number;
  36. }