feat: Implement an admin quest management table, enhance toast notifications with descriptions, and add new agent documentation.

This commit is contained in:
syntaxbullet
2026-01-16 15:58:48 +01:00
parent 4ecbffd617
commit 58f261562a
12 changed files with 589 additions and 44 deletions

View File

@@ -168,5 +168,34 @@ export const questService = {
return await DrizzleClient.query.quests.findMany({
orderBy: (quests, { asc }) => [asc(quests.id)],
});
},
async deleteQuest(id: number, tx?: Transaction) {
return await withTransaction(async (txFn) => {
return await txFn.delete(quests)
.where(eq(quests.id, id))
.returning();
}, tx);
},
async updateQuest(id: number, data: {
name?: string;
description?: string;
triggerEvent?: string;
requirements?: { target?: number };
rewards?: { xp?: number; balance?: number };
}, tx?: Transaction) {
return await withTransaction(async (txFn) => {
return await txFn.update(quests)
.set({
...(data.name !== undefined && { name: data.name }),
...(data.description !== undefined && { description: data.description }),
...(data.triggerEvent !== undefined && { triggerEvent: data.triggerEvent }),
...(data.requirements !== undefined && { requirements: data.requirements }),
...(data.rewards !== undefined && { rewards: data.rewards }),
})
.where(eq(quests.id, id))
.returning();
}, tx);
}
};