Мда... Хуже не придумаешь.
This commit is contained in:
2024-10-10 23:52:51 +04:00
parent 64168dc517
commit a4d7bb9cdc
5 changed files with 30 additions and 17 deletions

View File

@@ -21,7 +21,6 @@ import { isSemVer } from "class-validator";
@UseGuards(AuthGuard)
export class FirebaseAdminController {
private readonly oldTopics = new Set(["app-update", "schedule-update"]);
private readonly defaultTopics = new Set(["common"]);
constructor(private readonly firebaseAdminService: FirebaseAdminService) {}
@@ -39,7 +38,7 @@ export class FirebaseAdminController {
).userDto;
await this.firebaseAdminService
.subscribe(updatedUser, this.defaultTopics, true)
.subscribe(updatedUser, new Set(), true)
.then((userDto) =>
this.firebaseAdminService.unsubscribe(userDto, this.oldTopics),
);
@@ -58,11 +57,7 @@ export class FirebaseAdminController {
);
}
await this.firebaseAdminService.updateApp(
userDto,
version,
this.defaultTopics,
);
await this.firebaseAdminService.updateApp(userDto, version);
}
@Post("post-update")
@@ -70,6 +65,9 @@ export class FirebaseAdminController {
@ResultDto(null)
async postUpdate(@Body() postUpdateDto: FcmPostUpdateDto): Promise<void> {
await this.firebaseAdminService.sendByTopic("common", {
android: {
priority: "high",
},
data: {
type: "app-update",
version: postUpdateDto.version,