This commit introduces the `DISCORD_GUILD_ID` environment variable to the configuration files, allowing for better integration with Discord for role synchronization. The event announcement functionality has been updated to include an option for the `@everyone` mention, which can be toggled during event creation. The backend logic has been modified to handle this new option, and corresponding updates have been made to the frontend to allow users to control the mention behavior. Additionally, tests have been added to ensure the correct functionality of these features.
61 lines
1.7 KiB
Go
61 lines
1.7 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"
|
|
|
|
DiscordRoleActionReconcile = "reconcile"
|
|
DiscordRoleActionTeardown = "teardown"
|
|
)
|
|
|
|
type DiscordManagedRole struct {
|
|
Scope string
|
|
EventID string
|
|
TeamID string
|
|
Kind string
|
|
DiscordRoleID string
|
|
RoleName string
|
|
}
|
|
|
|
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 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)
|
|
}
|