Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nestjs Prisma and Mongo issue on update #28

Open
DemDio opened this issue Nov 27, 2022 · 2 comments · May be fixed by #34
Open

Nestjs Prisma and Mongo issue on update #28

DemDio opened this issue Nov 27, 2022 · 2 comments · May be fixed by #34

Comments

@DemDio
Copy link

DemDio commented Nov 27, 2022

Hello,

I am facing the following issue, when i am trying to perform update on entities.
Mongo Prisma Schema
model Post { id String @id @default(auto()) @map("_id") @db.ObjectId title String description String? ... }
I am getting the following error
Invalid prisma.post.update()` invocation:

{
where: {
id: '638354a88b6732cd4e897dbf'
},
data: {
id: '638354a88b6732cd4e897dbf',
~~
title: 'New post',
description: 'string',
...
Unknown arg id in data.id for type PostUncheckedUpdateInput. Available args:

type PostUncheckedUpdateInput {
title?: String | StringFieldUpdateOperationsInput
description?: String | NullableStringFieldUpdateOperationsInput | Null
...
}
`
Anyone knows how i can solve this ? Does adminjs support removing attributes from requests ?

@maglimedia
Copy link

I have the same issue

@DemDio
Copy link
Author

DemDio commented Jan 12, 2023

Was able to tackle it with

  options: {
    actions: {
      edit: {
        before: async (request) => {
          if (request.method === 'post') {
            delete request.payload.id;
          }
          return request;
        },
      },
    }}....

On each request ,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants