sms count endpoint
This commit is contained in:
@@ -5,6 +5,9 @@ import { NotificationPreferenceService } from './notification-preference.service
|
||||
import { NotificationQueueService } from './notification-queue.service';
|
||||
import { NotificationsGateway } from '../notifications.gateway';
|
||||
import { NotifChannelEnum, NotifRequest, NotifTitleEnum } from '../interfaces/notification.interface';
|
||||
import { SmsLog } from '../entities/smsLogs.entity';
|
||||
import { SmsLogRepository } from '../repositories/sms-log.repository';
|
||||
import { PaginatedResult } from '../../../common/interfaces/pagination.interface';
|
||||
|
||||
@Injectable()
|
||||
export class NotificationService {
|
||||
@@ -15,6 +18,7 @@ export class NotificationService {
|
||||
private readonly preferenceService: NotificationPreferenceService,
|
||||
private readonly queueService: NotificationQueueService,
|
||||
private readonly notificationGateway: NotificationsGateway,
|
||||
private readonly smsLogRepository: SmsLogRepository,
|
||||
) { }
|
||||
|
||||
async sendNotification(params: NotifRequest): Promise<Notification[]> {
|
||||
@@ -263,4 +267,11 @@ export class NotificationService {
|
||||
};
|
||||
return this.em.nativeUpdate(Notification, where, { seenAt: new Date() });
|
||||
}
|
||||
|
||||
async getSmsCountByRestaurant(
|
||||
page: number = 1,
|
||||
limit: number = 10,
|
||||
): Promise<PaginatedResult<{ restaurantId: string; restaurantName: string; smsCount: number }>> {
|
||||
return this.smsLogRepository.getSmsCountByRestaurant(page, limit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user