© 2026 Hedgehog Software, LLC
model Goal { id String @id @default(cuid()) title String description String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt clientId String client Client @relation(fields: [clientId], references: [id], onDelete: Cascade) objectives Objective[] appointmentGoals AppointmentGoal[] @@map("goals") }
const getAllGoalsByClientSchema = z.object({ selectedClientId: z.string(), }) type GetAllGoalsByClientInput = z.infer<typeof getAllGoalsByClientSchema> export const getAllGoalsByClient: GetAllGoalsByClient<GetAllGoalsByClientInput, Goal[]> = async (rawArgs, context) => { if (!context.user) { throw new HttpError(401, 'Only authenticated users are allowed to perform this operation') } const { selectedClientId } = ensureArgsSchemaOrThrowHttpError(getAllGoalsByClientSchema, rawArgs) return context.entities.Goal.findMany({ where: { clientId: selectedClientId }, include: { objectives: true }, }) }
app.query("getAllGoalsByClient", { fn: {import: "getAllGoalsByClient", from: "@src/portal/operations/goal" }, entities: ["Goal", "Objective"], });
Join the Discord to ask follow-up questions and connect with the community
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.
4,603 Members