-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * feat: subscribe to topic on client and send to topic on server * feat: fcm registration token table * feat: send registration token to backend every time and store it in database * deps: pnpm v9.15.1 * feat: send notifications when creating assignments in scheduler * fix: dont initialize app in firebaseMessagingBackgroundHandler * fix: initialize firebase admin app only if required * fix: dont send firebase messages on CI * fix: adjust messages * fix: only do firebase stuff if supported platform * fix: stuff from self-code-review * fix: remove unused import
- Loading branch information
1 parent
1a3df99
commit 9ec4825
Showing
44 changed files
with
1,946 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"private": true, | ||
"license": "UNLICENSED", | ||
"engines": { | ||
"pnpm": "~9" | ||
"pnpm": "9.15.1" | ||
}, | ||
"scripts": { | ||
"build": "nest build", | ||
|
@@ -34,6 +34,7 @@ | |
"@nestjs/serve-static": "4.0.2", | ||
"bcrypt": "5.1.1", | ||
"drizzle-orm": "0.37.0", | ||
"firebase-admin": "^13.0.1", | ||
"pg": "8.11.5", | ||
"postgres": "3.4.4", | ||
"reflect-metadata": "0.2.0", | ||
|
@@ -92,6 +93,5 @@ | |
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
}, | ||
"packageManager": "[email protected]+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { inArray } from 'drizzle-orm'; | ||
import { db } from '..'; | ||
import { userFcmRegistrationTokenMappingTable } from '../schema'; | ||
|
||
export async function dbGetFCMRegistrationTokensByUserIds(userIds: number[]) { | ||
const result = await db | ||
.select({ | ||
token: userFcmRegistrationTokenMappingTable.fcmRegistrationToken, | ||
}) | ||
.from(userFcmRegistrationTokenMappingTable) | ||
.where(inArray(userFcmRegistrationTokenMappingTable.userId, userIds)); | ||
return result.map((row) => row.token); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TABLE IF NOT EXISTS "user_fcm_registration_token_mapping" ( | ||
"user_id" integer NOT NULL, | ||
"fcm_registration_token" text NOT NULL, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
"updated_at" timestamp DEFAULT now() NOT NULL, | ||
CONSTRAINT "user_fcm_registration_token_mapping_user_id_fcm_registration_token_pk" PRIMARY KEY("user_id","fcm_registration_token") | ||
); | ||
--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "user_fcm_registration_token_mapping" ADD CONSTRAINT "user_fcm_registration_token_mapping_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
Oops, something went wrong.