Hey guys how everyone its doing? im having a weird...
# orm-help
g
Hey guys how everyone its doing? im having a weird issue with update
Copy code
return await this.alertRepository.update({
      where: {
        id,
      },
      data: {
        ...alertData,
        AlertAction: {
          updateMany: {
            data: AlertAction,
            where: {},
          },
        },
      },
    });
1
h
Kinda hard to know what would be the problem, could you share your model?
g
yep
Copy code
model Alert {
  id            String         @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  title         String
  isActive      Boolean        @default(false)
  description   String
  houseSensorId String         @db.Uuid
  houseSensor   HouseSensor    @relation(fields: [houseSensorId], references: [id])
  notifications Notification[]
  userId        String         @db.Uuid
  user          User           @relation(fields: [userId], references: [id])
  createdAt     DateTime       @default(now()) @db.Timestamptz(3)
  updatedAt     DateTime       @updatedAt @db.Timestamptz(3)
  AlertAction   AlertAction[]

  @@map("alert")
}

model AlertAction {
  id            String          @id @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  description   String?
  action        AlertActionType
  startDateTime DateTime?
  endDateTime   DateTime?
  alert         Alert?          @relation(fields: [alertId], references: [id], onDelete: Cascade)
  alertId       String?         @db.Uuid
  createdAt     DateTime        @default(now()) @map("created_at") @db.Timestamptz(3)
  updatedAt     DateTime        @updatedAt @map("updated_at") @db.Timestamptz(3)

  @@map("alert_action")
}
its the same issue this guy is having
also here is example
d
@guilherme in your example code it works if you change data from an array to an object, data: { action: "always", }
g
The thing it's I want to update many more then one
I know if I pass a object works
d
I think you would do that in the where clause like where: { alertId: { in: [<array of alertIds ] }, }
g
i tried dint work also
n
Thank you for commenting on the GitHub Issue, I see me colleague has triaged this issue, so our client team should be able to debug and fix this error.
g
thanks gonna be waiting for it
🙏 1