invite

package
v0.0.0-...-59f4e89 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInviteNotFound                 = customerror.Make("convite não encontrado", http.StatusNotFound, errors.New("ErrInviteNotFound"))
	ErrInviteInactive                 = customerror.Make("convite inativo", http.StatusBadRequest, errors.New("ErrInviteInactive"))
	ErrInviteExpired                  = customerror.Make("convite expirado", http.StatusBadRequest, errors.New("ErrInviteExpired"))
	ErrNotDisciplineOwner             = customerror.Make("você não tem permissão para esta disciplina", http.StatusForbidden, errors.New("ErrNotDisciplineOwner"))
	ErrEnrollmentNotFound             = customerror.Make("estudante não está vinculado à disciplina", http.StatusBadRequest, errors.New("ErrEnrollmentNotFound"))
	ErrEnrollmentRegistrationComplete = customerror.Make("cadastro desta matrícula já foi concluído para esta disciplina", http.StatusConflict, errors.New("ErrEnrollmentRegistrationComplete"))
	ErrStudentNotFound                = customerror.Make("estudante não encontrado", http.StatusNotFound, errors.New("ErrStudentNotFound"))
	ErrConsentRequired                = customerror.Make("é necessário aceitar o recebimento automatizado de notificações", http.StatusBadRequest, errors.New("ErrConsentRequired"))
	ErrContactRequired                = customerror.Make("preencha nome, email e telefone, ou informe que não possui telefone, para concluir o cadastro", http.StatusBadRequest, errors.New("ErrContactRequired"))
)

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Create() gin.HandlerFunc
	GetCurrent() gin.HandlerFunc
	ListByDiscipline() gin.HandlerFunc
	Delete() gin.HandlerFunc
	SelfRegister() gin.HandlerFunc
}

func NewHandler

func NewHandler(service Service) Handler

type Invite

type Invite struct {
	ID           string     `json:"id"`
	DisciplineID string     `json:"disciplineId"`
	Code         string     `json:"code"`
	ExpiresAt    *time.Time `json:"expiresAt"`
	Active       bool       `json:"active"`
	CreatedAt    time.Time  `json:"-"`
	UpdatedAt    time.Time  `json:"-"`
}

type Repository

type Repository interface {
	database.Transactional
	Create(ctx context.Context, disciplineID, code string, expiresAt *time.Time) error
	FindByID(ctx context.Context, id string) (*Invite, error)
	FindByCode(ctx context.Context, code string) (*Invite, error)
	FindLatestByDisciplineID(ctx context.Context, disciplineID string) (*Invite, error)
	FindByDisciplineID(ctx context.Context, disciplineID string) ([]*Invite, error)
	Delete(ctx context.Context, id string) error
}

func NewRepository

func NewRepository(db *sql.DB) Repository

type Service

type Service interface {
	Create(ctx context.Context, disciplineID, userID string, expiresAt *time.Time) (*Invite, error)
	GetCurrent(ctx context.Context, disciplineID, userID string) (*Invite, error)
	ListByDiscipline(ctx context.Context, disciplineID, userID string) ([]*Invite, error)
	Delete(ctx context.Context, inviteID, userID string) error
	SelfRegister(ctx context.Context, code, studentID, name, phone string, noPhone bool, email string, consent bool) error
}

func NewService

func NewService(
	inviteRepository Repository,
	disciplineRepository discipline.Repository,
	enrollmentRepository enrollment.Repository,
	studentRepository student.Repository,
) Service

Jump to

Keyboard shortcuts

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