@natrave/shared-entities 1.4.13 → 1.4.14

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.
@@ -1,3 +1,4 @@
1
+ import { NotificationToken } from '../../notifications';
1
2
  import { Player } from '../../players';
2
3
  import { RefreshToken } from '../refresh-tokens';
3
4
  import { UserAuthProvider } from '../user-auth-providers';
@@ -20,6 +21,7 @@ export declare class User {
20
21
  refreshTokens: RefreshToken[];
21
22
  userAuthProviders: UserAuthProvider[];
22
23
  player: Player;
24
+ notificationTokens: NotificationToken[];
23
25
  prepareData(): void;
24
26
  }
25
27
  //# sourceMappingURL=user.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,qBAIa,IAAI;IAIf,EAAE,EAAE,MAAM,CAAC;IAUX,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAQpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,KAAK,EAAE,MAAM,CAAC;IAQd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAQxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAStB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAUnB,KAAK,EAAE,MAAM,GAAG,IA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BAAiB,EAAE,CAAC;IAMxC,WAAW,IAAI,IAAI;CAGpB"}
@@ -20,6 +20,7 @@ import {
20
20
  Unique,
21
21
  UpdateDateColumn
22
22
  } from "typeorm";
23
+ import { NotificationToken } from "../../notifications/index.js";
23
24
  import { Player } from "../../players/index.js";
24
25
  import { RefreshToken } from "../refresh-tokens/index.js";
25
26
  import { UserAuthProvider } from "../user-auth-providers/index.js";
