@social.dev/server-sdk 0.0.1-alpha.23 → 0.0.1-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -65
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/db.js +1 -1
- package/dist/db.js.map +1 -1
- package/dist/media/media.acl.d.ts +2 -7
- package/dist/media/media.acl.js.map +1 -1
- package/dist/migrations/1757061785934-PushNotificationTokens.d.ts +6 -0
- package/dist/migrations/1757061785934-PushNotificationTokens.js +20 -0
- package/dist/migrations/1757061785934-PushNotificationTokens.js.map +1 -0
- package/dist/notification/dto/delete-push-token.dto.d.ts +3 -0
- package/dist/notification/dto/delete-push-token.dto.js +26 -0
- package/dist/notification/dto/delete-push-token.dto.js.map +1 -0
- package/dist/notification/dto/register-push-token.dto.d.ts +5 -0
- package/dist/notification/dto/register-push-token.dto.js +38 -0
- package/dist/notification/dto/register-push-token.dto.js.map +1 -0
- package/dist/notification/entities/push-token.entity.d.ts +11 -0
- package/dist/notification/entities/push-token.entity.js +60 -0
- package/dist/notification/entities/push-token.entity.js.map +1 -0
- package/dist/notification/enums/push-service.enum.d.ts +6 -0
- package/dist/notification/enums/push-service.enum.js +11 -0
- package/dist/notification/enums/push-service.enum.js.map +1 -0
- package/dist/notification/notification.module.d.ts +2 -0
- package/dist/notification/notification.module.js +25 -0
- package/dist/notification/notification.module.js.map +1 -0
- package/dist/notification/push-notification.controller.d.ts +9 -0
- package/dist/notification/push-notification.controller.js +69 -0
- package/dist/notification/push-notification.controller.js.map +1 -0
- package/dist/notification/push-notification.service.d.ts +10 -0
- package/dist/notification/push-notification.service.js +50 -0
- package/dist/notification/push-notification.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
## Social.Dev server
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Generating migrations
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
|
|
5
|
+
```sh
|
|
6
|
+
typeorm migration:generate -d ./dist/db.js src/migrations --dryrun
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Running migrations
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
# development
|
|
13
|
-
$ npm run start
|
|
11
|
+
From your server implementation
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# production mode
|
|
19
|
-
$ npm run start:prod
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Run tests
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# unit tests
|
|
26
|
-
$ npm run test
|
|
27
|
-
|
|
28
|
-
# e2e tests
|
|
29
|
-
$ npm run test:e2e
|
|
30
|
-
|
|
31
|
-
# test coverage
|
|
32
|
-
$ npm run test:cov
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Deployment
|
|
36
|
-
|
|
37
|
-
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
|
38
|
-
|
|
39
|
-
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
$ npm install -g @nestjs/mau
|
|
43
|
-
$ mau deploy
|
|
13
|
+
```sh
|
|
14
|
+
typeorm migration:run -d node_modules/@social.dev/server-sdk/dist/db.js
|
|
44
15
|
```
|
|
45
|
-
|
|
46
|
-
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
|
47
|
-
|
|
48
|
-
## Resources
|
|
49
|
-
|
|
50
|
-
Check out a few resources that may come in handy when working with NestJS:
|
|
51
|
-
|
|
52
|
-
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
53
|
-
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
54
|
-
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
55
|
-
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
56
|
-
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
57
|
-
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
58
|
-
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
59
|
-
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
60
|
-
|
|
61
|
-
## Support
|
|
62
|
-
|
|
63
|
-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
64
|
-
|
|
65
|
-
## Stay in touch
|
|
66
|
-
|
|
67
|
-
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
|
68
|
-
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
69
|
-
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
70
|
-
|
|
71
|
-
## License
|
|
72
|
-
|
|
73
|
-
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
package/dist/app.module.js
CHANGED
|
@@ -33,6 +33,7 @@ const core_module_1 = require("./core/core.module");
|
|
|
33
33
|
const context_module_1 = require("./core/context/context.module");
|
|
34
34
|
const typeorm_2 = require("typeorm");
|
|
35
35
|
const db_1 = __importDefault(require("./db"));
|
|
36
|
+
const notification_module_1 = require("./notification/notification.module");
|
|
36
37
|
let AppModule = class AppModule {
|
|
37
38
|
contextService;
|
|
38
39
|
dataSource;
|
|
@@ -67,6 +68,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
67
68
|
post_module_1.PostModule,
|
|
68
69
|
media_module_1.MediaModule,
|
|
69
70
|
chat_module_1.ChatModule,
|
|
71
|
+
notification_module_1.NotificationModule,
|
|
70
72
|
],
|
|
71
73
|
providers: [
|
|
72
74
|
{
|
package/dist/app.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,6CAAgD;AAChD,2CAA8C;AAC9C,oDAAgD;AAEhD,6DAAyD;AAEzD,mEAA+D;AAC/D,oDAAgD;AAEhD,uCAA0D;AAC1D,oDAAgD;AAChD,4DAAwD;AACxD,6DAAyD;AACzD,qEAAwE;AACxE,uDAAmD;AACnD,oDAAiD;AACjD,oEAAgE;AAChE,oDAAgD;AAChD,oDAAgD;AAChD,kEAA8D;AAC9D,qCAAqC;AACrC,8CAAmC;
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,6CAAgD;AAChD,2CAA8C;AAC9C,oDAAgD;AAEhD,6DAAyD;AAEzD,mEAA+D;AAC/D,oDAAgD;AAEhD,uCAA0D;AAC1D,oDAAgD;AAChD,4DAAwD;AACxD,6DAAyD;AACzD,qEAAwE;AACxE,uDAAmD;AACnD,oDAAiD;AACjD,oEAAgE;AAChE,oDAAgD;AAChD,oDAAgD;AAChD,kEAA8D;AAC9D,qCAAqC;AACrC,8CAAmC;AACnC,4EAAwE;AAkCjE,IAAM,SAAS,GAAf,MAAM,SAAS;IAED;IACA;IAFnB,YACmB,cAA8B,EAC9B,UAAsB;QADtB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ,YAAY;QAEV,iBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAED,SAAS,CAAC,QAA4B;QACpC,QAAQ,CAAC,KAAK,CAAC,6CAAwB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACxD,QAAQ,CAAC,KAAK,CAAC,gCAAc,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AAfY,8BAAS;oBAAT,SAAS;IAhCrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,8BAAa;YACb,qBAAY,CAAC,OAAO,CAAC;gBACnB,WAAW,EAAE,YAAY;gBACzB,QAAQ,EAAE,IAAI;aACf,CAAC;YACF,uBAAa,CAAC,OAAO,CAAC,YAAe,CAAC,OAAO,CAAC;YAC9C,wBAAU;YACV,wBAAU;YACV,8BAAa;YACb,kCAAe;YACf,wBAAU;YACV,8BAAa;YACb,wBAAU;YACV,0BAAW;YACX,wBAAU;YACV,wCAAkB;SACnB;QACD,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,sBAAe;gBACxB,MAAM,EAAE,CAAC,gBAAS,CAAC;gBACnB,UAAU,EAAE,CAAC,SAAoB,EAAE,EAAE;oBACnC,OAAO,IAAI,mCAA0B,CAAC,SAAS,EAAE;wBAC/C,wBAAwB,EAAE,IAAI;wBAC9B,uBAAuB,EAAE,IAAI;qBAC9B,CAAC,CAAC;gBACL,CAAC;aACF;SACF;KACF,CAAC;qCAGmC,gCAAc;QAClB,oBAAU;GAH9B,SAAS,CAerB"}
|
package/dist/db.js
CHANGED
|
@@ -14,7 +14,7 @@ const opts = {
|
|
|
14
14
|
database: process.env.POSTGRES_DB || 'socialdev',
|
|
15
15
|
entities: [node_path_1.default.join(__dirname, '**/*.entity.js')],
|
|
16
16
|
migrationsTableName: 'social_dev_migrations',
|
|
17
|
-
migrations: ['
|
|
17
|
+
migrations: [node_path_1.default.join(__dirname, 'migrations/*.js')],
|
|
18
18
|
migrationsRun: true,
|
|
19
19
|
synchronize: process.env.SOCIAL_DEV_DEVMODE === 'true',
|
|
20
20
|
};
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":";;;;;AAAA,qCAAwD;AACxD,0DAA6B;AAE7B,MAAM,IAAI,GAAsB;IAC9B,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,WAAW;IAC9C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,IAAI,IAAI;IACvD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,MAAM;IAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM;IACjD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;IAChD,QAAQ,EAAE,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAClD,mBAAmB,EAAE,uBAAuB;IAC5C,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":";;;;;AAAA,qCAAwD;AACxD,0DAA6B;AAE7B,MAAM,IAAI,GAAsB;IAC9B,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,WAAW;IAC9C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,IAAI,IAAI;IACvD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,MAAM;IAC7C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM;IACjD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;IAChD,QAAQ,EAAE,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAClD,mBAAmB,EAAE,uBAAuB;IAC5C,UAAU,EAAE,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACrD,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,MAAM;CACvD,CAAC;AAEF,kBAAe,IAAI,oBAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
getAbility: any;
|
|
4
|
-
}) => any) | (({ can, user }: {
|
|
5
|
-
can: any;
|
|
6
|
-
user: any;
|
|
7
|
-
}) => any))[];
|
|
1
|
+
import { RuleCallback } from '~/core/acl/acl.factory';
|
|
2
|
+
declare const MediaAcl: RuleCallback[];
|
|
8
3
|
export default MediaAcl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.acl.js","sourceRoot":"","sources":["../../src/media/media.acl.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"media.acl.js","sourceRoot":"","sources":["../../src/media/media.acl.ts"],"names":[],"mappings":";;AAAA,yDAA8D;AAC9D,0DAAgD;AAEhD,MAAM,QAAQ,GAAmB;IAE/B,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,CACtB,GAAG,CAAC,oBAAM,CAAC,IAAI,EAAE,oBAAK,EAAE,CAAC,KAAY,EAAE,EAAE;QACvC,OAAO,UAAU,EAAE,CAAC,GAAG,CAAC,oBAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC;IAEJ,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAChB,GAAG,CAAC,oBAAM,CAAC,IAAI,EAAE,oBAAK,EAAE,CAAC,KAAY,EAAE,EAAE;QACvC,OAAO,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;IACrC,CAAC,CAAC;CACL,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushNotificationTokens1757061785934 = void 0;
|
|
4
|
+
class PushNotificationTokens1757061785934 {
|
|
5
|
+
name = 'PushNotificationTokens1757061785934';
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TYPE "public"."push_notification_token_service_enum" AS ENUM('EXPO', 'FCM', 'APNS')`);
|
|
8
|
+
await queryRunner.query(`CREATE TABLE "push_notification_token" ("service" "public"."push_notification_token_service_enum" NOT NULL, "token" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "networkId" integer NOT NULL, "userId" integer NOT NULL, CONSTRAINT "PK_0ea253e8437482d1858c6bdc4d0" PRIMARY KEY ("token"))`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE "push_notification_token" ADD CONSTRAINT "FK_93311d0f1b246e7d6aa7a35623f" FOREIGN KEY ("networkId") REFERENCES "network"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
10
|
+
await queryRunner.query(`ALTER TABLE "push_notification_token" ADD CONSTRAINT "FK_6ff0b307da861bb462b7f9843ce" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
11
|
+
}
|
|
12
|
+
async down(queryRunner) {
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "push_notification_token" DROP CONSTRAINT "FK_6ff0b307da861bb462b7f9843ce"`);
|
|
14
|
+
await queryRunner.query(`ALTER TABLE "push_notification_token" DROP CONSTRAINT "FK_93311d0f1b246e7d6aa7a35623f"`);
|
|
15
|
+
await queryRunner.query(`DROP TABLE "push_notification_token"`);
|
|
16
|
+
await queryRunner.query(`DROP TYPE "public"."push_notification_token_service_enum"`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.PushNotificationTokens1757061785934 = PushNotificationTokens1757061785934;
|
|
20
|
+
//# sourceMappingURL=1757061785934-PushNotificationTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1757061785934-PushNotificationTokens.js","sourceRoot":"","sources":["../../src/migrations/1757061785934-PushNotificationTokens.ts"],"names":[],"mappings":";;;AAEA,MAAa,mCAAmC;IAC5C,IAAI,GAAG,qCAAqC,CAAA;IAErC,KAAK,CAAC,EAAE,CAAC,WAAwB;QACpC,MAAM,WAAW,CAAC,KAAK,CAAC,4FAA4F,CAAC,CAAC;QACtH,MAAM,WAAW,CAAC,KAAK,CAAC,yWAAyW,CAAC,CAAC;QACnY,MAAM,WAAW,CAAC,KAAK,CAAC,kLAAkL,CAAC,CAAC;QAC5M,MAAM,WAAW,CAAC,KAAK,CAAC,4KAA4K,CAAC,CAAC;IAC1M,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,KAAK,CAAC,wFAAwF,CAAC,CAAC;QAClH,MAAM,WAAW,CAAC,KAAK,CAAC,wFAAwF,CAAC,CAAC;QAClH,MAAM,WAAW,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAChE,MAAM,WAAW,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;IACzF,CAAC;CAEJ;AAjBD,kFAiBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeletePushNotificationTokenDto = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
class DeletePushNotificationTokenDto {
|
|
16
|
+
token;
|
|
17
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
18
|
+
return { token: { required: true, type: () => String } };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.DeletePushNotificationTokenDto = DeletePushNotificationTokenDto;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, swagger_1.ApiProperty)({ description: 'Device token' }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], DeletePushNotificationTokenDto.prototype, "token", void 0);
|
|
26
|
+
//# sourceMappingURL=delete-push-token.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-push-token.dto.js","sourceRoot":"","sources":["../../../src/notification/dto/delete-push-token.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAE9C,MAAa,8BAA8B;IAEzC,KAAK,CAAS;;;;CACf;AAHD,wEAGC;AADC;IADC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;;6DAC/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RegisterPushNotificationTokenDto = void 0;
|
|
16
|
+
const openapi = require("@nestjs/swagger");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const push_service_enum_1 = __importDefault(require("../enums/push-service.enum"));
|
|
19
|
+
class RegisterPushNotificationTokenDto {
|
|
20
|
+
service;
|
|
21
|
+
token;
|
|
22
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
23
|
+
return { service: { required: true, enum: require("../enums/push-service.enum").PushService }, token: { required: true, type: () => String } };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RegisterPushNotificationTokenDto = RegisterPushNotificationTokenDto;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiProperty)({
|
|
29
|
+
description: 'Service the token is relevant for. ie. Expo, APNS, FCM',
|
|
30
|
+
enum: push_service_enum_1.default,
|
|
31
|
+
}),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], RegisterPushNotificationTokenDto.prototype, "service", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, swagger_1.ApiProperty)({ description: 'Device token' }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], RegisterPushNotificationTokenDto.prototype, "token", void 0);
|
|
38
|
+
//# sourceMappingURL=register-push-token.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-push-token.dto.js","sourceRoot":"","sources":["../../../src/notification/dto/register-push-token.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,mFAAqD;AAErD,MAAa,gCAAgC;IAK3C,OAAO,CAAc;IAGrB,KAAK,CAAS;;;;CACf;AATD,4EASC;AAJC;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,wDAAwD;QACrE,IAAI,EAAE,2BAAW;KAClB,CAAC;;iEACmB;AAGrB;IADC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;;+DAC/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Network } from '~/network/entities/network.entity';
|
|
2
|
+
import { User } from '~/user/entities/user.entity';
|
|
3
|
+
import PushService from '../enums/push-service.enum';
|
|
4
|
+
export declare class PushNotificationToken {
|
|
5
|
+
network: Network;
|
|
6
|
+
user: User;
|
|
7
|
+
service: PushService;
|
|
8
|
+
token: string;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PushNotificationToken = void 0;
|
|
16
|
+
const openapi = require("@nestjs/swagger");
|
|
17
|
+
const typeorm_1 = require("typeorm");
|
|
18
|
+
const network_entity_1 = require("../../network/entities/network.entity");
|
|
19
|
+
const user_entity_1 = require("../../user/entities/user.entity");
|
|
20
|
+
const push_service_enum_1 = __importDefault(require("../enums/push-service.enum"));
|
|
21
|
+
let PushNotificationToken = class PushNotificationToken {
|
|
22
|
+
network;
|
|
23
|
+
user;
|
|
24
|
+
service;
|
|
25
|
+
token;
|
|
26
|
+
createdAt;
|
|
27
|
+
updatedAt;
|
|
28
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
29
|
+
return { network: { required: true, type: () => require("../../network/entities/network.entity").Network }, user: { required: true, type: () => require("../../user/entities/user.entity").User }, service: { required: true, enum: require("../enums/push-service.enum").PushService }, token: { required: true, type: () => String }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.PushNotificationToken = PushNotificationToken;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.ManyToOne)(() => network_entity_1.Network, { onDelete: 'CASCADE', nullable: false }),
|
|
35
|
+
__metadata("design:type", network_entity_1.Network)
|
|
36
|
+
], PushNotificationToken.prototype, "network", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: 'CASCADE', nullable: false, eager: true }),
|
|
39
|
+
__metadata("design:type", user_entity_1.User)
|
|
40
|
+
], PushNotificationToken.prototype, "user", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: push_service_enum_1.default, nullable: false }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], PushNotificationToken.prototype, "service", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.PrimaryColumn)(),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], PushNotificationToken.prototype, "token", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], PushNotificationToken.prototype, "createdAt", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], PushNotificationToken.prototype, "updatedAt", void 0);
|
|
57
|
+
exports.PushNotificationToken = PushNotificationToken = __decorate([
|
|
58
|
+
(0, typeorm_1.Entity)()
|
|
59
|
+
], PushNotificationToken);
|
|
60
|
+
//# sourceMappingURL=push-token.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-token.entity.js","sourceRoot":"","sources":["../../../src/notification/entities/push-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qCAOiB;AACjB,0EAA4D;AAC5D,iEAAmD;AACnD,mFAAqD;AAG9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAKhC,OAAO,CAAU;IAMjB,IAAI,CAAO;IAMX,OAAO,CAAc;IAMrB,KAAK,CAAS;IAMd,SAAS,CAAO;IAMhB,SAAS,CAAO;;;;CACjB,CAAA;AApCY,sDAAqB;AAKhC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BAC1D,wBAAO;sDAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;8BACvE,kBAAI;mDAAC;AAMX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sDACxC;AAMrB;IADC,IAAA,uBAAa,GAAE;;oDACF;AAMd;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;wDAAC;AAMhB;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;wDAAC;gCAnCL,qBAAqB;IADjC,IAAA,gBAAM,GAAE;GACI,qBAAqB,CAoCjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushService = void 0;
|
|
4
|
+
var PushService;
|
|
5
|
+
(function (PushService) {
|
|
6
|
+
PushService["Expo"] = "EXPO";
|
|
7
|
+
PushService["Fcm"] = "FCM";
|
|
8
|
+
PushService["Apns"] = "APNS";
|
|
9
|
+
})(PushService || (exports.PushService = PushService = {}));
|
|
10
|
+
exports.default = PushService;
|
|
11
|
+
//# sourceMappingURL=push-service.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-service.enum.js","sourceRoot":"","sources":["../../../src/notification/enums/push-service.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,4BAAa,CAAA;AACf,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AACD,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NotificationModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
+
const push_token_entity_1 = require("./entities/push-token.entity");
|
|
13
|
+
const push_notification_controller_1 = require("./push-notification.controller");
|
|
14
|
+
const push_notification_service_1 = require("./push-notification.service");
|
|
15
|
+
let NotificationModule = class NotificationModule {
|
|
16
|
+
};
|
|
17
|
+
exports.NotificationModule = NotificationModule;
|
|
18
|
+
exports.NotificationModule = NotificationModule = __decorate([
|
|
19
|
+
(0, common_1.Module)({
|
|
20
|
+
imports: [typeorm_1.TypeOrmModule.forFeature([push_token_entity_1.PushNotificationToken])],
|
|
21
|
+
controllers: [push_notification_controller_1.PushNotificationController],
|
|
22
|
+
providers: [push_notification_service_1.PushNotificationService],
|
|
23
|
+
})
|
|
24
|
+
], NotificationModule);
|
|
25
|
+
//# sourceMappingURL=notification.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../src/notification/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,oEAAqE;AACrE,iFAA4E;AAC5E,2EAAsE;AAO/D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAL9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,yCAAqB,CAAC,CAAC,CAAC;QAC5D,WAAW,EAAE,CAAC,yDAA0B,CAAC;QACzC,SAAS,EAAE,CAAC,mDAAuB,CAAC;KACrC,CAAC;GACW,kBAAkB,CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RegisterPushNotificationTokenDto } from './dto/register-push-token.dto';
|
|
2
|
+
import { DeletePushNotificationTokenDto } from './dto/delete-push-token.dto';
|
|
3
|
+
import { PushNotificationService } from './push-notification.service';
|
|
4
|
+
export declare class PushNotificationController {
|
|
5
|
+
private service;
|
|
6
|
+
constructor(service: PushNotificationService);
|
|
7
|
+
registerToken(dto: RegisterPushNotificationTokenDto): Promise<import("typeorm").InsertResult>;
|
|
8
|
+
deleteToken(dto: DeletePushNotificationTokenDto): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PushNotificationController = void 0;
|
|
16
|
+
const openapi = require("@nestjs/swagger");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const auth_guard_1 = require("../auth/auth.guard");
|
|
19
|
+
const register_push_token_dto_1 = require("./dto/register-push-token.dto");
|
|
20
|
+
const delete_push_token_dto_1 = require("./dto/delete-push-token.dto");
|
|
21
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
22
|
+
const push_notification_service_1 = require("./push-notification.service");
|
|
23
|
+
let PushNotificationController = class PushNotificationController {
|
|
24
|
+
service;
|
|
25
|
+
constructor(service) {
|
|
26
|
+
this.service = service;
|
|
27
|
+
}
|
|
28
|
+
registerToken(dto) {
|
|
29
|
+
return this.service.registerToken(dto);
|
|
30
|
+
}
|
|
31
|
+
deleteToken(dto) {
|
|
32
|
+
return this.service.deleteToken(dto);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.PushNotificationController = PushNotificationController;
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, swagger_1.ApiOperation)({
|
|
38
|
+
summary: 'Register a device to receive push notifications',
|
|
39
|
+
description: `This Notification API method registers a device to receive push notifications.
|
|
40
|
+
The device token should be registered on the client and provided on this endpoint.
|
|
41
|
+
It is recommended to call this endpoint on each application load.`,
|
|
42
|
+
}),
|
|
43
|
+
(0, common_1.Post)('notification.push.register'),
|
|
44
|
+
openapi.ApiResponse({ status: 201 }),
|
|
45
|
+
__param(0, (0, common_1.Body)()),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", [register_push_token_dto_1.RegisterPushNotificationTokenDto]),
|
|
48
|
+
__metadata("design:returntype", void 0)
|
|
49
|
+
], PushNotificationController.prototype, "registerToken", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, swagger_1.ApiOperation)({
|
|
52
|
+
summary: 'Remove a device from receive push notifications',
|
|
53
|
+
description: `This Notification API method deletes a previously registered device from receiving notifications.
|
|
54
|
+
This should be called on logout.`,
|
|
55
|
+
}),
|
|
56
|
+
(0, common_1.Post)('notification.push.delete'),
|
|
57
|
+
openapi.ApiResponse({ status: 201 }),
|
|
58
|
+
__param(0, (0, common_1.Body)()),
|
|
59
|
+
__metadata("design:type", Function),
|
|
60
|
+
__metadata("design:paramtypes", [delete_push_token_dto_1.DeletePushNotificationTokenDto]),
|
|
61
|
+
__metadata("design:returntype", void 0)
|
|
62
|
+
], PushNotificationController.prototype, "deleteToken", null);
|
|
63
|
+
exports.PushNotificationController = PushNotificationController = __decorate([
|
|
64
|
+
(0, swagger_1.ApiTags)('Notification'),
|
|
65
|
+
(0, common_1.Controller)(),
|
|
66
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
|
67
|
+
__metadata("design:paramtypes", [push_notification_service_1.PushNotificationService])
|
|
68
|
+
], PushNotificationController);
|
|
69
|
+
//# sourceMappingURL=push-notification.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-notification.controller.js","sourceRoot":"","sources":["../../src/notification/push-notification.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,mDAA8C;AAC9C,2EAAiF;AACjF,uEAA6E;AAC7E,6CAAwD;AACxD,2EAAsE;AAK/D,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACjB;IAApB,YAAoB,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IASxD,aAAa,CAAS,GAAqC;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAQD,WAAW,CAAS,GAAmC;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF,CAAA;AAvBY,gEAA0B;AAUrC;IAPC,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,iDAAiD;QAC1D,WAAW,EAAE;;sEAEqD;KACnE,CAAC;IACD,IAAA,aAAI,EAAC,4BAA4B,CAAC;;IACpB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,0DAAgC;;+DAE1D;AAQD;IANC,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,iDAAiD;QAC1D,WAAW,EAAE;qCACoB;KAClC,CAAC;IACD,IAAA,aAAI,EAAC,0BAA0B,CAAC;;IACpB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,sDAA8B;;6DAEtD;qCAtBU,0BAA0B;IAHtC,IAAA,iBAAO,EAAC,cAAc,CAAC;IACvB,IAAA,mBAAU,GAAE;IACZ,IAAA,kBAAS,EAAC,sBAAS,CAAC;qCAEU,mDAAuB;GADzC,0BAA0B,CAuBtC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RegisterPushNotificationTokenDto } from './dto/register-push-token.dto';
|
|
2
|
+
import { DeletePushNotificationTokenDto } from './dto/delete-push-token.dto';
|
|
3
|
+
import { PushNotificationToken } from './entities/push-token.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
export declare class PushNotificationService {
|
|
6
|
+
private repository;
|
|
7
|
+
constructor(repository: Repository<PushNotificationToken>);
|
|
8
|
+
registerToken({ token, service }: RegisterPushNotificationTokenDto): Promise<import("typeorm").InsertResult>;
|
|
9
|
+
deleteToken({ token }: DeletePushNotificationTokenDto): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PushNotificationService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const push_token_entity_1 = require("./entities/push-token.entity");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const context_1 = require("../core/context/context");
|
|
21
|
+
let PushNotificationService = class PushNotificationService {
|
|
22
|
+
repository;
|
|
23
|
+
constructor(repository) {
|
|
24
|
+
this.repository = repository;
|
|
25
|
+
}
|
|
26
|
+
async registerToken({ token, service }) {
|
|
27
|
+
const entity = this.repository.create({
|
|
28
|
+
token,
|
|
29
|
+
service,
|
|
30
|
+
network: context_1.Context.getNetwork(),
|
|
31
|
+
user: context_1.Context.getUser(),
|
|
32
|
+
});
|
|
33
|
+
return await this.repository
|
|
34
|
+
.createQueryBuilder()
|
|
35
|
+
.insert()
|
|
36
|
+
.into(push_token_entity_1.PushNotificationToken)
|
|
37
|
+
.values(entity)
|
|
38
|
+
.orUpdate(['updated_at'])
|
|
39
|
+
.execute();
|
|
40
|
+
}
|
|
41
|
+
async deleteToken({ token }) {
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.PushNotificationService = PushNotificationService;
|
|
45
|
+
exports.PushNotificationService = PushNotificationService = __decorate([
|
|
46
|
+
(0, common_1.Injectable)(),
|
|
47
|
+
__param(0, (0, typeorm_1.InjectRepository)(push_token_entity_1.PushNotificationToken)),
|
|
48
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
49
|
+
], PushNotificationService);
|
|
50
|
+
//# sourceMappingURL=push-notification.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-notification.service.js","sourceRoot":"","sources":["../../src/notification/push-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6CAAmD;AACnD,oEAAqE;AACrE,qCAAqC;AACrC,qDAAiD;AAG1C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAGxB;IAFV,YAEU,UAA6C;QAA7C,eAAU,GAAV,UAAU,CAAmC;IACpD,CAAC;IAKJ,KAAK,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAoC;QACtE,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACpC,KAAK;YACL,OAAO;YACP,OAAO,EAAE,iBAAO,CAAC,UAAU,EAAE;YAC7B,IAAI,EAAE,iBAAO,CAAC,OAAO,EAAE;SACxB,CAAC,CAAC;QAEH,OAAO,MAAM,IAAI,CAAC,UAAU;aACzB,kBAAkB,EAAE;aACpB,MAAM,EAAE;aACR,IAAI,CAAC,yCAAqB,CAAC;aAC3B,MAAM,CAAC,MAAM,CAAC;aACd,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;aACxB,OAAO,EAAE,CAAC;IACf,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,EAAkC;IAE3D,CAAC;CACF,CAAA;AA7BY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,yCAAqB,CAAC,CAAA;qCACpB,oBAAU;GAHrB,uBAAuB,CA6BnC"}
|