This commit is contained in:
Timi
2026-07-30 18:28:25 +08:00
parent 8b24804b22
commit f0d1090932
21 changed files with 915 additions and 268 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import type { AttachmentView } from "./Attachment";
import type { Attachment } from "./Attachment";
import type { Model } from "./Model";
// 文章
@@ -17,7 +17,7 @@ export type Article<E extends ArticleMusicExtendData | ArticleSoftwareExtendData
export type ArticleView<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
comments?: number;
attachmentList: AttachmentView[];
attachmentList: Attachment[];
} & Article<E>;
export enum ArticleType {
+29 -11
View File
@@ -2,23 +2,41 @@ import { Model } from "./Model";
export type Attachment = {
bizType: AttachmentBizType;
bizId: number;
bizId: string;
attachType?: string;
mongoId: string;
lidTitle?: number;
name?: string;
size: number;
} & Model
export type AttachmentView = {
title?: string;
} & Attachment
name?: string;
mimeType?: string;
metadata?: unknown;
size?: number;
md5?: string;
uploaderIp?: string;
isDestroyed?: boolean;
destroyAt?: number;
tempFileId?: string;
} & Model;
export type TempFileResp = {
id: string;
expireAt?: number;
};
export type BizUpdateReq = {
bizType: AttachmentBizType;
bizId: string;
items: Partial<Attachment>[];
};
export enum AttachmentBizType {
GIT_ISSUE,
USER = "USER",
GIT_MERGE,
GAO_CUSTOMER = "GAO_CUSTOMER",
GIT_RELEASE
GAO_REGISTER_RECORD = "GAO_REGISTER_RECORD",
TEMP_FILE = "TEMP_FILE",
MIRROR = "MIRROR"
}
+4 -4
View File
@@ -1,5 +1,5 @@
import { Model, Page } from "./Model";
import { UserView } from "./User";
import { User } from "./User";
/** 评论 */
export type Comment = {
@@ -10,7 +10,7 @@ export type Comment = {
content?: string;
/** 所属用户 */
user?: UserView;
user?: User;
/** 回复列表 */
replies?: CommentReply[];
@@ -41,8 +41,8 @@ export type CommentReply = {
content?: string;
comment?: Comment;
sender?: UserView;
receiver?: UserView;
sender?: User;
receiver?: User;
} & Model;
export enum CommentReplyBizType {
+6 -19
View File
@@ -6,7 +6,7 @@ export enum RunEnv {
// 基本实体模型
export type Model = {
id?: number;
id?: string;
createdAt?: number;
updatedAt?: number;
@@ -39,28 +39,15 @@ export type PageResult<T> = {
// 携带验证码的请求体
export type CaptchaData<T> = {
from: string;
captchaId: string;
captcha: string;
data: T;
}
export enum CaptchaFrom {
LOGIN = "LOGIN",
REGISTER = "REGISTER",
/** 评论 */
COMMENT = "COMMENT",
/** 评论回复 */
COMMENT_REPLY = "COMMENT_REPLY",
/** Git 反馈 */
GIT_ISSUE = "GIT_ISSUE",
/** Git 合并请求 */
GIT_MERGE = "GIT_MERGE",
// 图形验证码
export type CaptchaResult = {
id: string;
data: string;
}
export enum ImageType {
+17
View File
@@ -0,0 +1,17 @@
export type ModuleCode = "CORE" | "GAO";
export interface Permission {
id: string;
moduleCode: ModuleCode;
code: string;
nameLangId?: string;
name?: string;
description?: string;
createdAt?: number;
updatedAt?: number;
deletedAt?: number;
}
export type PermissionPayload = Pick<Permission, "moduleCode" | "code" | "nameLangId" | "name" | "description"> & {
id?: string;
};
+31
View File
@@ -0,0 +1,31 @@
import type { ModuleCode, Permission } from "./Permission";
export interface Role {
id: string;
moduleCode: ModuleCode;
code: string;
nameLangId?: string;
name?: string;
description?: string;
permissionList?: Permission[];
allPermissionList?: Permission[];
childRoleList?: Role[];
permissionIdList?: string[];
childRoleIdList?: string[];
createdAt?: number;
updatedAt?: number;
deletedAt?: number;
}
export type RolePayload = Pick<Role, "moduleCode" | "code" | "nameLangId" | "name" | "description"> & {
id?: string;
permissionIdList?: string[];
childRoleIdList?: string[];
};
export interface UserRoleAuthorizeReq {
userId: string;
moduleCode?: ModuleCode;
roleIdList?: string[];
roleCodeList?: string[];
}
+48 -47
View File
@@ -1,79 +1,80 @@
import { ImageType, Model } from "./Model";
import { AttachmentView } from "./Attachment";
import { Attachment } from "./Attachment";
import type { Setting } from "./Setting";
export type User = {
name: string;
nick?: string;
password?: string;
email?: string;
emailVerifyAt: number;
unmuteAt?: number;
unbanAt?: number;
} & Model;
export type UserView = {
profile: UserProfileView
} & User;
export enum UserAttachType {
AVATAR,
WRAPPER,
DEFAULT_AVATAR,
DEFAULT_WRAPPER,
}
export type UserProfile = {
userId: number;
avatarType: ImageType;
wrapperType: ImageType;
exp: number;
emailVerifyAt?: number;
phoneNo?: string;
phoneNoVerifyAt?: number;
wrapperType?: ImageType;
avatarType?: ImageType;
exp?: number;
sex?: number;
birthdate?: number;
qq?: string;
description: string;
description?: string;
lastLoginIP?: string;
lastLoginAt?: number;
updatedAt?: 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 type UserProfileView = {
attachmentList?: AttachmentView[]
} & UserProfile
export enum UserAttachType {
export type UserToken = {
value: string;
expireAt: number;
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: number;
id: string;
token: string;
expireAt: number;
}
user?: User;
};
export type LoginUser = {
token?: LoginToken;
user?: UserView
}
export type LoginToken = {
id?: number;
} & UserToken;
id?: string;
token?: string;
expireAt?: number;
user?: User;
};
export enum LoginType {
ALERT,
+2
View File
@@ -5,6 +5,8 @@ export * from "./Article";
export * from "./Setting";
export * from "./Attachment";
export * from "./Model";
export * from "./Permission";
export * from "./Role";
export * from "./User";
export * from "./Template";
export * from "./Comment";