Add authentication guards and API documentation to admin and restaurant controllers; update restaurant service for soft delete; enhance database seeder with new permissions and roles
This commit is contained in:
@@ -51,7 +51,17 @@ export class RestaurantsService {
|
||||
return restaurant;
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return `This action removes a #${id} restaurant`;
|
||||
async remove(id: string) {
|
||||
// Soft delete the restaurant by setting isActive to false
|
||||
const restaurant = await this.restRepository.findOne({ id });
|
||||
|
||||
if (!restaurant) {
|
||||
throw new NotFoundException(RestMessage.NOT_FOUND);
|
||||
}
|
||||
|
||||
restaurant.isActive = false;
|
||||
await this.em.persistAndFlush(restaurant);
|
||||
|
||||
return restaurant;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user