generated from nhcarrigan/template
feat: add character sheet panel with guild info
Adds pronouns, guildName, and guildDescription fields to the player profile. A new Character tab provides an in-game view/edit panel for character and guild lore. Closes #16
This commit is contained in:
@@ -13,9 +13,12 @@ model Player {
|
||||
username String
|
||||
discriminator String
|
||||
avatar String?
|
||||
characterName String @default("")
|
||||
bio String @default("")
|
||||
profileSettings Json?
|
||||
characterName String @default("")
|
||||
pronouns String @default("")
|
||||
bio String @default("")
|
||||
guildName String @default("")
|
||||
guildDescription String @default("")
|
||||
profileSettings Json?
|
||||
createdAt Float
|
||||
lastSavedAt Float
|
||||
totalGoldEarned Float @default(0)
|
||||
|
||||
@@ -69,9 +69,12 @@ profileRouter.get("/:discordId", async (context) => {
|
||||
|
||||
return context.json({
|
||||
characterName: player.characterName,
|
||||
pronouns: player.pronouns ?? "",
|
||||
username: player.username,
|
||||
avatar: player.avatar ?? null,
|
||||
bio: player.bio ?? "",
|
||||
guildName: player.guildName ?? "",
|
||||
guildDescription: player.guildDescription ?? "",
|
||||
profileSettings,
|
||||
createdAt: player.createdAt,
|
||||
// All Time stats — cumulative across all runs, never reset
|
||||
@@ -99,7 +102,10 @@ profileRouter.put("/", authMiddleware, async (context) => {
|
||||
const body = await context.req.json<UpdateProfileRequest>();
|
||||
|
||||
const characterName = (body.characterName ?? "").trim().slice(0, 32);
|
||||
const pronouns = (body.pronouns ?? "").trim().slice(0, 20);
|
||||
const bio = (body.bio ?? "").trim().slice(0, 200);
|
||||
const guildName = (body.guildName ?? "").trim().slice(0, 64);
|
||||
const guildDescription = (body.guildDescription ?? "").trim().slice(0, 500);
|
||||
const numberFormat = VALID_NUMBER_FORMATS.has(body.profileSettings?.numberFormat as string)
|
||||
? (body.profileSettings?.numberFormat as ProfileSettings["numberFormat"])
|
||||
: "suffix";
|
||||
@@ -129,12 +135,15 @@ profileRouter.put("/", authMiddleware, async (context) => {
|
||||
|
||||
const updated = await prisma.player.update({
|
||||
where: { discordId },
|
||||
data: { characterName, bio, profileSettings: profileSettings as object },
|
||||
data: { characterName, pronouns, bio, guildName, guildDescription, profileSettings: profileSettings as object },
|
||||
});
|
||||
|
||||
return context.json({
|
||||
characterName: updated.characterName,
|
||||
pronouns: updated.pronouns,
|
||||
bio: updated.bio,
|
||||
guildName: updated.guildName,
|
||||
guildDescription: updated.guildDescription,
|
||||
profileSettings,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user