Conversation
chanabyte
commented
Jul 11, 2026
- added a way for shop to pull directly from db
- changed seed.ts to have default theme and animation options for frontend to pull from
- fixed the navbar so every page reflects data pulled from db
- fixed logic so that xp is deducted correctly when purchasing at the unlock endpoint.
- made changes so entries are made to the studentShopItem table to show ownership of multiple shopItems.
|
I resolved some merge conflicts and clicked on "Commit merge." Thankfully it's blocked by the review. But idk if that meant make those changes to the shop-bg-1 branch or if it meant go ahead and merge to stage. Also, was I supposed to make a pr for main instead of stage? Or are we defaulting to merging into stage from now? |
AidanLoran
left a comment
There was a problem hiding this comment.
mostly looks, fine, small changes. Wait for update on seed.ts so that it properly seeds with all of your shop items. Will get on that rn
There was a problem hiding this comment.
coach implementation's admin change makes the seed script fail before it can seed all of the themes since the admin table no longer exists.
| import { prisma } from '../../utils/prisma' | ||
| import { z } from 'zod' | ||
|
|
||
| const unlockSchema = z.object({ |
There was a problem hiding this comment.
throw this in the utils/schemas.ts for consistency
There was a problem hiding this comment.
^^ all of our zod schemas are going there, and it'll make reuse/updating easier
| export default defineEventHandler(async (event) => { | ||
| const session = await auth.api.getSession({ headers: event.headers }) | ||
|
|
||
| if (!session?.user) { |
There was a problem hiding this comment.
use server/utils/require-session.ts method requireSession instead
There was a problem hiding this comment.
'default' might be a better name instead of light
There was a problem hiding this comment.
see other comment about changing 'light' to 'default'
There was a problem hiding this comment.
'light' to 'default' again
| async function buyItem(item: any) { | ||
| if (stats.value.xp >= item.cost) { | ||
| try { | ||
| // await updateExp(-item.cost) |
There was a problem hiding this comment.
remove if shop/unlock now handles exp update
| export default defineEventHandler(async (event) => { | ||
| const session = await auth.api.getSession({ headers: event.headers }) | ||
|
|
||
| if (!session?.user) { |
There was a problem hiding this comment.
use method requireSession from utils/requireSession
| throw createError({ statusCode: 401, statusMessage: 'Unauthorized' }) | ||
| } | ||
|
|
||
| const studentIdRaw = getQuery(event).studentId |
There was a problem hiding this comment.
you can use z.int.safeParse for this, not super necessary