Download src/queries.js from designfailure/specforge-wasp: direct link, hf CLI and curl.
- Browser
- Download file 693 Bytes
-
https://huggingface.co/datasets/designfailure/specforge-wasp/resolve/main/src/queries.js
- Command line
-
hf download hf://datasets/designfailure/specforge-wasp/src/queries.js
-
curl -L -o queries.js https://huggingface.co/datasets/designfailure/specforge-wasp/resolve/main/src/queries.js
693 Bytes
| import { HttpError } from "wasp/server"; | |
| export const getSpecs = async (_args, context) => { | |
| if (!context.user) { | |
| throw new HttpError(401); | |
| } | |
| return context.entities.Spec.findMany({ | |
| where: { userId: context.user.id }, | |
| orderBy: { updatedAt: "desc" }, | |
| include: { sections: { orderBy: { order: "asc" } } }, | |
| }); | |
| }; | |
| export const getSpec = async ({ id }, context) => { | |
| if (!context.user) { | |
| throw new HttpError(401); | |
| } | |
| const spec = await context.entities.Spec.findFirst({ | |
| where: { id, userId: context.user.id }, | |
| include: { sections: { orderBy: { order: "asc" } } }, | |
| }); | |
| if (!spec) { | |
| throw new HttpError(404, "Spec not found"); | |
| } | |
| return spec; | |
| }; |