From 72f843710800922d8b578d5d49563e6d34f5239e Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Tue, 30 Jan 2024 20:07:53 +0100 Subject: [PATCH] Fixes CRUD server import --- .../templates/server/src/crud/_operations.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/waspc/data/Generator/templates/server/src/crud/_operations.ts b/waspc/data/Generator/templates/server/src/crud/_operations.ts index 14f9ddda2..0be751758 100644 --- a/waspc/data/Generator/templates/server/src/crud/_operations.ts +++ b/waspc/data/Generator/templates/server/src/crud/_operations.ts @@ -8,7 +8,7 @@ import type { {=# isAuthEnabled =} import { throwInvalidCredentialsError } from 'wasp/auth/utils' {=/ isAuthEnabled =} -import type { GetAllQuery, GetQuery, CreateAction, UpdateAction, DeleteAction } from "{= crudTypesImportPath =}"; +import type { {= crud.name =} } from "wasp/server/crud"; {=# overrides.GetAll.isDefined =} {=& overrides.GetAll.importStatement =} {=/ overrides.GetAll.isDefined =} @@ -41,7 +41,7 @@ const entities = { {=^ overrides.GetAll.isDefined =} type GetAllInput = {} type GetAllOutput = _WaspEntity[] -const _waspGetAllQuery: GetAllQuery = ((args, context) => { +const _waspGetAllQuery: {= crud.name =}.GetAllQuery = ((args, context) => { {=^ crud.operations.GetAll.isPublic =} throwIfNotAuthenticated(context) {=/ crud.operations.GetAll.isPublic =} @@ -75,7 +75,7 @@ export async function getAllFn(args, context) { {=^ overrides.Get.isDefined =} type GetInput = Prisma.{= crud.entityUpper =}WhereUniqueInput type GetOutput = _WaspEntity | null -const _waspGetQuery: GetQuery = ((args, context) => { +const _waspGetQuery: {= crud.name =}.GetQuery = ((args, context) => { {=^ crud.operations.Get.isPublic =} throwIfNotAuthenticated(context) {=/ crud.operations.Get.isPublic =} @@ -99,7 +99,7 @@ export async function getFn(args, context) { {=^ overrides.Create.isDefined =} type CreateInput = Prisma.{= crud.entityUpper =}CreateInput type CreateOutput = _WaspEntity -const _waspCreateAction: CreateAction = ((args, context) => { +const _waspCreateAction: {= crud.name =}.CreateAction = ((args, context) => { {=^ crud.operations.Create.isPublic =} throwIfNotAuthenticated(context) {=/ crud.operations.Create.isPublic =} @@ -123,7 +123,7 @@ export async function createFn(args, context) { {=^ overrides.Update.isDefined =} type UpdateInput = Prisma.{= crud.entityUpper =}UpdateInput & Prisma.{= crud.entityUpper =}WhereUniqueInput type UpdateOutput = _WaspEntity -const _waspUpdateAction: UpdateAction = ((args, context) => { +const _waspUpdateAction: {= crud.name =}.UpdateAction = ((args, context) => { {=^ crud.operations.Update.isPublic =} throwIfNotAuthenticated(context) {=/ crud.operations.Update.isPublic =} @@ -151,7 +151,7 @@ export async function updateFn(args, context) { {=^ overrides.Delete.isDefined =} type DeleteInput = Prisma.{= crud.entityUpper =}WhereUniqueInput type DeleteOutput = _WaspEntity -const _waspDeleteAction: DeleteAction = ((args, context) => { +const _waspDeleteAction: {= crud.name =}.DeleteAction = ((args, context) => { {=^ crud.operations.Delete.isPublic =} throwIfNotAuthenticated(context) {=/ crud.operations.Delete.isPublic =} @@ -180,4 +180,4 @@ function throwIfNotAuthenticated (context) { {=^ isAuthEnabled =} // Auth is not enabled {=/ isAuthEnabled =} -} +} \ No newline at end of file