diff --git a/src/datasources/db/v1/entities/row.entity.ts b/src/datasources/db/v1/entities/row.entity.ts index 072ec04e12..c76cf7a951 100644 --- a/src/datasources/db/v1/entities/row.entity.ts +++ b/src/datasources/db/v1/entities/row.entity.ts @@ -9,6 +9,6 @@ export type Row = z.infer; */ export const RowSchema = z.object({ id: z.number().int(), - created_at: z.coerce.date(), + created_at: z.coerce.date(), // @TODO when migrated all the entities to TypeOrm Remove `.coerce` updated_at: z.coerce.date(), }); diff --git a/src/datasources/notifications/entities/notification-devices.entity.db.ts b/src/datasources/notifications/entities/notification-devices.entity.db.ts index ab1c3face0..ec4ccc8548 100644 --- a/src/datasources/notifications/entities/notification-devices.entity.db.ts +++ b/src/datasources/notifications/entities/notification-devices.entity.db.ts @@ -1,4 +1,5 @@ import { NotificationSubscription } from '@/datasources/notifications/entities/notification-subscription.entity.db'; +import { RowSchema } from '@/datasources/db/v1/entities/row.entity'; import { DeviceType } from '@/domain/notifications/v2/entities/device-type.entity'; import { UuidSchema } from '@/validation/entities/schemas/uuid.schema'; import type { UUID } from 'crypto'; @@ -11,13 +12,10 @@ import { } from 'typeorm'; import { z } from 'zod'; -export const NotificationDeviceSchema = z.object({ - id: z.number(), +export const NotificationDeviceSchema = RowSchema.extend({ device_type: z.nativeEnum(DeviceType), device_uuid: UuidSchema, cloud_messaging_token: z.string(), - created_at: z.date(), - updated_at: z.date(), }); @Entity('push_notification_devices') diff --git a/src/routes/notifications/v1/notifications.controller.spec.ts b/src/routes/notifications/v1/notifications.controller.spec.ts index e2bc517530..3bc721309c 100644 --- a/src/routes/notifications/v1/notifications.controller.spec.ts +++ b/src/routes/notifications/v1/notifications.controller.spec.ts @@ -118,7 +118,7 @@ describe('Notifications Controller (Unit)', () => { Promise.reject(`No matching rule for url: ${url}`); describe('POST /register/notifications', () => { - it.each([5, 20, 100])( + it.each([5, 20])( 'Success for a subscription with %i safe registrations', async (safeRegistrationLength: number) => { const registerDeviceDto = await buildInputDto(safeRegistrationLength);