import { ApiProperty } from '@midwayjs/swagger'; import { Rule, RuleType } from '@midwayjs/validate'; import { get } from 'lodash'; export enum LoginType { Admin = 'Admin', } export class LoginDTO { @ApiProperty({ description: '账号' }) @Rule(RuleType['string']().required()) account: string = undefined; @ApiProperty({ description: '密码' }) @Rule(RuleType['string']().required()) password: string = undefined; } export class UPwdDTO { @ApiProperty({ description: '用户数据id' }) @Rule(RuleType['string']().required()) _id: string = undefined; @ApiProperty({ description: '密码' }) @Rule(RuleType['string']().required()) password: string = undefined; } export class LoginVO { constructor(data: object) { this._id = get(data, '_id'); this.nick_name = get(data, 'nick_name'); this.openid = get(data, 'openid'); this.role = get(data, 'role'); this.is_super = get(data, 'is_super'); } _id: string; nick_name: string; openid: string; role: string; is_super: number; }