domain

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = errors.New("resource not found")
	ErrUnauthorized       = errors.New("unauthorized")
	ErrForbidden          = errors.New("forbidden - insufficient permissions")
	ErrInvalidInput       = errors.New("invalid input")
	ErrAlreadyExists      = errors.New("resource already exists")
	ErrInvalidCredentials = errors.New("invalid credentials")
	ErrTokenExpired       = errors.New("token expired")
	ErrTokenRevoked       = errors.New("token revoked")
	ErrNotAMember         = errors.New("not a member of this class")
	ErrInvalidFileType    = errors.New("invalid file type")
	ErrFileTooLarge       = errors.New("file too large")
)

Common domain errors

Functions

This section is empty.

Types

type Absence

type Absence struct {
	ID          uuid.UUID     `json:"id"`
	StudentName string        `json:"student_name"`
	ClassID     uuid.UUID     `json:"class_id"`
	AbsenceDate time.Time     `json:"absence_date"`
	ReportedBy  ReportedBy    `json:"reported_by"`
	ReporterID  uuid.UUID     `json:"reporter_id"`
	Reason      *string       `json:"reason,omitempty"`
	Status      AbsenceStatus `json:"status"`
	CreatedAt   time.Time     `json:"created_at"`
	UpdatedAt   time.Time     `json:"updated_at"`
}

Absence represents a student absence record

type AbsenceStatus

type AbsenceStatus string

AbsenceStatus represents the status of an absence

const (
	AbsenceStatusPending AbsenceStatus = "PENDING"
	AbsenceStatusAcked   AbsenceStatus = "ACKED"
)

type Announcement

type Announcement struct {
	ID        uuid.UUID  `json:"id"`
	ClassID   *uuid.UUID `json:"class_id,omitempty"`
	AuthorID  uuid.UUID  `json:"author_id"`
	Title     string     `json:"title"`
	Body      string     `json:"body"`
	PublishAt time.Time  `json:"publish_at"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
}

Announcement represents a class or global announcement

type Class

type Class struct {
	ID        uuid.UUID  `json:"id"`
	Name      string     `json:"name"`
	Grade     string     `json:"grade"`
	SchoolID  *uuid.UUID `json:"school_id,omitempty"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
}

Class represents a school class

type ClassMember

type ClassMember struct {
	ID          uuid.UUID `json:"id"`
	UserID      uuid.UUID `json:"user_id"`
	ClassID     uuid.UUID `json:"class_id"`
	RoleInClass ClassRole `json:"role_in_class"`
	CreatedAt   time.Time `json:"created_at"`
}

ClassMember represents a user's membership in a class

type ClassRole

type ClassRole string

ClassRole represents a role within a class

const (
	ClassRoleTeacher ClassRole = "TEACHER"
	ClassRoleParent  ClassRole = "PARENT"
)

func (ClassRole) IsValid

func (cr ClassRole) IsValid() bool

IsValid checks if the class role is valid

type Message

type Message struct {
	ID          uuid.UUID  `json:"id"`
	SenderID    uuid.UUID  `json:"sender_id"`
	RecipientID *uuid.UUID `json:"recipient_id,omitempty"`
	ClassID     *uuid.UUID `json:"class_id,omitempty"`
	Body        string     `json:"body"`
	ReadAt      *time.Time `json:"read_at,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
}

Message represents a message between users

type Photo

type Photo struct {
	ID            uuid.UUID `json:"id"`
	ClassID       uuid.UUID `json:"class_id"`
	UploaderID    uuid.UUID `json:"uploader_id"`
	Caption       *string   `json:"caption,omitempty"`
	MediaKey      string    `json:"media_key"`
	ContentType   string    `json:"content_type"`
	FileSizeBytes int       `json:"file_size_bytes"`
	CreatedAt     time.Time `json:"created_at"`
}

Photo represents a photo uploaded to a class

type Profile

type Profile struct {
	UserID      uuid.UUID  `json:"user_id"`
	DisplayName string     `json:"display_name"`
	AvatarURL   *string    `json:"avatar_url,omitempty"`
	ChildName   *string    `json:"child_name,omitempty"`
	ClassID     *uuid.UUID `json:"class_id,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

Profile represents user profile information

type RefreshToken

type RefreshToken struct {
	ID        uuid.UUID  `json:"id"`
	UserID    uuid.UUID  `json:"user_id"`
	TokenHash string     `json:"-"` // Never serialize token
	ExpiresAt time.Time  `json:"expires_at"`
	RevokedAt *time.Time `json:"revoked_at,omitempty"`
	CreatedAt time.Time  `json:"created_at"`
}

RefreshToken represents a refresh token for JWT authentication

func (*RefreshToken) IsExpired

func (rt *RefreshToken) IsExpired() bool

IsExpired checks if the token has expired

func (*RefreshToken) IsRevoked

func (rt *RefreshToken) IsRevoked() bool

IsRevoked checks if the token has been revoked

func (*RefreshToken) IsValid

func (rt *RefreshToken) IsValid() bool

IsValid checks if the token is valid (not revoked and not expired)

type ReportedBy

type ReportedBy string

ReportedBy represents who reported an absence

const (
	ReportedByTeacher ReportedBy = "TEACHER"
	ReportedByParent  ReportedBy = "PARENT"
)

type Role

type Role string

Role represents user roles in the system

const (
	RoleTeacher Role = "TEACHER"
	RoleParent  Role = "PARENT"
	RoleAdmin   Role = "ADMIN"
)

func (Role) IsValid

func (r Role) IsValid() bool

IsValid checks if the role is valid

type User

type User struct {
	ID           uuid.UUID `json:"id"`
	Email        string    `json:"email"`
	PasswordHash string    `json:"-"` // Never serialize password
	Role         Role      `json:"role"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

User represents a system user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL