64e7176267
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 39s
CI / test-go-edu-search (push) Successful in 29s
CI / test-python-klausur (push) Failing after 2m35s
CI / test-python-agent-core (push) Successful in 19s
CI / test-nodejs-website (push) Successful in 21s
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
156 lines
6.6 KiB
Go
156 lines
6.6 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// TimetableClass is a school class managed for timetabling.
|
|
// Separate from the per-teacher `classes` table because timetabling is school-wide.
|
|
type TimetableClass struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
CreatedByUserID uuid.UUID `json:"created_by_user_id" db:"created_by_user_id"`
|
|
Name string `json:"name" db:"name"`
|
|
GradeLevel int `json:"grade_level" db:"grade_level"`
|
|
StudentCount int `json:"student_count" db:"student_count"`
|
|
Notes string `json:"notes,omitempty" db:"notes"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
// TimetablePeriod is one time slot in the weekly grid.
|
|
// DayOfWeek: 1=Mon..7=Sun. PeriodIndex: 1=first lesson of the day.
|
|
type TimetablePeriod struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
CreatedByUserID uuid.UUID `json:"created_by_user_id" db:"created_by_user_id"`
|
|
DayOfWeek int `json:"day_of_week" db:"day_of_week"`
|
|
PeriodIndex int `json:"period_index" db:"period_index"`
|
|
StartTime string `json:"start_time" db:"start_time"`
|
|
EndTime string `json:"end_time" db:"end_time"`
|
|
IsBreak bool `json:"is_break" db:"is_break"`
|
|
Label string `json:"label,omitempty" db:"label"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
// TimetableRoom is a physical room that can host lessons.
|
|
type TimetableRoom struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
CreatedByUserID uuid.UUID `json:"created_by_user_id" db:"created_by_user_id"`
|
|
Name string `json:"name" db:"name"`
|
|
RoomType string `json:"room_type,omitempty" db:"room_type"`
|
|
Capacity int `json:"capacity" db:"capacity"`
|
|
FloorLevel int `json:"floor_level" db:"floor_level"`
|
|
HasElevator bool `json:"has_elevator" db:"has_elevator"`
|
|
Notes string `json:"notes,omitempty" db:"notes"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
// TimetableSubject is a school-wide subject for timetabling.
|
|
type TimetableSubject struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
CreatedByUserID uuid.UUID `json:"created_by_user_id" db:"created_by_user_id"`
|
|
Name string `json:"name" db:"name"`
|
|
ShortCode string `json:"short_code" db:"short_code"`
|
|
Color string `json:"color,omitempty" db:"color"`
|
|
IsMainSubject bool `json:"is_main_subject" db:"is_main_subject"`
|
|
RequiredRoomType string `json:"required_room_type,omitempty" db:"required_room_type"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
// TimetableTeacher is a teacher as a schedulable resource.
|
|
// Independent from BreakPilot users — the Rektor enters all teachers manually.
|
|
type TimetableTeacher struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
CreatedByUserID uuid.UUID `json:"created_by_user_id" db:"created_by_user_id"`
|
|
FirstName string `json:"first_name" db:"first_name"`
|
|
LastName string `json:"last_name" db:"last_name"`
|
|
ShortCode string `json:"short_code" db:"short_code"`
|
|
EmploymentPercentage int `json:"employment_percentage" db:"employment_percentage"`
|
|
MaxHoursWeek int `json:"max_hours_week" db:"max_hours_week"`
|
|
Notes string `json:"notes,omitempty" db:"notes"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|
|
|
|
// TimetableCurriculum links a class to a subject with the weekly hour count.
|
|
type TimetableCurriculum struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
ClassID uuid.UUID `json:"class_id" db:"class_id"`
|
|
SubjectID uuid.UUID `json:"subject_id" db:"subject_id"`
|
|
WeeklyHours int `json:"weekly_hours" db:"weekly_hours"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
|
|
// Joined fields
|
|
SubjectName string `json:"subject_name,omitempty"`
|
|
ClassName string `json:"class_name,omitempty"`
|
|
}
|
|
|
|
// TimetableAssignment is the teaching contract: who teaches what subject in which class.
|
|
type TimetableAssignment struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
TeacherID uuid.UUID `json:"teacher_id" db:"teacher_id"`
|
|
ClassID uuid.UUID `json:"class_id" db:"class_id"`
|
|
SubjectID uuid.UUID `json:"subject_id" db:"subject_id"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
|
|
// Joined fields
|
|
TeacherName string `json:"teacher_name,omitempty"`
|
|
ClassName string `json:"class_name,omitempty"`
|
|
SubjectName string `json:"subject_name,omitempty"`
|
|
}
|
|
|
|
// Request DTOs
|
|
|
|
type CreateTimetableClassRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
GradeLevel int `json:"grade_level" binding:"required,min=1,max=13"`
|
|
StudentCount int `json:"student_count" binding:"min=0"`
|
|
Notes string `json:"notes"`
|
|
}
|
|
|
|
type CreateTimetablePeriodRequest struct {
|
|
DayOfWeek int `json:"day_of_week" binding:"required,min=1,max=7"`
|
|
PeriodIndex int `json:"period_index" binding:"required,min=1"`
|
|
StartTime string `json:"start_time" binding:"required"`
|
|
EndTime string `json:"end_time" binding:"required"`
|
|
IsBreak bool `json:"is_break"`
|
|
Label string `json:"label"`
|
|
}
|
|
|
|
type CreateTimetableRoomRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
RoomType string `json:"room_type"`
|
|
Capacity int `json:"capacity"`
|
|
FloorLevel int `json:"floor_level"`
|
|
HasElevator bool `json:"has_elevator"`
|
|
Notes string `json:"notes"`
|
|
}
|
|
|
|
type CreateTimetableSubjectRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
ShortCode string `json:"short_code" binding:"required"`
|
|
Color string `json:"color"`
|
|
IsMainSubject bool `json:"is_main_subject"`
|
|
RequiredRoomType string `json:"required_room_type"`
|
|
}
|
|
|
|
type CreateTimetableTeacherRequest struct {
|
|
FirstName string `json:"first_name" binding:"required"`
|
|
LastName string `json:"last_name" binding:"required"`
|
|
ShortCode string `json:"short_code" binding:"required"`
|
|
EmploymentPercentage int `json:"employment_percentage" binding:"min=0,max=100"`
|
|
MaxHoursWeek int `json:"max_hours_week" binding:"min=0"`
|
|
Notes string `json:"notes"`
|
|
}
|
|
|
|
type CreateTimetableCurriculumRequest struct {
|
|
ClassID string `json:"class_id" binding:"required,uuid"`
|
|
SubjectID string `json:"subject_id" binding:"required,uuid"`
|
|
WeeklyHours int `json:"weekly_hours" binding:"required,min=1,max=10"`
|
|
}
|
|
|
|
type CreateTimetableAssignmentRequest struct {
|
|
TeacherID string `json:"teacher_id" binding:"required,uuid"`
|
|
ClassID string `json:"class_id" binding:"required,uuid"`
|
|
SubjectID string `json:"subject_id" binding:"required,uuid"`
|
|
}
|