Skip to content

Commit

Permalink
fix(server): unable delete cronjob in k8s (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Mar 8, 2023
1 parent b096734 commit 3b015d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions server/src/trigger/trigger.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class TriggerController {
@ApiResponse({ type: ResponseUtil })
@UseGuards(JwtAuthGuard, ApplicationAuthGuard)
@Delete(':id')
async remove(@Param('appid') appid: string, @Param('id') id: string) {
const res = await this.triggerService.remove(appid, id)
async remove(@Param('id') id: string) {
const res = await this.triggerService.remove(id)
return ResponseUtil.ok(res)
}
}
9 changes: 6 additions & 3 deletions server/src/trigger/trigger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ export class TriggerService {
return res
}

async remove(appid: string, id: string) {
const res = await this.prisma.cronTrigger.deleteMany({
where: { appid, id },
async remove(id: string) {
const res = await this.prisma.cronTrigger.update({
where: { id },
data: {
state: TriggerState.Deleted,
},
})
return res
}
Expand Down

0 comments on commit 3b015d3

Please sign in to comment.