watcher:bug

This commit is contained in:
2026-03-08 14:53:07 +03:30
parent 864546272c
commit 2babd20419
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -183,7 +183,7 @@ export class UsersService {
/*******************************/
async getWatchers(business: Business) {
return this.userRepository.find({ business: { id: business.id }, role: { name: RoleEnum.WATCHER } })
return this.userRepository.find({ business: { id: business.id }, role: { name: RoleEnum.WATCHER }, deletedAt: null })
}
/*******************************/
@@ -194,6 +194,7 @@ export class UsersService {
/*******************************/
async deleteWatcherById(id: string, business: Business) {
const watcher = await this.userRepository.findOne({ id, business: { id: business.id } })
if (!watcher) {
throw new BadRequestException("Not found")
}
+1 -1
View File
@@ -42,7 +42,7 @@ export class UsersController {
@ApiOperation({ summary: "delete Watcher by id" })
@Delete("watcher/:id")
deleteWatcher(@Param("id") watcherId: string, @BusinessDec() business: Business) {
return this.usersService.getWatcherById(watcherId, business);
return this.usersService.deleteWatcherById(watcherId, business);
}
}