Files
mixmaker/backend/internal/application/discord_roles.go
lemintare e5646ba33d
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / compose (push) Has been cancelled
Enhance Discord role management by adding hoist functionality
This commit introduces a new `hoist` attribute for Discord roles, allowing team roles and the registered role to be displayed in separate groups within the Discord member list. The `RoleWorker` has been updated to ensure team roles are positioned above the registered role, improving visibility and organization. Database schema changes have been made to support the new `hoist` field, and corresponding updates have been implemented in the service layer and tests to validate the new behavior.
2026-07-19 11:52:57 +03:00

74 lines
2.1 KiB
Go

package application
import (
"context"
"time"
"mixmaker/backend/internal/domain"
)
const (
DiscordRoleScopeGlobal = "global"
DiscordRoleScopeEvent = "event"
DiscordRoleKindTank = "tank"
DiscordRoleKindDamage = "damage"
DiscordRoleKindSupport = "support"
DiscordRoleKindTeam = "team"
DiscordRoleKindCaptain = "captain"
DiscordRoleKindRegistered = "registered"
DiscordRoleKindGoing = "going"
DiscordRoleKindMaybe = "maybe"
DiscordRoleKindNotGoing = "not_going"
DiscordRoleActionReconcile = "reconcile"
DiscordRoleActionRSVP = "rsvp"
DiscordRoleActionTeardown = "teardown"
)
type DiscordManagedRole struct {
Scope string
EventID string
TeamID string
Kind string
DiscordRoleID string
RoleName string
Hoist bool
}
type DiscordRoleSyncJob struct {
ID int64
EventID string
Action string
Generation int64
RoleSnapshot []string
Attempts int
}
type DiscordRoleRoster struct {
Roster domain.RosterDraft
PlayerDiscordIDs map[string]string
}
type DiscordRoleRegistration struct {
Event domain.Event
Registrations []domain.RSVP
PlayerDiscordIDs map[string]string
}
type DiscordRoleStore interface {
SeedDiscordRoleSyncJobs(context.Context) error
ClaimDiscordRoleSyncJob(context.Context) (DiscordRoleSyncJob, error)
CompleteDiscordRoleSyncJob(context.Context, int64, string) error
RetryDiscordRoleSyncJob(context.Context, int64, string, time.Time) error
ListDiscordManagedRoles(context.Context, string) ([]DiscordManagedRole, error)
UpsertDiscordManagedRole(context.Context, DiscordManagedRole) error
DeleteDiscordManagedRole(context.Context, DiscordManagedRole) error
ListDiscordRoleAssignments(context.Context, string) ([]string, error)
UpsertDiscordRoleAssignment(context.Context, string, string) error
DeleteDiscordRoleAssignment(context.Context, string, string) error
GetDiscordRoleRoster(context.Context, string) (DiscordRoleRoster, error)
ListActiveDiscordRoleRosters(context.Context) ([]DiscordRoleRoster, error)
GetDiscordRoleRegistration(context.Context, string) (DiscordRoleRegistration, error)
}