Files
role-user/src/lib/types.ts
T
湛兮 3530219123 feat(users): 使用独立账号并简化选择样式
- login: 改为独立 C 端账号文案与身份类型
- digital: 世界书和风格改用平面选择列表,保留键盘焦点
- README: 同步独立登录与历史迁移说明
2026-10-27 18:56:24 +08:00

138 lines
2.8 KiB
TypeScript

/** 前台身份与业务协议,数字人账号使用独立 DIGITAL_USER 类型。 */
export type AccountType = "SUPER_ADMIN" | "EMPLOYEE" | "DIGITAL_USER";
export type Role = {
id: number;
code: string;
name: string;
};
export type AuthUser = {
id: number;
username: string;
displayName: string;
accountType: AccountType;
storeId?: number;
storeName?: string;
roles: Role[];
permissions: string[];
canManage: boolean;
lastLoginAt?: string | null;
mustChangePassword?: boolean;
};
export type PermissionMenu = {
key: string;
title: string;
permission: string;
actions: string[];
};
export type PermissionPayload = {
permissions: string[];
menus: PermissionMenu[];
};
export type ApiEnvelope<T> = {
success: boolean;
data: T;
message?: string;
};
export type LoginResponse = {
token: string;
tokenType: "Bearer";
expiresIn: string;
user: AuthUser;
};
export type TaskStatus = "pending" | "in_progress" | "completed" | "cancelled";
export type TaskSummary = {
id: string;
title: string;
description?: string;
status: TaskStatus;
priority: "low" | "normal" | "high" | "urgent";
dueAt?: string | null;
assigneeName?: string;
storeName?: string;
};
export type TaskAssignee = {
id: number;
name: string;
phone?: string;
};
export type TaskEvent = {
id: number;
taskId?: number;
eventType: "CREATED" | "UPDATED" | "STARTED" | "COMPLETED" | "CANCELLED" | "COMMENTED" | string;
fromStatus?: string | null;
toStatus?: string | null;
comment?: string | null;
createdAt?: string | null;
};
export type TaskDetail = TaskSummary & {
assignees: TaskAssignee[];
events: TaskEvent[];
createdAt?: string | null;
updatedAt?: string | null;
};
export type AnnouncementSummary = {
id: string;
title: string;
summary?: string;
level: "normal" | "important" | "urgent";
publishedAt?: string | null;
read: boolean;
};
export type AnnouncementDetail = AnnouncementSummary & {
content: string;
readAt?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
};
export type ShiftSummary = {
id: string;
date: string;
position: string;
startAt: string;
endAt: string;
status: "scheduled" | "cancelled" | "completed";
};
export type StoreEmployee = {
id: number;
name: string;
phone?: string;
status?: string;
roles: Role[];
};
export type StoreDetail = {
id: number;
name: string;
address?: string | null;
phone?: string | null;
status?: string;
employees: StoreEmployee[];
};
export type MobileBootstrap = {
user: AuthUser;
permissions: string[];
unreadAnnouncementCount: number;
pendingTaskCount: number;
overdueTaskCount: number;
todayShift: ShiftSummary | null;
todayShifts: ShiftSummary[];
latestAnnouncements: AnnouncementSummary[];
tasks: TaskSummary[];
};