delte rest

This commit is contained in:
2026-01-06 10:36:25 +03:30
parent 9df0e224dd
commit 131dc6cbb5
@@ -24,6 +24,9 @@ import { Delivery } from '../../delivery/entities/delivery.entity';
import { PaymentMethod } from '../../payments/entities/payment-method.entity';
import { Pager } from '../../pager/entities/pager.entity';
import { Schedule } from '../entities/schedule.entity';
import { WalletTransaction } from '../../users/entities/wallet-transaction.entity';
import { SmsLog } from '../../notifications/entities/smsLogs.entity';
import { Notification } from '../../notifications/entities/notification.entity';
@Injectable()
export class RestaurantsService {
@@ -257,6 +260,12 @@ export class RestaurantsService {
// Delete notification preferences
await em.nativeDelete(NotificationPreference, { restaurant: id });
// Delete notifications
await em.nativeDelete(Notification, { restaurant: id });
// Delete SMS logs
await em.nativeDelete(SmsLog, { restaurant: id });
// Delete admin roles for this restaurant
await em.nativeDelete(AdminRole, { restaurant: id });
@@ -266,6 +275,9 @@ export class RestaurantsService {
// Delete pagers
await em.nativeDelete(Pager, { restaurant: id });
// Delete wallet transactions
await em.nativeDelete(WalletTransaction, { restaurant: id });
// Finally, delete the restaurant itself
await em.nativeDelete(Restaurant, { id });
});