fix: delete branch from user wrong body

This commit is contained in:
Methapon2001 2024-04-04 15:50:30 +07:00
parent d3e535374c
commit 79f844adee
2 changed files with 27 additions and 2 deletions

25
compose.yaml Normal file
View file

@ -0,0 +1,25 @@
version: "3.8"
services:
app:
build: .
restart: unless-stopped
ports:
- 3000:3000
environment:
- KC_URL=http://192.168.1.20:8080
- KC_REALM=dev
- KC_SERVICE_ACCOUNT_CLIENT_ID=
- KC_SERVICE_ACCOUNT_SECRET=
- APP_HOST=0.0.0.0
- APP_PORT=3000
- MINIO_HOST=192.168.1.20
- MINIO_PORT=9000
- MINIO_ACCESS_KEY=
- MINIO_SECRET_KEY=
- MINIO_BUCKET=jws-dev
- ELASTICSEARCH_PROTOCOL=http
- ELASTICSEARCH_HOST=192.168.1.20
- ELASTICSEARCH_PORT=9200
- ELASTICSEARCH_INDEX=jws-log-index
- DATABASE_URL=postgresql://postgres:1234@192.168.1.20:5432/dev_1?schema=public

View file

@ -196,9 +196,9 @@ export class UserBranchController extends Controller {
} }
@Delete() @Delete()
async deleteUserBranch(@Path() userId: string, @Body() body: BranchUserBody) { async deleteUserBranch(@Path() userId: string, @Body() body: UserBranchBody) {
await prisma.$transaction( await prisma.$transaction(
body.user.map((v) => prisma.branchUser.deleteMany({ where: { userId, branchId: v } })), body.branch.map((v) => prisma.branchUser.deleteMany({ where: { userId, branchId: v } })),
); );
} }