refactor: update isolation level
This commit is contained in:
parent
784c245557
commit
73265c8965
2 changed files with 46 additions and 40 deletions
|
|
@ -63,7 +63,8 @@ export class ProductGroup extends Controller {
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
async createProductGroup(@Request() req: RequestWithUser, @Body() body: ProductGroupCreate) {
|
async createProductGroup(@Request() req: RequestWithUser, @Body() body: ProductGroupCreate) {
|
||||||
const record = await prisma.$transaction(async (tx) => {
|
const record = await prisma.$transaction(
|
||||||
|
async (tx) => {
|
||||||
const last = await tx.runningNo.upsert({
|
const last = await tx.runningNo.upsert({
|
||||||
where: {
|
where: {
|
||||||
key: `PRODGRP`,
|
key: `PRODGRP`,
|
||||||
|
|
@ -83,7 +84,9 @@ export class ProductGroup extends Controller {
|
||||||
updateBy: req.user.name,
|
updateBy: req.user.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
{ isolationLevel: Prisma.TransactionIsolationLevel.Serializable },
|
||||||
|
);
|
||||||
|
|
||||||
this.setStatus(HttpStatus.CREATED);
|
this.setStatus(HttpStatus.CREATED);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ export class ProductType extends Controller {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await prisma.$transaction(async (tx) => {
|
const record = await prisma.$transaction(
|
||||||
|
async (tx) => {
|
||||||
const last = await tx.runningNo.upsert({
|
const last = await tx.runningNo.upsert({
|
||||||
where: {
|
where: {
|
||||||
key: `PRODTYP_T${productGroup.code}`,
|
key: `PRODTYP_T${productGroup.code}`,
|
||||||
|
|
@ -97,7 +98,9 @@ export class ProductType extends Controller {
|
||||||
updateBy: req.user.name,
|
updateBy: req.user.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
{ isolationLevel: Prisma.TransactionIsolationLevel.Serializable },
|
||||||
|
);
|
||||||
|
|
||||||
this.setStatus(HttpStatus.CREATED);
|
this.setStatus(HttpStatus.CREATED);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue