generated from nhcarrigan/template
6bf1ac5e7d
## Summary - Grants the Elysian Discord role to players on login/registration and persists an `inGuild` flag on the Player record - Connects to the Discord Gateway via WebSocket to keep `inGuild` in sync as players join or leave the server - Shows a dismissible "Join our community" modal to players who are not yet in the guild - Hardens `inGuild` exposure through the load endpoint and game context - Moves all non-secret Discord IDs (guild, role, client, redirect URI) out of env vars and into hardcoded constants; removes them from `prod.env` ## Test plan - [ ] Lint, build, and test pipeline passes (100% coverage maintained) - [ ] New player auth grants Elysian role and sets `inGuild: true` - [ ] Existing player auth re-attempts role grant and updates `inGuild` - [ ] Join community modal appears for players not in the guild - [ ] Modal does not reappear within the same browser session after dismissal - [ ] Gateway correctly sets `inGuild: true/false` on member add/remove events ✨ This issue was created with help from Hikari~ 🌸 Reviewed-on: #134 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mongodb"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Player {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
discordId String @unique
|
|
username String
|
|
discriminator String
|
|
avatar String?
|
|
characterName String @default("")
|
|
pronouns String @default("")
|
|
characterRace String @default("")
|
|
characterClass String @default("")
|
|
bio String @default("")
|
|
guildName String @default("")
|
|
guildDescription String @default("")
|
|
profileSettings Json?
|
|
unlockedTitles Json?
|
|
activeTitle String @default("")
|
|
createdAt Float
|
|
lastSavedAt Float
|
|
totalGoldEarned Float @default(0)
|
|
totalClicks Float @default(0)
|
|
lifetimeGoldEarned Float @default(0)
|
|
lifetimeClicks Float @default(0)
|
|
lifetimeBossesDefeated Float @default(0)
|
|
lifetimeQuestsCompleted Float @default(0)
|
|
lifetimeAdventurersRecruited Float @default(0)
|
|
lifetimeAchievementsUnlocked Float @default(0)
|
|
lastLoginDate String?
|
|
loginStreak Int @default(1)
|
|
inGuild Boolean @default(false)
|
|
}
|
|
|
|
model GameState {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
discordId String @unique
|
|
state Json
|
|
updatedAt Float
|
|
}
|
|
|