go-guess/backend/internal/service/model/models.go

129 lines
2.5 KiB
Go
Raw Normal View History

2026-09-19 20:31:14 +02:00
package model
import "time"
type User struct {
ID uint
Email string
PasswordHash string
DisplayName string
2026-09-19 20:31:14 +02:00
Role string
feat: avatar, account menu, and single sign-on from Go Loose Signing in now starts at the sign-in screen and one button that hands the browser to Go Loose, which returns to the welcome page. Nothing redirects to the identity provider on its own any more: that fired on every anonymous visit and read as a redirect loop rather than as a choice to sign in. The password form remains only where the API reports that Go Loose login is not configured for the host, because otherwise the application is unreachable on a bare localhost. A person's picture is carried through from the Go Loose identity and rendered in the account menu and on the profile page, with their initials as the fallback. Two things make that fallback necessary rather than decorative: Go Loose retires a picture key when a picture is replaced, so a link cached in a browser can be dead, and most people have not uploaded one. The URL is deliberately not persisted locally, since a stored key would keep failing after the picture changed. The account menu is a disclosure rather than a hover menu: a real button with aria-expanded, Escape and outside clicks closing it, and focus returning to the trigger. It is not an ARIA menu, because its actions are a link and a button and menuitem roles would strip the link semantics from one of them for no gain. The account URL of the Go Loose identity is resolved on each sign-in and is read from the live identity provider every time, which is also what makes it correct after a picture change. Depends on the Go Loose revision that serves avatar_url through /connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
// AvatarURL is the picture Go Loose serves for this person. It is resolved
// from the identity provider on every sign-in rather than stored, because a
// stored key stops resolving once the picture is replaced or removed.
AvatarURL string
2026-09-19 20:31:14 +02:00
}
type Trait struct {
ID uint
Name string
}
type JobPosting struct {
ID uint
Title string
Description string
Seniority string
Position string
Status string
DurationMinutes int
Labels []Trait
RequiredSkills []Trait
AdditionalSkills []Trait
Questions []Question
CreatedAt time.Time
}
type Question struct {
ID uint
Text string
Type string
Options []string
2026-09-19 20:56:27 +02:00
CodeSnippet string
2026-09-19 20:31:14 +02:00
ReferenceAnswer string
Deprecated bool
}
type Participant struct {
ID uint
FirstName string
LastName string
Birthday *time.Time
Email string
ContactInfo string
Photo []byte
PhotoType string
CV []byte
CVFilename string
Traits []Trait
CreatedAt time.Time
}
type CandidateMatch struct {
Participant Participant
Score float64
Matched []string
Missing []string
}
type Invitation struct {
ID uint
JobID uint
ParticipantID uint
ParticipantName string
ParticipantEmail string
Token string
Status string
Outcome string
2026-09-19 20:31:14 +02:00
DurationMinutes int
AcceptedAt *time.Time
CompletedAt *time.Time
CreatedAt time.Time
}
type ScheduledInterview struct {
ID uint
JobID uint
InvitationID uint
ParticipantID uint
CreatorID uint
StartsAt time.Time
Location string
CandidateToken string
SharedDocument string
Status string
Job JobPosting
Invitation Invitation
Participant Participant
Creator User
Attendees []InterviewAttendee
Notes []InterviewNote
CreatedAt time.Time
UpdatedAt time.Time
}
type InterviewAttendee struct {
ID uint
InterviewID uint
UserID uint
Status string
User User
CreatedAt time.Time
UpdatedAt time.Time
}
type InterviewNote struct {
ID uint
InterviewID uint
AuthorID uint
Author User
Body string
CreatedAt time.Time
}
2026-09-19 20:31:14 +02:00
type Interview struct {
Invitation Invitation
Job JobPosting
Answers map[uint]string
}