watcher:bug
This commit is contained in:
@@ -183,7 +183,7 @@ export class UsersService {
|
|||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
async getWatchers(business: Business) {
|
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) {
|
async deleteWatcherById(id: string, business: Business) {
|
||||||
const watcher = await this.userRepository.findOne({ id, business: { id: business.id } })
|
const watcher = await this.userRepository.findOne({ id, business: { id: business.id } })
|
||||||
|
|
||||||
if (!watcher) {
|
if (!watcher) {
|
||||||
throw new BadRequestException("Not found")
|
throw new BadRequestException("Not found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class UsersController {
|
|||||||
@ApiOperation({ summary: "delete Watcher by id" })
|
@ApiOperation({ summary: "delete Watcher by id" })
|
||||||
@Delete("watcher/:id")
|
@Delete("watcher/:id")
|
||||||
deleteWatcher(@Param("id") watcherId: string, @BusinessDec() business: Business) {
|
deleteWatcher(@Param("id") watcherId: string, @BusinessDec() business: Business) {
|
||||||
return this.usersService.getWatcherById(watcherId, business);
|
return this.usersService.deleteWatcherById(watcherId, business);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user