feat: working on push notifications journey

This commit is contained in:
Abdalhamid Alhamad
2024-12-24 12:10:49 +03:00
parent c7470302bd
commit 3719498c2f
35 changed files with 1508 additions and 56 deletions

View File

@ -0,0 +1,32 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class CreateNotificationEntityAndEditDevice1734944692999 implements MigrationInterface {
name = 'CreateNotificationEntityAndEditDevice1734944692999';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "notifications"
("id" uuid NOT NULL DEFAULT uuid_generate_v4(),
"title" character varying NOT NULL,
"message" character varying NOT NULL,
"recipient" character varying,
"scope" character varying NOT NULL,
"status" character varying,
"channel" character varying NOT NULL,
"user_id" uuid,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
CONSTRAINT "PK_6a72c3c0f683f6462415e653c3a" PRIMARY KEY ("id"))`,
);
await queryRunner.query(`ALTER TABLE "devices" ADD "fcm_token" character varying`);
await queryRunner.query(
`ALTER TABLE "notifications" ADD CONSTRAINT "FK_9a8a82462cab47c73d25f49261f" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "notifications" DROP CONSTRAINT "FK_9a8a82462cab47c73d25f49261f"`);
await queryRunner.query(`ALTER TABLE "devices" DROP COLUMN "fcm_token"`);
await queryRunner.query(`DROP TABLE "notifications"`);
}
}

View File

@ -16,3 +16,4 @@ export * from './1734262619426-create-junior-registration-token-table';
export * from './1734503895302-create-money-request-entity';
export * from './1734601976591-create-allowance-entities';
export * from './1734861516657-create-gift-entities';
export * from './1734944692999-create-notification-entity-and-edit-device';