-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notification migration #2063
base: main
Are you sure you want to change the base?
Notification migration #2063
Conversation
cf83376
to
f53fa31
Compare
19e7c42
to
a28bfab
Compare
src/datasources/notifications/entities/__tests__/notification-devices.entity.db.builder.ts
Show resolved
Hide resolved
src/datasources/notifications/entities/__tests__/notification-subscription.entity.db.builder.ts
Show resolved
Hide resolved
src/datasources/notifications/entities/__tests__/notification-subscription.entity.db.builder.ts
Outdated
Show resolved
Hide resolved
src/datasources/notifications/entities/__tests__/notification-subscription.entity.db.builder.ts
Show resolved
Hide resolved
src/datasources/notifications/entities/notification-devices.entity.db.ts
Outdated
Show resolved
Hide resolved
import { z } from 'zod'; | ||
|
||
export const UpsertSubscriptionsDtoSafeSchema = z.object({ | ||
chainId: z.string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chainId: z.string(), | |
chainId: NumericStringSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of my comments can be tackled in a follow up as they are validation focused. I would suggest we add schema tests for those implemented here as well.
src/datasources/notifications/entities/__tests__/notification-devices.entity.db.builder.ts
Show resolved
Hide resolved
src/datasources/notifications/entities/__tests__/notification-subscription.entity.db.builder.ts
Show resolved
Hide resolved
src/datasources/notifications/entities/notification-devices.entity.db.ts
Outdated
Show resolved
Hide resolved
src/datasources/notifications/entities/notification-subscription.entity.db.ts
Outdated
Show resolved
Hide resolved
src/datasources/notifications/entities/notification-devices.entity.db.ts
Outdated
Show resolved
Hide resolved
src/domain/notifications/v2/notifications.repository.integration.spec.ts
Show resolved
Hide resolved
bb16bc1
to
5fc9e0b
Compare
@@ -8,22 +8,22 @@ export class Notification1726752966034 implements MigrationInterface { | |||
`CREATE TABLE "push_notification_devices" ("id" SERIAL NOT NULL, "device_type" character varying(255) NOT NULL, "device_uuid" uuid NOT NULL, "cloud_messaging_token" character varying(255) NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "device_uuid" UNIQUE ("device_uuid"), CONSTRAINT "PK_e387f5cc5b4f66d63804d596c64" PRIMARY KEY ("id"))`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about formatting these queries to make them multiline? I think it might improve readability and make reviews easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree! However, I suggest creating a separate PR to enable automatic formatting(using tools like prettier) for these cases. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense, thanks!
src/domain/notifications/v2/test.notification.repository.interface.ts
Outdated
Show resolved
Hide resolved
const safeV2: { | ||
authPayload: AuthPayload; | ||
upsertSubscriptionsDto: UpsertSubscriptionsDto & { | ||
safes: Array<UpsertSubscriptionsSafesDto>; | ||
signature: `0x${string}`; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we extract this to a type, instead of typing it inline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree. Since we usually define types inline, I did it this way to keep it consistent. Do you think we should consider creating an external type for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to extract this type from the controller using utility types, therefore keeping the controller as the SSOT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, I find heavy use of utility types makes the code extremely hard to read. However, I’d be happy to make the change if you could provide a code snippet as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion here, but I'd prefer to use utility types so we can have a SSOT as Aaron suggests 🙂 Feel free to keep the current implementation if you prefer.
src/routes/notifications/v1/entities/__tests__/safe-registration.builder.ts
Show resolved
Hide resolved
src/routes/notifications/v1/entities/__tests__/register-device.dto.builder.ts
Show resolved
Hide resolved
15978c2
to
73984fe
Compare
…rated to TypeORM.
…tests after enabling V2
…tionNotificationTypes
037b635
to
e6128ff
Compare
Summary
Add compatibility between Notification V1 and Notification V2. Integrate Notification V2 methods into Notification V1 to begin populating the database in advance of the data migration, ensuring clients can transition to V2 seamlessly without any changes on their end.
Changes