Skip to content

Backgrounds in User Shop#426

Open
chanabyte wants to merge 8 commits into
stagefrom
shop-bg-1
Open

Backgrounds in User Shop#426
chanabyte wants to merge 8 commits into
stagefrom
shop-bg-1

Conversation

@chanabyte

Copy link
Copy Markdown
Collaborator
  • 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.

@chanabyte
chanabyte requested a review from AidanLoran July 11, 2026 23:40
@chanabyte

Copy link
Copy Markdown
Collaborator Author

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?

@chanabyte chanabyte changed the title Shop bg 1 Backgrounds in User Shop Jul 11, 2026

@AidanLoran AidanLoran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread server/utils/schemas.ts
Comment thread prisma/seed.ts

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw this in the utils/schemas.ts for consistency

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ 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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use server/utils/require-session.ts method requireSession instead

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'default' might be a better name instead of light

Comment thread app/pages/reader/home.vue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see other comment about changing 'light' to 'default'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'light' to 'default' again

async function buyItem(item: any) {
if (stats.value.xp >= item.cost) {
try {
// await updateExp(-item.cost)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if shop/unlock now handles exp update

Comment thread server/api/shop/index.ts
export default defineEventHandler(async (event) => {
const session = await auth.api.getSession({ headers: event.headers })

if (!session?.user) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use method requireSession from utils/requireSession

Comment thread server/api/shop/index.ts
throw createError({ statusCode: 401, statusMessage: 'Unauthorized' })
}

const studentIdRaw = getQuery(event).studentId

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use z.int.safeParse for this, not super necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants