Skip to content

Commit

Permalink
logout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Berat Genç committed Jan 21, 2024
1 parent 6c88d7c commit 855d30b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export class AuthController {
throw new UnauthorizedException('Invalid credentials')
}

@Get()
async logout(@Req() req: Request, @Res() res: Response) {
req.session.destroy(err => {
@Post('/logout')
async logout(@Req() request: Request, @Res() res: Response) {
request.session.destroy(() => {
res
.clearCookie('sessionCookie', { domain: 'auth-test.site' })
.sendStatus(200)
.clearCookie('connect.sid', { domain: 'taskermanager.online' })
.send(200)
})
}
}
2 changes: 1 addition & 1 deletion src/employee/employee.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class EmployeeService {
return this.databaseService.employee.findUnique({
where: { id },
include: {
tasks: true,
tasks: { include: { employee: true } },
projects: true,
teams: {
include: {
Expand Down
8 changes: 4 additions & 4 deletions src/project/project.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class ProjectController {
return this.projectService.remove(+id)
}

// @Delete('/remove-all')
// removeAll() {
// return this.projectService.removeAll()
// }
@Delete('/remove-all')
removeAll() {
return this.projectService.removeAll()
}
}
2 changes: 1 addition & 1 deletion src/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export class ProjectService {
}

removeAll() {
return this.databaseService.project.deleteMany()
return this.databaseService.project.deleteMany({})
}
}

0 comments on commit 855d30b

Please sign in to comment.