login.interface.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. User = 'User',
  7. }
  8. export class LoginDTO {
  9. @ApiProperty({ description: '账号' })
  10. @Rule(RuleType['string']().required())
  11. account: string = undefined;
  12. @ApiProperty({ description: '密码' })
  13. @Rule(RuleType['string']().required())
  14. password: string = undefined;
  15. }
  16. export class UPwdDTO {
  17. @ApiProperty({ description: '用户数据id' })
  18. @Rule(RuleType['string']().required())
  19. _id: string = undefined;
  20. @ApiProperty({ description: '密码' })
  21. @Rule(RuleType['string']().required())
  22. password: string = undefined;
  23. }
  24. export class LoginVO {
  25. constructor(data: object) {
  26. this._id = get(data, '_id');
  27. this.nick_name = get(data, 'nick_name');
  28. this.openid = get(data, 'openid');
  29. this.role = get(data, 'role');
  30. this.is_super = get(data, 'is_super');
  31. }
  32. _id: string;
  33. nick_name: string;
  34. openid: string;
  35. role: string;
  36. is_super: number;
  37. @ApiProperty({ description: '登录标识' })
  38. 'login_code': string = undefined;
  39. }