dtschannen
WWasp-lang
•Created by dtschannen on 8/7/2024 in #đŸ™‹questions
Query an entity throws "unexpected token: entities" Error
Hi everyone. I try to query an entity as follow:
Wasp File:
query findQRCodeById {
fn: import { findQRCodeById } from "@src/qr-generator/findQRCodeById"
entities: [QRCode]
}
And my findQRCodeById Typescript file:
import { QRCode } from 'wasp/entities'
import { type FindQRCodeById } from 'wasp/server/operations'
type GetQRCodeByIdArgs = {
id: string
}
export const getQRCodeById: FindQRCodeById<GetQRCodeByIdArgs, QRCode | null> = async (args, context) => {
return context.entities.QRCode.findUnique({
where: { id: args.id },
})
}
It gives me this Error:
4 errors found:
- /home/dtschannen/projects/qrftw/app/main.wasp @ 204:3-10
Parse error:
Unexpected token: entities
Expected one of the following tokens instead: '}',','
203 | fn: import { findQRCodeById } from "@src/qr-generator/findQRCodeById"
204 | entities: [QRCode]
205 | }
- /home/dtschannen/projects/qrftw/app/main.wasp @ 204:11
Parse error:
Unexpected token: :
Expected one of the following tokens instead: <identifier>
203 | fn: import { findQRCodeById } from "@src/qr-generator/findQRCodeById"
204 | entities: [QRCode]
205 | }
- /home/dtschannen/projects/qrftw/app/main.wasp @ 204:13
Parse error:
Unexpected token: [
Expected one of the following tokens instead: <identifier>,<eof>
203 | fn: import { findQRCodeById } from "@src/qr-generator/findQRCodeById"
204 | entities: [QRCode]
205 | }
- /home/dtschannen/projects/qrftw/app/main.wasp @ 204:14-19
Parse error:
Unexpected token: QRCode
Expected one of the following tokens instead: <eof>
203 | fn: import { findQRCodeById } from "@src/qr-generator/findQRCodeById"
204 | entities: [QRCode]
205 | }
12 replies