Some checks failed
Deploy to Production / test (push) Failing after 33s
- Rewrite AGENTS and README files to match the current app layout - Document API routes, trivia UI, and the active panel design language
1.1 KiB
1.1 KiB
Guild settings module
Responsibilities
- store raw per-guild settings in
guild_settings - convert DB rows to string-friendly objects for the API
- support the cached runtime view returned by
shared/lib/config.ts
Main methods
getSettings(guildId)upsertSettings({ guildId, ...fields })updateSetting(guildId, key, value)deleteSettings(guildId)addColorRole(guildId, roleId)removeColorRole(guildId, roleId)
Runtime cache
shared/lib/config.tscachesgetGuildConfig()results for 60 seconds- API writes invalidate that cache immediately
- the cached runtime shape is not identical to the DB shape:
studentRoleId->studentRolevisitorRoleId->visitorRolecolorRoleIds->colorRoles- terminal fields are grouped under
terminal
Notes
updateSetting()accepts friendly keys likestudentRole,welcomeChannel, andterminalMessage- Discord IDs are stored as
bigintin the DB and exposed as strings from the service addColorRole()andremoveColorRole()read-modify-write the whole array, so they are not atomic under concurrent updates