stud-manager / types.ts
dvc890's picture
Update types.ts
c6da0ce verified
export enum UserRole {
ADMIN = 'ADMIN',
PRINCIPAL = 'PRINCIPAL',
TEACHER = 'TEACHER',
STUDENT = 'STUDENT',
USER = 'USER'
}
export enum UserStatus {
ACTIVE = 'active',
PENDING = 'pending',
BANNED = 'banned'
}
export interface User {
id?: number;
_id?: string;
username: string;
password?: string;
trueName?: string;
phone?: string;
email?: string;
schoolId?: string;
role: UserRole | string;
status: UserStatus | string;
avatar?: string;
createTime?: string;
teachingSubject?: string;
homeroomClass?: string;
aiAccess?: boolean;
menuOrder?: string[];
classApplication?: {
type: 'CLAIM' | 'RESIGN';
targetClass?: string;
status: 'PENDING' | 'REJECTED';
};
// For Principal creating a new school
pendingSchoolData?: {
name: string;
code: string;
};
studentNo?: string;
parentName?: string;
parentPhone?: string;
address?: string;
gender?: 'Male' | 'Female';
seatNo?: string;
idCard?: string;
doubaoState?: {
responseId?: string;
thinkingState?: boolean;
};
}
export interface Student {
id?: number;
_id?: string;
schoolId?: string;
studentNo: string;
seatNo?: string;
name: string;
gender: 'Male' | 'Female';
birthday?: string;
idCard?: string;
phone?: string;
className: string;
status: 'Enrolled' | 'Graduated' | 'Suspended';
parentName?: string;
parentPhone?: string;
address?: string;
teamId?: string;
drawAttempts?: number;
dailyDrawLog?: { date: string, count: number };
flowerBalance?: number;
// New Seating Fields
height?: number; // cm
vision?: 'Normal' | 'Near-Mild' | 'Near-Severe' | 'Far' | 'Unknown';
character?: 'Active' | 'Quiet' | 'Naughty' | 'Steady' | 'Unknown';
seatRow?: number;
seatCol?: number;
}
export interface PeriodConfig {
period: number;
name: string;
startTime?: string;
endTime?: string;
}
export interface ClassInfo {
id?: number;
_id?: string;
schoolId?: string;
grade: string;
className: string;
teacherName?: string;
homeroomTeacherIds?: string[];
studentCount?: number;
periodConfig?: PeriodConfig[];
seatingConfig?: { rows: number; cols: number; }; // New layout config
}
export interface Course {
id?: number;
_id?: string;
schoolId?: string;
courseCode?: string;
courseName: string;
teacherName: string;
teacherId?: string;
className: string;
credits?: number;
capacity?: number;
enrolled?: number;
}
export type ExamStatus = 'Normal' | 'Absent' | 'Leave' | 'Cheat';
export interface Score {
id?: number;
_id?: string;
schoolId?: string;
studentName: string;
studentNo: string;
courseName: string;
score: number;
semester?: string;
type: string;
examName?: string;
status?: ExamStatus;
}
export interface Subject {
id?: number;
_id?: string;
schoolId?: string;
name: string;
code?: string;
color?: string;
excellenceThreshold?: number;
thresholds?: Record<string, number>;
}
export interface Exam {
_id?: string;
schoolId?: string;
name: string;
date: string;
type: string; // 'Midterm', 'Final', 'Quiz'
semester?: string;
}
export interface Schedule {
id?: number;
_id?: string;
schoolId?: string;
className: string;
teacherName: string;
subject: string;
dayOfWeek: number;
period: number;
weekType?: 'ALL' | 'ODD' | 'EVEN';
}
export interface School {
id?: number;
_id?: string;
name: string;
code: string;
}
export interface Notification {
_id?: string;
schoolId?: string;
targetRole?: string;
targetUserId?: string;
title: string;
content: string;
type: 'info' | 'success' | 'warning' | 'error';
createTime: string;
}
export interface OpenRouterModelConfig {
id: string; // The model name (e.g., qwen/qwen3-coder:free)
name?: string; // Optional friendly name
apiUrl?: string; // Optional custom API URL
isCustom: boolean; // Built-in vs Custom
}
export interface DoubaoModelConfig {
modelId: string; // The Model ID (e.g. doubao-pro-32k)
endpointId: string; // The Endpoint ID (e.g. ep-2024xxxx) - Required for API
name?: string; // Friendly Name
}
export interface SystemConfig {
systemName: string;
semester: string;
semesters?: string[];
allowRegister: boolean;
allowAdminRegister: boolean;
allowPrincipalRegister?: boolean;
allowStudentRegister?: boolean;
maintenanceMode: boolean;
emailNotify: boolean;
enableAI?: boolean;
aiTotalCalls?: number;
aiProviderOrder?: string[]; // 'GEMINI', 'OPENROUTER', 'GEMMA', 'DOUBAO'
periodConfig?: PeriodConfig[];
apiKeys?: {
gemini?: string[];
openrouter?: string[];
doubao?: string[]; // NEW: Doubao keys
};
doubaoModels?: DoubaoModelConfig[]; // NEW
openRouterModels?: OpenRouterModelConfig[];
}
export interface SchoolCalendarEntry {
_id?: string;
schoolId: string;
className?: string;
type: 'HOLIDAY' | 'BREAK' | 'OFF' | 'WORKDAY';
startDate: string;
endDate: string;
name: string;
}
export interface Todo {
_id?: string;
userId: string;
content: string;
isCompleted: boolean;
createTime: string;
}
// Game & Rewards
export interface GameTeam {
id: string;
name: string;
score: number;
avatar: string;
color: string;
members: string[];
}
export interface GameRewardConfig {
scoreThreshold: number;
rewardType: 'DRAW_COUNT' | 'ITEM' | 'ACHIEVEMENT';
rewardName: string;
rewardValue: number;
achievementId?: string;
}
export interface GameSession {
_id?: string;
schoolId: string;
className: string;
subject: string;
isEnabled: boolean;
maxSteps: number;
teams: GameTeam[];
rewardsConfig: GameRewardConfig[];
}
export interface StudentReward {
_id?: string;
schoolId: string;
studentId: string;
studentName: string;
rewardType: 'DRAW_COUNT' | 'ITEM' | 'CONSOLATION' | 'ACHIEVEMENT';
name: string;
count: number;
status: 'PENDING' | 'REDEEMED';
source: string;
createTime: string;
ownerId?: string;
}
export interface LuckyPrize {
id: string;
name: string;
probability: number;
count: number;
icon?: string;
}
export interface LuckyDrawConfig {
_id?: string;
schoolId: string;
className: string;
ownerId?: string;
prizes: LuckyPrize[];
dailyLimit: number;
cardCount: number;
defaultPrize: string;
consolationWeight: number;
}
export interface AchievementItem {
id: string;
name: string;
icon: string;
points: number;
description?: string;
addedBy?: string;
addedByName?: string;
}
export interface ExchangeRule {
id: string;
cost: number;
rewardType: 'DRAW_COUNT' | 'ITEM';
rewardName: string;
rewardValue: number;
achievementId?: string;
}
export interface AchievementConfig {
_id?: string;
schoolId: string;
className: string;
achievements: AchievementItem[];
exchangeRules: ExchangeRule[];
}
export interface TeacherExchangeConfig {
_id?: string;
schoolId: string;
teacherId: string;
teacherName: string;
rules: ExchangeRule[];
}
export interface StudentAchievement {
_id?: string;
schoolId: string;
studentId: string;
studentName: string;
achievementId: string;
achievementName: string;
achievementIcon: string;
points?: number;
semester: string;
createTime: string;
}
export interface Attendance {
_id?: string;
schoolId: string;
studentId: string;
studentName: string;
className: string;
date: string;
status: 'Present' | 'Absent' | 'Leave';
checkInTime?: string;
}
export interface LeaveRequest {
_id?: string;
schoolId: string;
studentId: string;
studentName: string;
className: string;
reason: string;
startDate: string;
endDate: string;
status: 'Pending' | 'Approved' | 'Rejected';
createTime: string;
}
export interface Wish {
_id?: string;
schoolId: string;
studentId: string;
studentName: string;
className?: string;
teacherId: string;
teacherName: string;
content: string;
status: 'PENDING' | 'FULFILLED';
createTime: string;
fulfillTime?: string;
}
export interface Feedback {
_id?: string;
schoolId: string;
creatorId: string;
creatorName: string;
creatorRole: string;
targetId?: string;
targetName?: string;
content: string;
type: 'ACADEMIC' | 'SYSTEM';
status: 'PENDING' | 'ACCEPTED' | 'PROCESSED' | 'IGNORED';
reply?: string;
createTime: string;
updateTime?: string;
}
export interface AIChatMessage {
id: string;
role: 'user' | 'model';
text?: string;
thought?: string; // New: For Deep Thinking Chain of Thought
audio?: string;
images?: string[];
isAudioMessage?: boolean;
isGeneratingAudio?: boolean; // New status flag for UI
isSearching?: boolean; // New status flag for search
timestamp: number;
}
// --- Comment Generator Types ---
export type ClassRole = 'YES' | 'NO';
export type Discipline = 'YES' | 'AVERAGE' | 'NO';
export type AcademicQuality = 'EXCELLENT' | 'GOOD' | 'PASS' | 'FAIL';
export type Personality = '活泼' | '内敛' | '沉稳' | '细心' | '热心' | '恒心' | '爱心' | '勇敢' | '正义';
export type Hobby = '体育' | '音乐' | '舞蹈' | '绘画' | '书法' | '手工' | '其他';
export type Labor = '热爱' | '一般' | '较少参与';
export type Zodiac = '鼠' | '牛' | '虎' | '兔' | '龙' | '蛇' | '马' | '羊' | '猴' | '鸡' | '狗' | '猪';
// 学生画像接口
export interface StudentProfile {
name: string;
classRole: ClassRole;
discipline: Discipline;
academic: AcademicQuality;
personality: Personality;
hobby: Hobby;
labor: Labor;
zodiacYear: Zodiac;
wordCount: number;
}
// 已保存记录接口
export interface SavedRecord {
id: string;
name: string;
comment: string;
zodiac: Zodiac;
timestamp: number;
}