urania-dev / snapp

Yet Another Url Shortner. A simple excercise to learn Svelte.
https://snapp.li
MIT License
210 stars 11 forks source link

API: order-by parameter creates error 500 #41

Closed gmag11 closed 2 months ago

gmag11 commented 2 months ago

I'm trying to get most used links by API. I can query all snaps with or without parameters successfully. Except when using "order-by" parameter. API responds with error 500 does not matter what value I assign to order-by.

Snapp version: 0.8.4.

Container shows this log:

 ✔ Container snapp  Running                                                                            0.0s
snapp  | PrismaClientValidationError:
snapp  | Invalid `prisma.snapp.findMany()` invocation:
snapp  |
snapp  | {
snapp  |   where: {
snapp  |     AND: [
snapp  |       {
snapp  |         userId: "sw16jle1"
snapp  |       },
snapp  |       {
snapp  |         OR: undefined
snapp  |       }
snapp  |     ]
snapp  |   },
snapp  |   take: 10,
snapp  |   skip: 0,
snapp  |   orderBy: {
snapp  |     hit: true
snapp  |          ~~~~
snapp  |   }
snapp  | }
snapp  |
snapp  | Invalid value for argument `hit`. Expected SortOrder.
snapp  |     at An (/app/node_modules/@prisma/client/runtime/library.js:114:7526)
snapp  |     at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7392)
snapp  |     at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057)
snapp  |     at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741)
snapp  |     at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355)
snapp  |     at async Object.get_snapp [as get] (file:///app/build/server/chunks/database-BbSxuMWw.js:287:18)
snapp  |     at async GET (file:///app/build/server/chunks/_server.ts-C5VKcT-5.js:29:27)
snapp  |     at async render_endpoint (file:///app/build/server/index.js:2519:20)
snapp  |     at async resolve2 (file:///app/build/server/index.js:5001:22)
snapp  |     at async respond (file:///app/build/server/index.js:4896:22) {
snapp  |   clientVersion: '5.18.0'
snapp  | }
urania-dev commented 2 months ago

would you please download 0.8.5 and confirm this is gone? :)

gmag11 commented 2 months ago

I confirm this is solved. I'm now in 0.8.5. Thank you!