Files
daily-timer/internal/models/models.go
2026-02-08 05:31:11 +03:00

73 lines
3.7 KiB
Go

package models
import (
"time"
)
type Participant struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Email string `json:"email,omitempty"`
TimeLimit int `json:"timeLimit" gorm:"default:120"` // seconds
Order int `json:"order" gorm:"default:0"`
Active bool `json:"active" gorm:"default:true"`
CreatedAt time.Time `json:"createdAt" tsType:"string"`
UpdatedAt time.Time `json:"updatedAt" tsType:"string"`
}
type Meeting struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null;default:Daily Standup"`
TimeLimit int `json:"timeLimit" gorm:"default:3600"` // total meeting limit in seconds (1 hour)
Sessions []MeetingSession `json:"sessions,omitempty" gorm:"foreignKey:MeetingID"`
CreatedAt time.Time `json:"createdAt" tsType:"string"`
UpdatedAt time.Time `json:"updatedAt" tsType:"string"`
}
type MeetingSession struct {
ID uint `json:"id" gorm:"primaryKey"`
MeetingID uint `json:"meetingId" gorm:"not null"`
StartedAt time.Time `json:"startedAt" tsType:"string"`
EndedAt *time.Time `json:"endedAt,omitempty" tsType:"string"`
TotalDuration int `json:"totalDuration"` // seconds
Completed bool `json:"completed" gorm:"default:false"`
ParticipantLogs []ParticipantLog `json:"participantLogs,omitempty" gorm:"foreignKey:SessionID"`
Attendance []SessionAttendance `json:"attendance,omitempty" gorm:"foreignKey:SessionID"`
}
type ParticipantLog struct {
ID uint `json:"id" gorm:"primaryKey"`
SessionID uint `json:"sessionId" gorm:"not null"`
ParticipantID uint `json:"participantId" gorm:"not null"`
Participant Participant `json:"participant,omitempty" gorm:"foreignKey:ParticipantID"`
StartedAt time.Time `json:"startedAt" tsType:"string"`
EndedAt *time.Time `json:"endedAt,omitempty" tsType:"string"`
Duration int `json:"duration"` // seconds
Skipped bool `json:"skipped" gorm:"default:false"`
Overtime bool `json:"overtime" gorm:"default:false"`
Order int `json:"order"` // speaking order in session
}
type SessionAttendance struct {
ID uint `json:"id" gorm:"primaryKey"`
SessionID uint `json:"sessionId" gorm:"not null"`
ParticipantID uint `json:"participantId" gorm:"not null"`
Participant Participant `json:"participant,omitempty" gorm:"foreignKey:ParticipantID"`
Present bool `json:"present" gorm:"default:true"`
JoinedLate bool `json:"joinedLate" gorm:"default:false"`
}
type Settings struct {
ID uint `json:"id" gorm:"primaryKey"`
DefaultParticipantTime int `json:"defaultParticipantTime" gorm:"default:120"` // seconds
DefaultMeetingTime int `json:"defaultMeetingTime" gorm:"default:900"` // seconds
SoundEnabled bool `json:"soundEnabled" gorm:"default:true"`
SoundWarning string `json:"soundWarning" gorm:"default:warning.mp3"`
SoundTimeUp string `json:"soundTimeUp" gorm:"default:timeup.mp3"`
SoundMeetingEnd string `json:"soundMeetingEnd" gorm:"default:meeting_end.mp3"`
WarningThreshold int `json:"warningThreshold" gorm:"default:30"` // seconds before time up
Theme string `json:"theme" gorm:"default:dark"`
WindowWidth int `json:"windowWidth" gorm:"default:800"` // minimum 480
WindowFullHeight bool `json:"windowFullHeight" gorm:"default:true"` // use full screen height
}