mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
added enums to replace constants
This commit is contained in:
@ -17,10 +17,11 @@ import {
|
||||
} from '../dtos/user-notification.dto';
|
||||
|
||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||
|
||||
@ApiTags('User Notification Module')
|
||||
@Controller({
|
||||
version: '1',
|
||||
version: EnableDisableStatusEnum.ENABLED,
|
||||
path: 'user-notification/subscription',
|
||||
})
|
||||
export class UserNotificationController {
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
UserNotificationUpdateDto,
|
||||
} from '../dtos/user-notification.dto';
|
||||
import { UserNotificationRepository } from '@app/common/modules/user/repositories';
|
||||
import { CommonErrorCodes } from '@app/common/constants/error-codes.enum';
|
||||
|
||||
@Injectable()
|
||||
export class UserNotificationService {
|
||||
@ -20,7 +21,7 @@ export class UserNotificationService {
|
||||
subscriptionUuid: userNotificationAddDto.subscriptionUuid,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.code === '23505') {
|
||||
if (error.code === CommonErrorCodes.DUPLICATE_ENTITY) {
|
||||
throw new HttpException(
|
||||
'This User already has this subscription uuid',
|
||||
HttpStatus.BAD_REQUEST,
|
||||
|
Reference in New Issue
Block a user