generated from nhcarrigan/template
feat: add race/class to character sheet, public /character/:id page
Players can now set their character's race and class in the Character tab. A new public page at /character/:id displays the full character sheet — name, pronouns, race, class, bio, and guild lore.
This commit is contained in:
@@ -15,6 +15,8 @@ model Player {
|
||||
avatar String?
|
||||
characterName String @default("")
|
||||
pronouns String @default("")
|
||||
characterRace String @default("")
|
||||
characterClass String @default("")
|
||||
bio String @default("")
|
||||
guildName String @default("")
|
||||
guildDescription String @default("")
|
||||
|
||||
@@ -70,6 +70,8 @@ profileRouter.get("/:discordId", async (context) => {
|
||||
return context.json({
|
||||
characterName: player.characterName,
|
||||
pronouns: player.pronouns ?? "",
|
||||
characterRace: player.characterRace ?? "",
|
||||
characterClass: player.characterClass ?? "",
|
||||
username: player.username,
|
||||
avatar: player.avatar ?? null,
|
||||
bio: player.bio ?? "",
|
||||
@@ -103,6 +105,8 @@ profileRouter.put("/", authMiddleware, async (context) => {
|
||||
|
||||
const characterName = (body.characterName ?? "").trim().slice(0, 32);
|
||||
const pronouns = (body.pronouns ?? "").trim().slice(0, 20);
|
||||
const characterRace = (body.characterRace ?? "").trim().slice(0, 32);
|
||||
const characterClass = (body.characterClass ?? "").trim().slice(0, 32);
|
||||
const bio = (body.bio ?? "").trim().slice(0, 200);
|
||||
const guildName = (body.guildName ?? "").trim().slice(0, 64);
|
||||
const guildDescription = (body.guildDescription ?? "").trim().slice(0, 500);
|
||||
@@ -135,12 +139,14 @@ profileRouter.put("/", authMiddleware, async (context) => {
|
||||
|
||||
const updated = await prisma.player.update({
|
||||
where: { discordId },
|
||||
data: { characterName, pronouns, bio, guildName, guildDescription, profileSettings: profileSettings as object },
|
||||
data: { characterName, pronouns, characterRace, characterClass, bio, guildName, guildDescription, profileSettings: profileSettings as object },
|
||||
});
|
||||
|
||||
return context.json({
|
||||
characterName: updated.characterName,
|
||||
pronouns: updated.pronouns,
|
||||
characterRace: updated.characterRace,
|
||||
characterClass: updated.characterClass,
|
||||
bio: updated.bio,
|
||||
guildName: updated.guildName,
|
||||
guildDescription: updated.guildDescription,
|
||||
|
||||
Reference in New Issue
Block a user