@natrave/shared-entities 1.4.103 → 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.
- package/dist/app-auth/users/user.entity.d.ts +2 -1
- package/dist/app-auth/users/user.entity.d.ts.map +1 -1
- package/dist/app-auth/users/user.entity.js +16 -7
- package/dist/app-auth/users/utils/format-data.utils.d.ts +2 -1
- package/dist/app-auth/users/utils/format-data.utils.d.ts.map +1 -1
- package/dist/app-auth/users/utils/format-data.utils.js +6 -2
- package/package.json +1 -1
|
@@ -15,7 +15,8 @@ export declare class User {
|
|
|
15
15
|
shirtNumber: number | null;
|
|
16
16
|
email: string;
|
|
17
17
|
gender: Gender | null;
|
|
18
|
-
|
|
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,
|
|
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,qBAgBa,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;IAQtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAKxB,aAAa,EAAE,YAAY,EAAE,CAAC;IAK9B,iBAAiB,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
|
-
|
|
117
|
-
|
|
116
|
+
name: "cpf_encrypted",
|
|
117
|
+
type: "text",
|
|
118
118
|
nullable: true,
|
|
119
|
-
|
|
120
|
-
|
|
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, "
|
|
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("
|
|
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 +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;
|
|
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.
|
|
6
|
-
user.
|
|
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();
|