Last active
October 6, 2021 10:02
-
-
Save albertorestifo/6d35d4e5fd492987091ae76557b2c64a to your computer and use it in GitHub Desktop.
Example idempotent creation with Prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Suppose createData includes all the other required fields, | |
// and idempotencyKey is received as part of the request payload. | |
await this.prisma.ctrPayrollCompensation.upsert({ | |
where: { idempotencyKey }, | |
create: { ...createData, idepotencyKey }, | |
update: {}, // Update nothing | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment