team

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleOwner  = "owner"
	RoleAdmin  = "admin"
	RoleMember = "member"
)

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(dbExecutor db.DBTX, logger *zerolog.Logger) *repository

func Routes

func Routes(h *Handler, authMW *middle.AuthMiddleware) chi.Router

Types

type AcceptInvitationCmd

type AcceptInvitationCmd struct {
	Token    string
	Name     string
	Password string
}

type AcceptInvitationRequest

type AcceptInvitationRequest struct {
	Token    string `json:"token" validate:"required"`
	Name     string `json:"name" validate:"required,min=2,max=100"`
	Password string `json:"password" validate:"required,min=8,max=72"`
}

type CreateInvitationCmd

type CreateInvitationCmd struct {
	Email     string
	Role      string
	InvitedBy uuid.UUID
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service, validator *validator.Validate, logger *zerolog.Logger) *Handler

func (*Handler) AcceptInvitation

func (h *Handler) AcceptInvitation(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateInvitation

func (h *Handler) CreateInvitation(w http.ResponseWriter, r *http.Request)

func (*Handler) GetInvitationByToken

func (h *Handler) GetInvitationByToken(w http.ResponseWriter, r *http.Request)

func (*Handler) GetTeam

func (h *Handler) GetTeam(w http.ResponseWriter, r *http.Request)

func (*Handler) ListInvitations

func (h *Handler) ListInvitations(w http.ResponseWriter, r *http.Request)

func (*Handler) ListMembers

func (h *Handler) ListMembers(w http.ResponseWriter, r *http.Request)

func (*Handler) RevokeInvitation

func (h *Handler) RevokeInvitation(w http.ResponseWriter, r *http.Request)

func (*Handler) SetMemberActive

func (h *Handler) SetMemberActive(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateTeam

func (h *Handler) UpdateTeam(w http.ResponseWriter, r *http.Request)

type Invitation

type Invitation struct {
	ID         uuid.UUID
	Email      string
	Role       string
	Token      string
	ExpiresAt  time.Time
	AcceptedAt *time.Time
	InvitedBy  uuid.UUID
	CreatedAt  time.Time
}

type InvitationResponse

type InvitationResponse struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Role      string `json:"role"`
	Link      string `json:"link"`
	ExpiresAt string `json:"expires_at"`
	Accepted  bool   `json:"accepted"`
	CreatedAt string `json:"created_at"`
}

type InviteMemberRequest

type InviteMemberRequest struct {
	Email string `json:"email" validate:"required,email"`
	Role  string `json:"role" validate:"required,oneof=member admin owner"`
}

type Member

type Member struct {
	ID        uuid.UUID
	Name      string
	Email     string
	Role      string
	IsActive  bool
	CreatedAt time.Time
}

type MemberResponse

type MemberResponse struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	Role      string `json:"role"`
	IsActive  bool   `json:"is_active"`
	CreatedAt string `json:"created_at"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo *repository, appURL string) *Service

func (*Service) AcceptInvitation

func (s *Service) AcceptInvitation(ctx context.Context, cmd AcceptInvitationCmd) error

func (*Service) CreateInvitation

func (s *Service) CreateInvitation(ctx context.Context, cmd CreateInvitationCmd) (Invitation, error)

func (*Service) GetInvitationByToken

func (s *Service) GetInvitationByToken(ctx context.Context, token string) (Invitation, error)

func (*Service) GetTeam

func (s *Service) GetTeam(ctx context.Context) (Team, error)
func (s *Service) InviteLink(token string) string

func (*Service) ListInvitations

func (s *Service) ListInvitations(ctx context.Context) ([]Invitation, error)

func (*Service) ListMembers

func (s *Service) ListMembers(ctx context.Context) ([]Member, error)

func (*Service) RevokeInvitation

func (s *Service) RevokeInvitation(ctx context.Context, id uuid.UUID) error

func (*Service) SetMemberActive

func (s *Service) SetMemberActive(ctx context.Context, targetID, callerID uuid.UUID, active bool) error

func (*Service) UpdateTeamName

func (s *Service) UpdateTeamName(ctx context.Context, name string) error

type Team

type Team struct {
	ID   int
	Name string
}

type TeamResponse

type TeamResponse struct {
	Name string `json:"name"`
}

type UpdateTeamRequest

type UpdateTeamRequest struct {
	Name string `json:"name" validate:"required,min=1,max=100"`
}

Jump to

Keyboard shortcuts

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