@natrave/shared-entities 1.4.102 → 1.4.104

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.
@@ -15,7 +15,8 @@ export declare class User {
15
15
  shirtNumber: number | null;
16
16
  email: string;
17
17
  gender: Gender | null;
18
- cpf: string | null;
18
+ cpfEncrypted: string | null;
19
+ cpfHash: string | null;
19
20
  phone: string | null;
20
21
  imageUrl: string | null;
21
22
  refreshTokens: RefreshToken[];
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,qBAea,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,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAStB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAUnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAK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B,EAAE,gBAAgB,EAAE,CAAC;IAKtC,MAAM,EAAE,MAAM,CAAC;IAGf,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IAGxC,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IAMhE,WAAW,IAAI,IAAI;CAGpB"}
@@ -113,13 +113,21 @@ __decorateClass([
113
113
  ], User.prototype, "gender", 2);
114
114
  __decorateClass([
115
115
  Column({
116
- type: "varchar",
117
- length: 14,
116
+ name: "cpf_encrypted",
117
+ type: "text",
118
118
  nullable: true,
119
- unique: true,
120
- comment: "N\xFAmero do CPF do usu\xE1rio, se fornecido."
119
+ comment: "CPF do usu\xE1rio criptografado com AES-256-GCM."
120
+ })
121
+ ], User.prototype, "cpfEncrypted", 2);
122
+ __decorateClass([
123
+ Column({
124
+ name: "cpf_hash",
125
+ type: "char",
126
+ length: 64,
127
+ nullable: true,
128
+ comment: "Hash SHA-256 do CPF normalizado com pepper para compara\xE7\xE3o."
121
129
  })
122
- ], User.prototype, "cpf", 2);
130
+ ], User.prototype, "cpfHash", 2);
123
131
  __decorateClass([
124
132
  Column({
125
133
  name: "phone",
@@ -165,12 +173,13 @@ User = __decorateClass([
165
173
  Entity("users"),
166
174
  Unique(["email"]),
167
175
  Unique(["phone"]),
168
- Unique(["cpf"]),
169
176
  Index("IDX_users_id", ["id"]),
170
177
  Index("IDX_users_numeric_id", ["numericId"]),
171
178
  Index("IDX_users_email_lookup", ["email"], { where: '"deleted_at" IS NULL' }),
172
179
  Index("IDX_users_phone_lookup", ["phone"], { where: '"deleted_at" IS NULL' }),
173
- Index("IDX_users_cpf_lookup", ["cpf"], { where: '"deleted_at" IS NULL' }),
180
+ Index("IDX_users_cpf_hash_lookup", ["cpfHash"], {
181
+ where: '"deleted_at" IS NULL AND "cpf_hash" IS NOT NULL'
182
+ }),
174
183
  Index("IDX_users_deleted_at", ["deletedAt"]),
175
184
  Index("IDX_users_id_deleted", ["id", "deletedAt"]),
176
185
  Index("IDX_users_created_at", ["createdAt"]),
@@ -1,6 +1,7 @@
1
1
  export declare function formatUserBeforeInsertData(user: {
2
2
  email: string | null;
3
- cpf: string | null;
3
+ cpfEncrypted: string | null;
4
+ cpfHash: string | null;
4
5
  phone: string | null;
5
6
  }): void;
6
7
  //# sourceMappingURL=format-data.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-data.utils.d.ts","sourceRoot":"","sources":["../../../../src/app-auth/users/utils/format-data.utils.ts"],"names":[],"mappings":"AAWA,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,GAAG,IAAI,CAkBP"}
1
+ {"version":3,"file":"format-data.utils.d.ts","sourceRoot":"","sources":["../../../../src/app-auth/users/utils/format-data.utils.ts"],"names":[],"mappings":"AAWA,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,GAAG,IAAI,CAwBP"}
@@ -2,8 +2,12 @@ function formatUserBeforeInsertData(user) {
2
2
  if (user.email) {
3
3
  user.email = user.email.toLowerCase().trim();
4
4
  }
5
- if (user.cpf) {
6
- user.cpf = user.cpf.replace(/\D/g, "").trim();
5
+ if (user.cpfEncrypted) {
6
+ user.cpfEncrypted = user.cpfEncrypted.trim();
7
+ }
8
+ if (user.cpfHash) {
9
+ const normalizedHash = user.cpfHash.trim().toLowerCase();
10
+ user.cpfHash = /^[a-f0-9]{64}$/.test(normalizedHash) ? normalizedHash : null;
7
11
  }
8
12
  if (user.phone) {
9
13
  user.phone = user.phone.replace(/\D/g, "").trim();
@@ -7,6 +7,7 @@ export declare class TournamentRegistrationRequest {
7
7
  tournamentId: number;
8
8
  teamId: number;
9
9
  requestedByUserId: string;
10
+ requestedAt: Date;
10
11
  status: TournamentRegistrationRequestStatus;
11
12
  message?: string;
12
13
  organizerNote?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"tournament-registration-request.entity.d.ts","sourceRoot":"","sources":["../../../src/tournaments/tournament-registration-requests/tournament-registration-request.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AAOpG,qBAUa,6BAA6B;IAIxC,EAAE,EAAE,MAAM,CAAC;IAGX,YAAY,EAAE,MAAM,CAAC;IAGrB,MAAM,EAAE,MAAM,CAAC;IAOf,iBAAiB,EAAE,MAAM,CAAC;IAQ1B,MAAM,EAAE,mCAAmC,CAAC;IAQ5C,OAAO,CAAC,EAAE,MAAM,CAAC;IASjB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;IAMhB,UAAU,EAAE,UAAU,CAAC;IAIvB,IAAI,EAAE,IAAI,CAAC;IAIX,WAAW,EAAE,IAAI,CAAC;CACnB"}
1
+ {"version":3,"file":"tournament-registration-request.entity.d.ts","sourceRoot":"","sources":["../../../src/tournaments/tournament-registration-requests/tournament-registration-request.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AAOpG,qBAUa,6BAA6B;IAIxC,EAAE,EAAE,MAAM,CAAC;IAGX,YAAY,EAAE,MAAM,CAAC;IAGrB,MAAM,EAAE,MAAM,CAAC;IAOf,iBAAiB,EAAE,MAAM,CAAC;IAO1B,WAAW,EAAE,IAAI,CAAC;IAQlB,MAAM,EAAE,mCAAmC,CAAC;IAQ5C,OAAO,CAAC,EAAE,MAAM,CAAC;IASjB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;IAMhB,UAAU,EAAE,UAAU,CAAC;IAIvB,IAAI,EAAE,IAAI,CAAC;IAIX,WAAW,EAAE,IAAI,CAAC;CACnB"}
@@ -42,6 +42,13 @@ __decorateClass([
42
42
  comment: "Usu\xE1rio (manager/capit\xE3o) que abriu a solicita\xE7\xE3o."
43
43
  })
44
44
  ], TournamentRegistrationRequest.prototype, "requestedByUserId", 2);
45
+ __decorateClass([
46
+ CreateDateColumn({
47
+ name: "requested_at",
48
+ type: "timestamptz",
49
+ comment: "Data/hora em que a solicita\xE7\xE3o foi feita."
50
+ })
51
+ ], TournamentRegistrationRequest.prototype, "requestedAt", 2);
45
52
  __decorateClass([
46
53
  Column({
47
54
  type: "enum",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "1.4.102",
3
+ "version": "1.4.104",
4
4
  "description": "Entidades compartilhadass da NaTrave",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",