354 lines
7.0 KiB
TypeScript
354 lines
7.0 KiB
TypeScript
// =====================================================
|
|
// 資料庫模型定義
|
|
// =====================================================
|
|
|
|
// 用戶模型
|
|
export interface User {
|
|
id: string;
|
|
name: string;
|
|
email: string;
|
|
password_hash: string;
|
|
avatar?: string;
|
|
department: string;
|
|
role: 'user' | 'developer' | 'admin';
|
|
join_date: string;
|
|
total_likes: number;
|
|
total_views: number;
|
|
is_active: boolean;
|
|
last_login?: string;
|
|
phone?: string;
|
|
location?: string;
|
|
bio?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 前端使用的 User 類型(不包含密碼)
|
|
export interface UserProfile {
|
|
id: string;
|
|
name: string;
|
|
email: string;
|
|
avatar?: string;
|
|
department: string;
|
|
role: 'user' | 'developer' | 'admin';
|
|
join_date: string;
|
|
total_likes: number;
|
|
total_views: number;
|
|
is_active: boolean;
|
|
last_login?: string;
|
|
phone?: string;
|
|
location?: string;
|
|
bio?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 評審模型
|
|
export interface Judge {
|
|
id: string;
|
|
name: string;
|
|
title: string;
|
|
department: string;
|
|
expertise: string[];
|
|
avatar?: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 團隊模型
|
|
export interface Team {
|
|
id: string;
|
|
name: string;
|
|
leader_id: string;
|
|
department: string;
|
|
contact_email: string;
|
|
total_likes: number;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 團隊成員模型
|
|
export interface TeamMember {
|
|
id: string;
|
|
team_id: string;
|
|
user_id: string;
|
|
role: string;
|
|
joined_at: string;
|
|
}
|
|
|
|
// 競賽模型
|
|
export interface Competition {
|
|
id: string;
|
|
name: string;
|
|
year: number;
|
|
month: number;
|
|
start_date: string;
|
|
end_date: string;
|
|
status: 'upcoming' | 'active' | 'judging' | 'completed';
|
|
description?: string;
|
|
type: 'individual' | 'team' | 'mixed' | 'proposal';
|
|
evaluation_focus?: string;
|
|
max_team_size?: number;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 競賽規則模型
|
|
export interface CompetitionRule {
|
|
id: string;
|
|
competition_id: string;
|
|
name: string;
|
|
description?: string;
|
|
weight: number;
|
|
order_index: number;
|
|
created_at: string;
|
|
}
|
|
|
|
// 競賽獎項類型模型
|
|
export interface CompetitionAwardType {
|
|
id: string;
|
|
competition_id: string;
|
|
name: string;
|
|
description?: string;
|
|
icon: string;
|
|
color: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
}
|
|
|
|
// 應用模型
|
|
export interface App {
|
|
id: string;
|
|
name: string;
|
|
description?: string;
|
|
creator_id: string;
|
|
team_id?: string;
|
|
category: string;
|
|
type: string;
|
|
likes_count: number;
|
|
views_count: number;
|
|
rating: number;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 提案模型
|
|
export interface Proposal {
|
|
id: string;
|
|
title: string;
|
|
description?: string;
|
|
problem_statement: string;
|
|
solution: string;
|
|
expected_impact: string;
|
|
team_id: string;
|
|
attachments?: string[];
|
|
status: 'draft' | 'submitted' | 'under_review' | 'approved' | 'rejected';
|
|
submitted_at?: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 應用評分模型
|
|
export interface AppJudgeScore {
|
|
id: string;
|
|
judge_id: string;
|
|
app_id: string;
|
|
innovation_score: number;
|
|
technical_score: number;
|
|
usability_score: number;
|
|
presentation_score: number;
|
|
impact_score: number;
|
|
total_score: number;
|
|
comments?: string;
|
|
submitted_at: string;
|
|
}
|
|
|
|
// 提案評分模型
|
|
export interface ProposalJudgeScore {
|
|
id: string;
|
|
judge_id: string;
|
|
proposal_id: string;
|
|
problem_identification_score: number;
|
|
solution_feasibility_score: number;
|
|
innovation_score: number;
|
|
impact_score: number;
|
|
presentation_score: number;
|
|
total_score: number;
|
|
comments?: string;
|
|
submitted_at: string;
|
|
}
|
|
|
|
// 獎項模型
|
|
export interface Award {
|
|
id: string;
|
|
competition_id: string;
|
|
app_id?: string;
|
|
team_id?: string;
|
|
proposal_id?: string;
|
|
app_name?: string;
|
|
team_name?: string;
|
|
proposal_title?: string;
|
|
creator: string;
|
|
award_type: 'gold' | 'silver' | 'bronze' | 'popular' | 'innovation' | 'technical' | 'custom';
|
|
award_name: string;
|
|
score: number;
|
|
year: number;
|
|
month: number;
|
|
icon: string;
|
|
custom_award_type_id?: string;
|
|
competition_type: 'individual' | 'team' | 'proposal';
|
|
rank: number;
|
|
category: 'innovation' | 'technical' | 'practical' | 'popular' | 'teamwork' | 'solution' | 'creativity';
|
|
created_at: string;
|
|
}
|
|
|
|
// 用戶收藏模型
|
|
export interface UserFavorite {
|
|
id: string;
|
|
user_id: string;
|
|
app_id: string;
|
|
created_at: string;
|
|
}
|
|
|
|
// 用戶按讚模型
|
|
export interface UserLike {
|
|
id: string;
|
|
user_id: string;
|
|
app_id: string;
|
|
liked_at: string;
|
|
}
|
|
|
|
// 用戶瀏覽記錄模型
|
|
export interface UserView {
|
|
id: string;
|
|
user_id: string;
|
|
app_id: string;
|
|
viewed_at: string;
|
|
ip_address?: string;
|
|
user_agent?: string;
|
|
}
|
|
|
|
// 用戶評分模型
|
|
export interface UserRating {
|
|
id: string;
|
|
user_id: string;
|
|
app_id: string;
|
|
rating: number;
|
|
rated_at: string;
|
|
}
|
|
|
|
// 聊天會話模型
|
|
export interface ChatSession {
|
|
id: string;
|
|
user_id: string;
|
|
session_name?: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 聊天訊息模型
|
|
export interface ChatMessage {
|
|
id: string;
|
|
session_id: string;
|
|
text: string;
|
|
sender: 'user' | 'bot';
|
|
quick_questions?: string[];
|
|
created_at: string;
|
|
}
|
|
|
|
// AI助手配置模型
|
|
export interface AIAssistantConfig {
|
|
id: string;
|
|
api_key: string;
|
|
api_url: string;
|
|
model: string;
|
|
max_tokens: number;
|
|
temperature: number;
|
|
system_prompt: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 系統設定模型
|
|
export interface SystemSetting {
|
|
id: string;
|
|
key: string;
|
|
value: string;
|
|
description?: string;
|
|
category: string;
|
|
is_public: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
// 活動日誌模型
|
|
export interface ActivityLog {
|
|
id: string;
|
|
user_id?: string;
|
|
action: string;
|
|
resource_type: string;
|
|
resource_id?: string;
|
|
details?: any;
|
|
ip_address?: string;
|
|
user_agent?: string;
|
|
created_at: string;
|
|
}
|
|
|
|
// 統計視圖模型
|
|
export interface UserStatistics {
|
|
id: string;
|
|
name: string;
|
|
email: string;
|
|
department: string;
|
|
role: string;
|
|
join_date: string;
|
|
total_likes: number;
|
|
total_views: number;
|
|
favorite_count: number;
|
|
liked_apps_count: number;
|
|
viewed_apps_count: number;
|
|
average_rating_given: number;
|
|
teams_joined: number;
|
|
teams_led: number;
|
|
}
|
|
|
|
export interface AppStatistics {
|
|
id: string;
|
|
name: string;
|
|
description?: string;
|
|
category: string;
|
|
type: string;
|
|
likes_count: number;
|
|
views_count: number;
|
|
rating: number;
|
|
creator_name: string;
|
|
creator_department: string;
|
|
team_name?: string;
|
|
favorite_users_count: number;
|
|
liked_users_count: number;
|
|
viewed_users_count: number;
|
|
average_judge_score: number;
|
|
judge_count: number;
|
|
}
|
|
|
|
export interface CompetitionStatistics {
|
|
id: string;
|
|
name: string;
|
|
year: number;
|
|
month: number;
|
|
type: string;
|
|
status: string;
|
|
judge_count: number;
|
|
app_count: number;
|
|
team_count: number;
|
|
proposal_count: number;
|
|
award_count: number;
|
|
}
|