school-timetracker/backend/models.go

61 lines
1.6 KiB
Go

package main
import (
"time"
)
type TimeEntry struct {
ID int `json:"id"`
UserID int `json:"user_id"`
ScheduleID int `json:"schedule_id"`
Date string `json:"date"`
Type string `json:"type"`
StartTime string `json:"start_time"` // Neu
EndTime string `json:"end_time"` // Neu
CreatedAt time.Time `json:"created_at"`
Username string `json:"username"` // Neu - für Join
}
type WeeklyHours struct {
UserID int `json:"user_id"`
Username string `json:"username"`
Week int `json:"week"`
Year int `json:"year"`
TotalHours float64 `json:"total_hours"`
}
type User struct {
ID int `json:"id"`
Username string `json:"username"`
Password string `json:"-"`
IsAdmin bool `json:"is_admin"`
}
type Schedule struct {
ID int `json:"id"`
DayOfWeek int `json:"day_of_week"` // 0=Monday, 4=Friday
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Type string `json:"type"` // "lesson" or "break"
Title string `json:"title"`
}
// type TimeEntry struct {
// ID int `json:"id"`
// UserID int `json:"user_id"`
// ScheduleID int `json:"schedule_id"`
// Date string `json:"date"`
// Type string `json:"type"` // "lesson" or "break"
// CreatedAt time.Time `json:"created_at"`
// }
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type LoginResponse struct {
Token string `json:"token"`
Username string `json:"username"`
IsAdmin bool `json:"is_admin"`
}