feat(auth): 添加认证模块和图片批注功能(项目初始化)
- 实现用户登录、登出、密码修改等认证功能 - 添加会话管理和权限控制中间件 - 创建图片批注组件和相关API路由 - 实现批注的增删改查功能 - 添加Docker和Git忽略配置文件 - 创建系统架构文档和开发约定说明 - 集成认证模块到前端应用路由中
This commit is contained in:
234
shared/types.ts
Normal file
234
shared/types.ts
Normal file
@@ -0,0 +1,234 @@
|
||||
export type ReviewStatus = 'draft' | 'pending' | 'changes_requested' | 'approved';
|
||||
export type CollectionStatus = 'draft' | 'reviewing' | 'completed' | 'archived';
|
||||
export type UserRole = 'platform_admin' | 'group_admin' | 'operator';
|
||||
|
||||
export interface CurrentUser {
|
||||
id: number;
|
||||
group_id: number | null;
|
||||
group_name: string | null;
|
||||
username: string;
|
||||
display_name: string;
|
||||
role: UserRole;
|
||||
must_change_password: boolean;
|
||||
}
|
||||
|
||||
export interface OperationGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
status: 'active' | 'disabled';
|
||||
user_count: number;
|
||||
active_user_count: number;
|
||||
operator_count: number;
|
||||
disabled_user_count: number;
|
||||
project_count: number;
|
||||
customer_link_count: number;
|
||||
group_admin_name: string | null;
|
||||
group_admin_status: 'active' | 'disabled' | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ManagedUser {
|
||||
id: number;
|
||||
group_id: number | null;
|
||||
group_name: string | null;
|
||||
username: string;
|
||||
display_name: string;
|
||||
role: UserRole;
|
||||
status: 'active' | 'disabled';
|
||||
must_change_password: boolean;
|
||||
last_login_at: string | null;
|
||||
last_operation_at: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ManagedApiKey {
|
||||
id: number;
|
||||
group_id: number | null;
|
||||
project_id: number | null;
|
||||
project_name: string | null;
|
||||
name: string;
|
||||
key_prefix: string;
|
||||
scope: 'platform' | 'project';
|
||||
status: 'active' | 'revoked';
|
||||
created_by_name: string;
|
||||
last_used_at: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface StorageConfig {
|
||||
id: number;
|
||||
provider: 'tencent_cos';
|
||||
region: string;
|
||||
bucket: string;
|
||||
public_base_url: string;
|
||||
cdn_domain: string;
|
||||
path_prefix: string;
|
||||
status: 'draft' | 'active' | 'archived';
|
||||
test_status: 'untested' | 'passed' | 'failed';
|
||||
test_message: string;
|
||||
last_tested_at: string | null;
|
||||
created_by_name: string;
|
||||
created_at: string;
|
||||
activated_at: string | null;
|
||||
has_credentials: boolean;
|
||||
}
|
||||
|
||||
export interface AuditLogEntry {
|
||||
id: number;
|
||||
group_id: number | null;
|
||||
group_name: string | null;
|
||||
user_id: number | null;
|
||||
user_name: string | null;
|
||||
action: string;
|
||||
entity_type: string;
|
||||
entity_id: number | null;
|
||||
detail: Record<string, unknown>;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: number;
|
||||
group_id: number;
|
||||
group_name: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
client_description: string;
|
||||
status: 'active' | 'closed' | 'archived';
|
||||
customer_access_enabled: boolean;
|
||||
access_expires_at: string | null;
|
||||
has_access_password: boolean;
|
||||
collection_count: number;
|
||||
work_count: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface CustomerAccessState {
|
||||
project_name: string;
|
||||
client_description: string;
|
||||
enabled: boolean;
|
||||
expired: boolean;
|
||||
authenticated: boolean;
|
||||
reviewer_name: string | null;
|
||||
}
|
||||
|
||||
export interface WorkCollection {
|
||||
id: number;
|
||||
project_id: number;
|
||||
name: string;
|
||||
client_description: string;
|
||||
status: CollectionStatus;
|
||||
work_count: number;
|
||||
approved_count: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
id: number;
|
||||
collection_id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
tags: string[];
|
||||
review_status: ReviewStatus;
|
||||
version_number: number;
|
||||
cover_image: string;
|
||||
image_count: number;
|
||||
annotation_count: number;
|
||||
comment_count: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface NoteImage {
|
||||
id: number;
|
||||
note_id: number;
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
order_index: number;
|
||||
storage_provider: 'local' | 'tencent_cos';
|
||||
storage_key: string;
|
||||
}
|
||||
|
||||
export interface Annotation {
|
||||
id: number;
|
||||
image_id: number;
|
||||
x: number;
|
||||
y: number;
|
||||
content: string;
|
||||
author_name: string;
|
||||
status: 'open' | 'resolved' | 'confirmed';
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface WorkComment {
|
||||
id: number;
|
||||
note_id: number;
|
||||
content: string;
|
||||
author_name: string;
|
||||
author_role: 'client' | 'operator';
|
||||
status: 'open' | 'resolved' | 'confirmed';
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface TextAnnotation {
|
||||
id: number;
|
||||
note_id: number;
|
||||
version_number: number;
|
||||
target: 'title' | 'description';
|
||||
content: string;
|
||||
author_name: string;
|
||||
status: 'open' | 'resolved' | 'confirmed';
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ImageWithAnnotations extends NoteImage {
|
||||
annotations: Annotation[];
|
||||
}
|
||||
|
||||
export interface NoteDetail extends Note {
|
||||
images: ImageWithAnnotations[];
|
||||
text_annotations: TextAnnotation[];
|
||||
comments: WorkComment[];
|
||||
project: Pick<Project, 'id' | 'name' | 'slug'>;
|
||||
collection: Pick<WorkCollection, 'id' | 'name'>;
|
||||
versions: WorkVersion[];
|
||||
review_events: ReviewEvent[];
|
||||
}
|
||||
|
||||
export interface WorkVersion {
|
||||
version_number: number;
|
||||
title: string;
|
||||
description: string;
|
||||
tags: string[];
|
||||
review_status: ReviewStatus;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ReviewEvent {
|
||||
id: number;
|
||||
version_number: number;
|
||||
event_type: 'submitted' | 'approved' | 'changes_requested' | 'reopened';
|
||||
from_status: ReviewStatus | null;
|
||||
to_status: ReviewStatus;
|
||||
reason: string;
|
||||
actor_name: string;
|
||||
actor_role: 'client' | 'operator' | 'group_admin' | 'platform_admin';
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface CreateAnnotationRequest {
|
||||
x: number;
|
||||
y: number;
|
||||
content: string;
|
||||
author_name?: string;
|
||||
}
|
||||
|
||||
export interface NoteListQuery {
|
||||
sort?: 'created_at' | 'annotations';
|
||||
order?: 'asc' | 'desc';
|
||||
q?: string;
|
||||
collectionId?: number;
|
||||
status?: ReviewStatus;
|
||||
tag?: string;
|
||||
projectId?: number;
|
||||
groupId?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user