Skip to content

Commit

Permalink
Fix _formatted field in search on select
Browse files Browse the repository at this point in the history
  • Loading branch information
cregourd committed Mar 4, 2024
1 parent 55a6506 commit 04142de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 0 additions & 2 deletions packages/next-admin/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ export const nextAdminRouter = async (
}
}

console.log("createeeeeee");

// Create
// @ts-expect-error
const createdData = await prisma[resource].create({
Expand Down
8 changes: 6 additions & 2 deletions packages/next-admin/src/utils/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ export const fillRelationInSchema =

const editOptions = options?.model?.[modelNameRelation]?.edit as EditOptions<typeof modelNameRelation>;
const select = selectPayloadForModel(modelNameRelation, editOptions, "object");

if (nonCheckedToString) {
select._formatted = true;
}
const data = (
prismaExtended[uncapitalize(modelNameRelation)]
// @ts-expect-error
.findMany({
select
select: {
...select,
}
}) ?? Promise.resolve([])
).then((data: any[]) => {
const result: typeof data = [];
Expand Down

0 comments on commit 04142de

Please sign in to comment.