notification
This commit is contained in:
@@ -7,6 +7,7 @@ import { SalonsModule } from '../salons/salons.module';
|
||||
import { ServiceSkill } from '../services/entities/service-skill.entity';
|
||||
import { Service } from '../services/entities/service.entity';
|
||||
import { ServicesModule } from '../services/services.module';
|
||||
import { NotificationsModule } from '../notifications/notifications.module';
|
||||
import { SmsSettingsModule } from '../sms-settings/sms-settings.module';
|
||||
import { StylistsModule } from '../stylists/stylists.module';
|
||||
import { ReserveItem } from './entities/reserve-item.entity';
|
||||
@@ -31,6 +32,7 @@ import { ReservesService } from './reserves.service';
|
||||
AuthorizationModule,
|
||||
AuthGuardsModule,
|
||||
SmsSettingsModule,
|
||||
NotificationsModule,
|
||||
],
|
||||
controllers: [ReservesController],
|
||||
providers: [ReservesService],
|
||||
|
||||
@@ -22,6 +22,7 @@ import { UpdateReserveDto } from './dto/update-reserve.dto';
|
||||
import { ReserveItem } from './entities/reserve-item.entity';
|
||||
import { ReserveStatusHistory } from './entities/reserve-status-history.entity';
|
||||
import { Reserve } from './entities/reserve.entity';
|
||||
import { SalonNotificationsService } from '../notifications/salon-notifications.service';
|
||||
import { ReserveSmsService } from '../sms-settings/reserve-sms.service';
|
||||
import { ReserveStatus } from './enums/reserve-status.enum';
|
||||
|
||||
@@ -44,6 +45,7 @@ export class ReservesService {
|
||||
private readonly authorizationService: AuthorizationService,
|
||||
private readonly reservePolicy: ReservePolicy,
|
||||
private readonly reserveSmsService: ReserveSmsService,
|
||||
private readonly salonNotificationsService: SalonNotificationsService,
|
||||
private readonly servicesService: ServicesService,
|
||||
) {}
|
||||
|
||||
@@ -103,6 +105,7 @@ export class ReservesService {
|
||||
await this.customersService.linkToSalon(saved.salonId, saved.customerId);
|
||||
await this.logStatusChange(saved.id, null, saved.status, user.id);
|
||||
await this.reserveSmsService.sendReserveCreated(saved.id);
|
||||
await this.salonNotificationsService.notifyReserveCreated(saved.id);
|
||||
return this.findOne(saved.id, user);
|
||||
}
|
||||
|
||||
@@ -262,6 +265,7 @@ export class ReservesService {
|
||||
previousStatus !== ReserveStatus.CANCELLED
|
||||
) {
|
||||
await this.reserveSmsService.sendReserveCancelled(reserve.id);
|
||||
await this.salonNotificationsService.notifyReserveCancelled(reserve.id);
|
||||
}
|
||||
|
||||
return this.findOne(id, user);
|
||||
@@ -314,6 +318,7 @@ export class ReservesService {
|
||||
reserve.status = ReserveStatus.CONFIRMED;
|
||||
await this.reservesRepository.save(reserve);
|
||||
await this.reserveSmsService.sendReserveConfirmed(reserve.id);
|
||||
await this.salonNotificationsService.notifyReserveConfirmed(reserve.id);
|
||||
}
|
||||
|
||||
private async logStatusChange(
|
||||
|
||||
Reference in New Issue
Block a user