91 lines
1.6 KiB
TypeScript
91 lines
1.6 KiB
TypeScript
import { ImageType, Model } from "./Model";
|
|
import { Attachment } from "./Attachment";
|
|
import type { Setting } from "./Setting";
|
|
|
|
export type User = {
|
|
name: string;
|
|
nick?: string;
|
|
password?: string;
|
|
email?: string;
|
|
emailVerifyAt?: number;
|
|
phoneNo?: string;
|
|
phoneNoVerifyAt?: number;
|
|
wrapperType?: ImageType;
|
|
avatarType?: ImageType;
|
|
exp?: number;
|
|
sex?: number;
|
|
birthdate?: number;
|
|
qq?: string;
|
|
description?: string;
|
|
lastLoginIP?: string;
|
|
lastLoginAt?: number;
|
|
unmuteAt?: number;
|
|
unbanAt?: number;
|
|
roleList?: string[];
|
|
permissionList?: string[];
|
|
attachmentList?: Attachment[];
|
|
settingList?: Setting[];
|
|
tempFileIdList?: string[];
|
|
muting?: boolean;
|
|
banning?: boolean;
|
|
emailVerified?: boolean;
|
|
phoneNoVerified?: boolean;
|
|
} & Model;
|
|
|
|
export enum UserAttachType {
|
|
|
|
AVATAR = "AVATAR",
|
|
|
|
WRAPPER = "WRAPPER",
|
|
|
|
LICENSE = "LICENSE",
|
|
|
|
DEFAULT_AVATAR = "DEFAULT_AVATAR",
|
|
|
|
DEFAULT_WRAPPER = "DEFAULT_WRAPPER"
|
|
}
|
|
|
|
export type RegisterRequest = {
|
|
name: string;
|
|
password: string;
|
|
email?: string;
|
|
};
|
|
|
|
export type LoginRequest = {
|
|
user: string;
|
|
password: string;
|
|
};
|
|
|
|
export type UpdatePasswordRequest = {
|
|
oldValue: string;
|
|
newValue: string;
|
|
};
|
|
|
|
// 登录返回
|
|
export type LoginResponse = {
|
|
id: string;
|
|
token: string;
|
|
expireAt: number;
|
|
user?: User;
|
|
};
|
|
|
|
export type LoginUser = {
|
|
id?: string;
|
|
token?: string;
|
|
expireAt?: number;
|
|
user?: User;
|
|
};
|
|
|
|
export enum LoginType {
|
|
ALERT,
|
|
IFRAME,
|
|
REDIRECT
|
|
}
|
|
|
|
export type UserLevelType = {
|
|
exp: number; // 经验数值,和 UserData.exp 一样
|
|
value: number; // 经验对应等级,[0, 8]
|
|
percent: number; // 该经验在该等级的百分比 [0, 1]
|
|
nextLevelUp: number; // 下一级经验值
|
|
}
|