@@ -155,6 +156,9 @@ __decorateClass([
155
156
  __decorateClass([
156
157
  OneToOne(() => Player, (player) => player.user, { onDelete: "CASCADE" })
157
158
  ], User.prototype, "player", 2);
159
+ __decorateClass([
160
+ OneToMany(() => NotificationToken, (token) => token.user)
161
+ ], User.prototype, "notificationTokens", 2);
158
162
  __decorateClass([
159
163
  BeforeInsert()
160
164
  ], User.prototype, "prepareData", 1);
@@ -1,2 +1,3 @@
1
1
  export * from './email-templates';
2
+ export * from './notification-tokens';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,cAAc,uBAAuB,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./email-templates/index.js";
2
+ export * from "./notification-tokens/index.js";
@@ -0,0 +1,6 @@
1
+ export declare enum NotificationPlatform {
2
+ ANDROID = "android",
3
+ IOS = "ios",
4
+ WEB = "web"
5
+ }
6
+ //# sourceMappingURL=notification-platform.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-platform.enum.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-tokens/enums/notification-platform.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ"}
@@ -0,0 +1,9 @@
1
+ var NotificationPlatform = /* @__PURE__ */ ((NotificationPlatform2) => {
2
+ NotificationPlatform2["ANDROID"] = "android";
3
+ NotificationPlatform2["IOS"] = "ios";
4
+ NotificationPlatform2["WEB"] = "web";
5
+ return NotificationPlatform2;
6
+ })(NotificationPlatform || {});
7
+ export {
8
+ NotificationPlatform
9
+ };
@@ -0,0 +1,3 @@
1
+ export { NotificationToken } from './notification-token.entity';
2
+ export { NotificationPlatform } from './enums/notification-platform.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NotificationToken } from "./notification-token.entity.js";
2
+ import { NotificationPlatform } from "./enums/notification-platform.enum.js";
3
+ export {
4
+ NotificationPlatform,
5
+ NotificationToken
6
+ };
@@ -0,0 +1,14 @@
1
+ import { User } from '../../app-auth';
2
+ import { NotificationPlatform } from './enums/notification-platform.enum';
3
+ export declare class NotificationToken {
4
+ id: string;
5
+ token: string;
6
+ platform: NotificationPlatform;
7
+ appVersion: string | null;
8
+ isRevoked: boolean;
9
+ createdAt: Date;
10
+ lastSeenAt: Date;
11
+ userId: string;
12
+ user: User;
13
+ }
14
+ //# sourceMappingURL=notification-token.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-token.entity.d.ts","sourceRoot":"","sources":["../../../src/notifications/notification-tokens/notification-token.entity.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAY1E,qBAGa,iBAAiB;IAI5B,EAAE,EAAE,MAAM,CAAC;IAQX,KAAK,EAAE,MAAM,CAAC;IAOd,QAAQ,EAAE,oBAAoB,CAAC;IAS/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ1B,SAAS,EAAE,OAAO,CAAC;IAOnB,SAAS,EAAE,IAAI,CAAC;IAOhB,UAAU,EAAE,IAAI,CAAC;IASjB,MAAM,EAAE,MAAM,CAAC;IAKf,IAAI,EAAE,IAAI,CAAC;CACZ"}
@@ -0,0 +1,94 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Column,
13
+ CreateDateColumn,
14
+ Entity,
15
+ Index,
16
+ ManyToOne,
17
+ PrimaryGeneratedColumn,
18
+ UpdateDateColumn
19
+ } from "typeorm";
20
+ import { User } from "../../app-auth/index.js";
21
+ import { NotificationPlatform } from "./enums/notification-platform.enum.js";
22
+ let NotificationToken = class {
23
+ };
24
+ __decorateClass([
25
+ PrimaryGeneratedColumn("uuid", {
26
+ comment: "Identificador \xFAnico do token (UUID)."
27
+ })
28
+ ], NotificationToken.prototype, "id", 2);
29
+ __decorateClass([
30
+ Column({
31
+ name: "token",
32
+ type: "varchar",
33
+ length: 255,
34
+ comment: "Registration token gerado pelo Firebase para o dispositivo."
35
+ })
36
+ ], NotificationToken.prototype, "token", 2);
37
+ __decorateClass([
38
+ Column({
39
+ type: "enum",
40
+ enum: NotificationPlatform,
41
+ comment: "Plataforma do dispositivo."
42
+ })
43
+ ], NotificationToken.prototype, "platform", 2);
44
+ __decorateClass([
45
+ Column({
46
+ name: "app_version",
47
+ type: "varchar",
48
+ length: 32,
49
+ nullable: true,
50
+ comment: "Vers\xE3o do app no momento do cadastro/refresh."
51
+ })
52
+ ], NotificationToken.prototype, "appVersion", 2);
53
+ __decorateClass([
54
+ Column({
55
+ name: "is_revoked",
56
+ type: "bool",
57
+ default: false,
58
+ comment: "Indica se o token foi revogado (logout, erro 404/410 do FCM)."
59
+ })
60
+ ], NotificationToken.prototype, "isRevoked", 2);
61
+ __decorateClass([
62
+ CreateDateColumn({
63
+ name: "created_at",
64
+ type: "timestamptz",
65
+ comment: "Data de cria\xE7\xE3o do token."
66
+ })
67
+ ], NotificationToken.prototype, "createdAt", 2);
68
+ __decorateClass([
69
+ UpdateDateColumn({
70
+ name: "last_seen_at",
71
+ type: "timestamptz",
72
+ comment: "\xDAltima vez que este token foi visto (refresh ou push bem-sucedido)."
73
+ })
74
+ ], NotificationToken.prototype, "lastSeenAt", 2);
75
+ __decorateClass([
76
+ Column({
77
+ name: "user_id",
78
+ type: "uuid",
79
+ comment: "FK users.id"
80
+ })
81
+ ], NotificationToken.prototype, "userId", 2);
82
+ __decorateClass([
83
+ ManyToOne(() => User, (user) => user.notificationTokens, {
84
+ onDelete: "CASCADE"
85
+ })
86
+ ], NotificationToken.prototype, "user", 2);
87
+ NotificationToken = __decorateClass([
88
+ Entity("notification_tokens"),
89
+ Index("IDX_notification_tokens_token", ["token"], { unique: true }),
90
+ Index("IDX_notification_tokens_user", ["userId"])
91
+ ], NotificationToken);
92
+ export {
93
+ NotificationToken
94
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "1.4.13",
3
+ "version": "1.4.14",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@natrave/auth-service-types": "^1.1.63",
47
47
  "@natrave/facility-service-types": "^0.0.9",
48
- "@natrave/notification-service-types": "^1.1.68",
48
+ "@natrave/notification-service-types": "^1.1.70",
49
49
  "@natrave/tournaments-service-types": "^1.2.36",
50
50
  "reflect-metadata": "^0.2.2",
51
51
  "typeorm": "^0.3.25"