mosaicmap/types/site-config.ts
2025-08-15 22:31:51 +08:00

126 lines
2.8 KiB
TypeScript

// 与后端GraphQL接口对应的配置类型定义
export interface SiteInfoType {
name: string;
locale_default: string;
locales_supported: string[];
}
export interface BrandConfigType {
logo_url: string;
primary_color: string;
dark_mode_default: boolean;
}
export interface FooterLinkType {
name: string;
url: string;
visible_to_guest: boolean;
}
export interface SiteConfigType {
info: SiteInfoType;
brand: BrandConfigType;
footer_links: FooterLinkType[];
}
export interface BannerNoticeType {
enabled: boolean;
text: Record<string, string>; // locale -> text
}
export interface MaintenanceWindowType {
enabled: boolean;
start_time?: Date;
end_time?: Date;
message: Record<string, string>; // locale -> message
}
export interface ModalAnnouncementType {
id: string;
title: Record<string, string>; // locale -> title
content: Record<string, string>; // locale -> content
start_time: Date;
end_time: Date;
audience: string[];
priority: string;
}
export interface NoticeMaintenanceType {
banner: BannerNoticeType;
maintenance_window: MaintenanceWindowType;
modal_announcements: ModalAnnouncementType[];
}
export interface DocLinkType {
name: string;
url: string;
description: string;
}
export interface ChatGroupType {
name: string;
url?: string;
qr_code?: string;
description: string;
}
export interface SupportChannelsType {
email: string;
ticket_system: string;
chat_groups: ChatGroupType[];
working_hours: Record<string, string>; // locale -> hours
}
export interface DocsSupportType {
links: DocLinkType[];
channels: SupportChannelsType;
}
export interface FeatureSwitchesType {
registration_enabled: boolean;
invite_code_required: boolean;
email_verification: boolean;
}
export interface LimitsConfigType {
max_users: number;
max_invite_codes_per_user: number;
session_timeout_hours: number;
}
export interface NotificationConfigType {
welcome_email: boolean;
system_announcements: boolean;
maintenance_alerts: boolean;
}
export interface OpsConfigType {
features: FeatureSwitchesType;
limits: LimitsConfigType;
notifications: NotificationConfigType;
}
export interface SiteOpsConfigType {
site: SiteConfigType;
notice_maintenance: NoticeMaintenanceType;
docs_support: DocsSupportType;
ops: OpsConfigType;
}
export interface ConfigValidationResultType {
valid: boolean;
errors: string[];
warnings: string[];
}
// 配置更新相关类型
export interface ConfigUpdateInput {
key: string;
value: string; // 统一使用字符串类型以符合 GraphQL schema
}
export interface ConfigUpdateResult {
success: boolean;
message?: string;
}