@hedhog/admin 0.46.25 → 0.46.27
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/auth/auth.controller.d.ts +97 -30
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.service.d.ts +99 -44
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +34 -58
- package/dist/auth/auth.service.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/auth.service.ts +34 -64
@@ -10,6 +10,103 @@ export declare class AuthController {
|
|
10
10
|
private readonly service;
|
11
11
|
constructor(service: AuthService);
|
12
12
|
verify({ id }: UserType): Promise<{
|
13
|
+
person_user: ({
|
14
|
+
person: {
|
15
|
+
person_address: ({
|
16
|
+
country: {
|
17
|
+
code: string;
|
18
|
+
id: number;
|
19
|
+
created_at: Date;
|
20
|
+
updated_at: Date;
|
21
|
+
};
|
22
|
+
person_address_type: {
|
23
|
+
id: number;
|
24
|
+
created_at: Date;
|
25
|
+
updated_at: Date;
|
26
|
+
slug: string;
|
27
|
+
};
|
28
|
+
} & {
|
29
|
+
number: string | null;
|
30
|
+
id: number;
|
31
|
+
created_at: Date;
|
32
|
+
updated_at: Date;
|
33
|
+
country_id: number;
|
34
|
+
type_id: number;
|
35
|
+
person_id: number;
|
36
|
+
primary: boolean;
|
37
|
+
street: string;
|
38
|
+
complement: string | null;
|
39
|
+
district: string;
|
40
|
+
city: string;
|
41
|
+
state: string;
|
42
|
+
postal_code: string;
|
43
|
+
reference: string | null;
|
44
|
+
})[];
|
45
|
+
person_document: ({
|
46
|
+
country: {
|
47
|
+
code: string;
|
48
|
+
id: number;
|
49
|
+
created_at: Date;
|
50
|
+
updated_at: Date;
|
51
|
+
};
|
52
|
+
person_document_type: {
|
53
|
+
id: number;
|
54
|
+
created_at: Date;
|
55
|
+
updated_at: Date;
|
56
|
+
slug: string;
|
57
|
+
country_id: number;
|
58
|
+
};
|
59
|
+
} & {
|
60
|
+
value: string;
|
61
|
+
id: number;
|
62
|
+
created_at: Date;
|
63
|
+
updated_at: Date;
|
64
|
+
country_id: number;
|
65
|
+
type_id: number;
|
66
|
+
person_id: number;
|
67
|
+
primary: boolean;
|
68
|
+
issued_at: Date | null;
|
69
|
+
expiry_at: Date | null;
|
70
|
+
})[];
|
71
|
+
person_type: {
|
72
|
+
id: number;
|
73
|
+
created_at: Date;
|
74
|
+
updated_at: Date;
|
75
|
+
slug: string;
|
76
|
+
};
|
77
|
+
person_contact: ({
|
78
|
+
person_contact_type: {
|
79
|
+
id: number;
|
80
|
+
created_at: Date;
|
81
|
+
updated_at: Date;
|
82
|
+
slug: string;
|
83
|
+
};
|
84
|
+
} & {
|
85
|
+
value: string;
|
86
|
+
id: number;
|
87
|
+
created_at: Date;
|
88
|
+
updated_at: Date;
|
89
|
+
type_id: number;
|
90
|
+
person_id: number;
|
91
|
+
primary: boolean;
|
92
|
+
})[];
|
93
|
+
} & {
|
94
|
+
name: string;
|
95
|
+
id: number;
|
96
|
+
created_at: Date;
|
97
|
+
updated_at: Date;
|
98
|
+
photo_id: number | null;
|
99
|
+
type_id: number;
|
100
|
+
birth_at: Date | null;
|
101
|
+
};
|
102
|
+
} & {
|
103
|
+
id: number;
|
104
|
+
created_at: Date;
|
105
|
+
updated_at: Date;
|
106
|
+
user_id: number;
|
107
|
+
person_id: number;
|
108
|
+
})[];
|
109
|
+
} & {
|
13
110
|
code: string | null;
|
14
111
|
name: string;
|
15
112
|
id: number;
|
@@ -20,12 +117,6 @@ export declare class AuthController {
|
|
20
117
|
password: string;
|
21
118
|
}>;
|
22
119
|
login({ email, password }: LoginDTO): Promise<{
|
23
|
-
id: any;
|
24
|
-
name: any;
|
25
|
-
email: any;
|
26
|
-
cpf: any;
|
27
|
-
telephone: any;
|
28
|
-
address: any;
|
29
120
|
token: string;
|
30
121
|
} | {
|
31
122
|
name: string;
|
@@ -34,12 +125,6 @@ export declare class AuthController {
|
|
34
125
|
mfa: boolean;
|
35
126
|
}>;
|
36
127
|
otp({ token, code }: OtpDTO): Promise<{
|
37
|
-
id: any;
|
38
|
-
name: any;
|
39
|
-
email: any;
|
40
|
-
cpf: any;
|
41
|
-
telephone: any;
|
42
|
-
address: any;
|
43
128
|
token: string;
|
44
129
|
}>;
|
45
130
|
forget({ email, }: ForgetDTO & {
|
@@ -47,30 +132,12 @@ export declare class AuthController {
|
|
47
132
|
body: string;
|
48
133
|
}): Promise<boolean>;
|
49
134
|
reset({ newPassword, confirmNewPassword, code }: ResetDTO): Promise<false | {
|
50
|
-
id: any;
|
51
|
-
name: any;
|
52
|
-
email: any;
|
53
|
-
cpf: any;
|
54
|
-
telephone: any;
|
55
|
-
address: any;
|
56
135
|
token: string;
|
57
136
|
}>;
|
58
137
|
changePassword({ email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO): Promise<{
|
59
|
-
id: any;
|
60
|
-
name: any;
|
61
|
-
email: any;
|
62
|
-
cpf: any;
|
63
|
-
telephone: any;
|
64
|
-
address: any;
|
65
138
|
token: string;
|
66
139
|
}>;
|
67
140
|
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
68
|
-
id: any;
|
69
|
-
name: any;
|
70
|
-
email: any;
|
71
|
-
cpf: any;
|
72
|
-
telephone: any;
|
73
|
-
address: any;
|
74
141
|
token: string;
|
75
142
|
}>;
|
76
143
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MA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G;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd;IASG,KAAK,CAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,QAAQ;;;IAUjE,cAAc,CAElB,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,SAAS;;;IAYlE,WAAW,CAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;CAGzE"}
|
@@ -18,12 +18,6 @@ export declare class AuthService {
|
|
18
18
|
generateRandomString(length: number): string;
|
19
19
|
generateRandomNumber(): number;
|
20
20
|
loginWithEmailAndPassword(email: string, password: string): Promise<{
|
21
|
-
id: any;
|
22
|
-
name: any;
|
23
|
-
email: any;
|
24
|
-
cpf: any;
|
25
|
-
telephone: any;
|
26
|
-
address: any;
|
27
21
|
token: string;
|
28
22
|
} | {
|
29
23
|
name: string;
|
@@ -32,58 +26,22 @@ export declare class AuthService {
|
|
32
26
|
mfa: boolean;
|
33
27
|
}>;
|
34
28
|
getToken(user: any): Promise<{
|
35
|
-
id: any;
|
36
|
-
name: any;
|
37
|
-
email: any;
|
38
|
-
cpf: any;
|
39
|
-
telephone: any;
|
40
|
-
address: any;
|
41
29
|
token: string;
|
42
30
|
}>;
|
43
31
|
forget({ email }: ForgetDTO): Promise<boolean>;
|
44
32
|
changePassword({ email, currentPassword, newPassword, confirmNewPassword, }: ChangeDTO): Promise<{
|
45
|
-
id: any;
|
46
|
-
name: any;
|
47
|
-
email: any;
|
48
|
-
cpf: any;
|
49
|
-
telephone: any;
|
50
|
-
address: any;
|
51
33
|
token: string;
|
52
34
|
}>;
|
53
35
|
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
54
|
-
id: any;
|
55
|
-
name: any;
|
56
|
-
email: any;
|
57
|
-
cpf: any;
|
58
|
-
telephone: any;
|
59
|
-
address: any;
|
60
36
|
token: string;
|
61
37
|
}>;
|
62
38
|
resetPassword({ code, newPassword, confirmNewPassword }: ResetDTO): Promise<false | {
|
63
|
-
id: any;
|
64
|
-
name: any;
|
65
|
-
email: any;
|
66
|
-
cpf: any;
|
67
|
-
telephone: any;
|
68
|
-
address: any;
|
69
39
|
token: string;
|
70
40
|
}>;
|
71
41
|
otp({ token, code }: OtpDTO): Promise<{
|
72
|
-
id: any;
|
73
|
-
name: any;
|
74
|
-
email: any;
|
75
|
-
cpf: any;
|
76
|
-
telephone: any;
|
77
|
-
address: any;
|
78
42
|
token: string;
|
79
43
|
}>;
|
80
44
|
login({ email, password }: LoginDTO): Promise<{
|
81
|
-
id: any;
|
82
|
-
name: any;
|
83
|
-
email: any;
|
84
|
-
cpf: any;
|
85
|
-
telephone: any;
|
86
|
-
address: any;
|
87
45
|
token: string;
|
88
46
|
} | {
|
89
47
|
name: string;
|
@@ -91,7 +49,104 @@ export declare class AuthService {
|
|
91
49
|
token: string;
|
92
50
|
mfa: boolean;
|
93
51
|
}>;
|
94
|
-
verify(id: number):
|
52
|
+
verify(id: number): Promise<{
|
53
|
+
person_user: ({
|
54
|
+
person: {
|
55
|
+
person_address: ({
|
56
|
+
country: {
|
57
|
+
code: string;
|
58
|
+
id: number;
|
59
|
+
created_at: Date;
|
60
|
+
updated_at: Date;
|
61
|
+
};
|
62
|
+
person_address_type: {
|
63
|
+
id: number;
|
64
|
+
created_at: Date;
|
65
|
+
updated_at: Date;
|
66
|
+
slug: string;
|
67
|
+
};
|
68
|
+
} & {
|
69
|
+
number: string | null;
|
70
|
+
id: number;
|
71
|
+
created_at: Date;
|
72
|
+
updated_at: Date;
|
73
|
+
country_id: number;
|
74
|
+
type_id: number;
|
75
|
+
person_id: number;
|
76
|
+
primary: boolean;
|
77
|
+
street: string;
|
78
|
+
complement: string | null;
|
79
|
+
district: string;
|
80
|
+
city: string;
|
81
|
+
state: string;
|
82
|
+
postal_code: string;
|
83
|
+
reference: string | null;
|
84
|
+
})[];
|
85
|
+
person_document: ({
|
86
|
+
country: {
|
87
|
+
code: string;
|
88
|
+
id: number;
|
89
|
+
created_at: Date;
|
90
|
+
updated_at: Date;
|
91
|
+
};
|
92
|
+
person_document_type: {
|
93
|
+
id: number;
|
94
|
+
created_at: Date;
|
95
|
+
updated_at: Date;
|
96
|
+
slug: string;
|
97
|
+
country_id: number;
|
98
|
+
};
|
99
|
+
} & {
|
100
|
+
value: string;
|
101
|
+
id: number;
|
102
|
+
created_at: Date;
|
103
|
+
updated_at: Date;
|
104
|
+
country_id: number;
|
105
|
+
type_id: number;
|
106
|
+
person_id: number;
|
107
|
+
primary: boolean;
|
108
|
+
issued_at: Date | null;
|
109
|
+
expiry_at: Date | null;
|
110
|
+
})[];
|
111
|
+
person_type: {
|
112
|
+
id: number;
|
113
|
+
created_at: Date;
|
114
|
+
updated_at: Date;
|
115
|
+
slug: string;
|
116
|
+
};
|
117
|
+
person_contact: ({
|
118
|
+
person_contact_type: {
|
119
|
+
id: number;
|
120
|
+
created_at: Date;
|
121
|
+
updated_at: Date;
|
122
|
+
slug: string;
|
123
|
+
};
|
124
|
+
} & {
|
125
|
+
value: string;
|
126
|
+
id: number;
|
127
|
+
created_at: Date;
|
128
|
+
updated_at: Date;
|
129
|
+
type_id: number;
|
130
|
+
person_id: number;
|
131
|
+
primary: boolean;
|
132
|
+
})[];
|
133
|
+
} & {
|
134
|
+
name: string;
|
135
|
+
id: number;
|
136
|
+
created_at: Date;
|
137
|
+
updated_at: Date;
|
138
|
+
photo_id: number | null;
|
139
|
+
type_id: number;
|
140
|
+
birth_at: Date | null;
|
141
|
+
};
|
142
|
+
} & {
|
143
|
+
id: number;
|
144
|
+
created_at: Date;
|
145
|
+
updated_at: Date;
|
146
|
+
user_id: number;
|
147
|
+
person_id: number;
|
148
|
+
})[];
|
149
|
+
} & {
|
95
150
|
code: string | null;
|
96
151
|
name: string;
|
97
152
|
id: number;
|
@@ -100,6 +155,6 @@ export declare class AuthService {
|
|
100
155
|
multifactor_id: number | null;
|
101
156
|
email: string;
|
102
157
|
password: string;
|
103
|
-
}
|
158
|
+
}>;
|
104
159
|
}
|
105
160
|
//# sourceMappingURL=auth.service.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,qBACa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBANJ,aAAa,EAAE,aAAa,EAE5B,MAAM,EAAE,aAAa,EAErB,GAAG,EAAE,UAAU,EAEf,IAAI,EAAE,WAAW;IAG9B,WAAW,CAAC,KAAK,EAAE,MAAM;IAM/B,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAW5C,oBAAoB,IAAI,MAAM;IAMxB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":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;;IA6B1D,aAAa,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,QAAQ;;;IA4CjE,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;IA0B3B,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;;;IAInC,MAAM,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCxB"}
|
@@ -92,63 +92,9 @@ let AuthService = class AuthService {
|
|
92
92
|
}
|
93
93
|
}
|
94
94
|
async getToken(user) {
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
96
95
|
delete user.password;
|
97
|
-
const
|
98
|
-
where: { id: user.id },
|
99
|
-
include: {
|
100
|
-
person_user: {
|
101
|
-
include: {
|
102
|
-
person: {
|
103
|
-
include: {
|
104
|
-
person_address: {
|
105
|
-
include: {
|
106
|
-
country: true,
|
107
|
-
person_address_type: true,
|
108
|
-
},
|
109
|
-
},
|
110
|
-
person_contact: {
|
111
|
-
include: {
|
112
|
-
person_contact_type: true,
|
113
|
-
},
|
114
|
-
},
|
115
|
-
person_document: {
|
116
|
-
include: {
|
117
|
-
person_document_type: true,
|
118
|
-
country: true,
|
119
|
-
},
|
120
|
-
},
|
121
|
-
person_type: true,
|
122
|
-
},
|
123
|
-
},
|
124
|
-
},
|
125
|
-
},
|
126
|
-
},
|
127
|
-
});
|
128
|
-
if (!userData) {
|
129
|
-
throw new common_1.NotFoundException('User not found');
|
130
|
-
}
|
131
|
-
const person = (_b = (_a = userData.person_user) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.person;
|
132
|
-
const payload = { user: userData };
|
96
|
+
const payload = { user };
|
133
97
|
return {
|
134
|
-
id: userData.id,
|
135
|
-
name: userData.name,
|
136
|
-
email: userData.email,
|
137
|
-
cpf: ((_d = (_c = person === null || person === void 0 ? void 0 : person.person_document) === null || _c === void 0 ? void 0 : _c.find((doc) => doc.person_document_type.slug === 'cpf')) === null || _d === void 0 ? void 0 : _d.value) || null,
|
138
|
-
telephone: ((_f = (_e = person === null || person === void 0 ? void 0 : person.person_contact) === null || _e === void 0 ? void 0 : _e.find((contact) => contact.person_contact_type.slug === 'phone')) === null || _f === void 0 ? void 0 : _f.value) || null,
|
139
|
-
address: ((_g = person === null || person === void 0 ? void 0 : person.person_address) === null || _g === void 0 ? void 0 : _g.map((address) => {
|
140
|
-
var _a, _b;
|
141
|
-
return ({
|
142
|
-
street: address.street,
|
143
|
-
number: address.number,
|
144
|
-
district: address.district,
|
145
|
-
city: address.city,
|
146
|
-
state: address.state,
|
147
|
-
postal_code: address.postal_code,
|
148
|
-
country: ((_a = address.country) === null || _a === void 0 ? void 0 : _a.code) || null,
|
149
|
-
type: ((_b = address.person_address_type) === null || _b === void 0 ? void 0 : _b.slug) || null,
|
150
|
-
});
|
151
|
-
})) || [],
|
152
98
|
token: this.jwt.sign(payload),
|
153
99
|
};
|
154
100
|
}
|
@@ -283,11 +229,41 @@ let AuthService = class AuthService {
|
|
283
229
|
});
|
284
230
|
return this.getToken(user);
|
285
231
|
}
|
286
|
-
login({ email, password }) {
|
232
|
+
async login({ email, password }) {
|
287
233
|
return this.loginWithEmailAndPassword(email, password);
|
288
234
|
}
|
289
|
-
verify(id) {
|
290
|
-
return this.prisma.user.findUnique({
|
235
|
+
async verify(id) {
|
236
|
+
return this.prisma.user.findUnique({
|
237
|
+
where: { id },
|
238
|
+
include: {
|
239
|
+
person_user: {
|
240
|
+
include: {
|
241
|
+
person: {
|
242
|
+
include: {
|
243
|
+
person_address: {
|
244
|
+
include: {
|
245
|
+
country: true,
|
246
|
+
person_address_type: true,
|
247
|
+
},
|
248
|
+
},
|
249
|
+
person_contact: {
|
250
|
+
include: {
|
251
|
+
person_contact_type: true,
|
252
|
+
},
|
253
|
+
},
|
254
|
+
person_document: {
|
255
|
+
include: {
|
256
|
+
person_document_type: true,
|
257
|
+
country: true,
|
258
|
+
},
|
259
|
+
},
|
260
|
+
person_type: true,
|
261
|
+
},
|
262
|
+
},
|
263
|
+
},
|
264
|
+
},
|
265
|
+
},
|
266
|
+
});
|
291
267
|
}
|
292
268
|
};
|
293
269
|
exports.AuthService = AuthService;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,2CAA+C;AAC/C,2CAOwB;AACxB,2CAA+C;AAC/C,qCAAyC;AACzC,mCAAgD;AAChD,wCAAwC;AAOxC,yEAAgE;AAGzD,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YACmB,aAA4B,EAE5B,MAAqB,EAErB,GAAe,EAEf,IAAiB;QANjB,kBAAa,GAAb,aAAa,CAAe;QAE5B,WAAM,GAAN,MAAM,CAAe;QAErB,QAAG,GAAH,GAAG,CAAY;QAEf,SAAI,GAAJ,IAAI,CAAa;IACjC,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE;YACjC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;SACvC,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,MAAM,UAAU,GACd,gEAAgE,CAAC;QACnE,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;YAClE,MAAM,IAA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AmB,EAAE,IAAI;qCAC1B;iCACF;gCACD,cAAc,EAAE;oCACd,OAAO,EAAE;wCACP,mBAAmB,EAAE,IAAI;qCAC1B;iCACF;gCACD,eAAe,EAAE;oCACf,OAAO,EAAE;wCACP,oBAAoB,EAAE,IAAI;wCAC1B,OAAO,EAAE,IAAI;qCACd;iCACF;gCACD,WAAW,EAAE,IAAI;6BAClB;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAhTY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gBAAU,CAAC,CAAC,CAAA;IAEpC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kBAAW,CAAC,CAAC,CAAA;qCALN,sBAAa;QAEpB,sBAAa;QAEhB,gBAAU;QAET,kBAAW;GARzB,WAAW,CAgTvB"}
|
package/package.json
CHANGED
package/src/auth/auth.service.ts
CHANGED
@@ -108,69 +108,9 @@ export class AuthService {
|
|
108
108
|
async getToken(user) {
|
109
109
|
delete user.password;
|
110
110
|
|
111
|
-
const
|
112
|
-
where: { id: user.id },
|
113
|
-
include: {
|
114
|
-
person_user: {
|
115
|
-
include: {
|
116
|
-
person: {
|
117
|
-
include: {
|
118
|
-
person_address: {
|
119
|
-
include: {
|
120
|
-
country: true,
|
121
|
-
person_address_type: true,
|
122
|
-
},
|
123
|
-
},
|
124
|
-
person_contact: {
|
125
|
-
include: {
|
126
|
-
person_contact_type: true,
|
127
|
-
},
|
128
|
-
},
|
129
|
-
person_document: {
|
130
|
-
include: {
|
131
|
-
person_document_type: true,
|
132
|
-
country: true,
|
133
|
-
},
|
134
|
-
},
|
135
|
-
person_type: true,
|
136
|
-
},
|
137
|
-
},
|
138
|
-
},
|
139
|
-
},
|
140
|
-
},
|
141
|
-
});
|
142
|
-
|
143
|
-
if (!userData) {
|
144
|
-
throw new NotFoundException('User not found');
|
145
|
-
}
|
146
|
-
|
147
|
-
const person = userData.person_user?.[0]?.person;
|
148
|
-
|
149
|
-
const payload = { user: userData };
|
111
|
+
const payload = { user };
|
150
112
|
|
151
113
|
return {
|
152
|
-
id: userData.id,
|
153
|
-
name: userData.name,
|
154
|
-
email: userData.email,
|
155
|
-
cpf:
|
156
|
-
person?.person_document?.find(
|
157
|
-
(doc) => doc.person_document_type.slug === 'cpf',
|
158
|
-
)?.value || null,
|
159
|
-
telephone:
|
160
|
-
person?.person_contact?.find(
|
161
|
-
(contact) => contact.person_contact_type.slug === 'phone',
|
162
|
-
)?.value || null,
|
163
|
-
address:
|
164
|
-
person?.person_address?.map((address) => ({
|
165
|
-
street: address.street,
|
166
|
-
number: address.number,
|
167
|
-
district: address.district,
|
168
|
-
city: address.city,
|
169
|
-
state: address.state,
|
170
|
-
postal_code: address.postal_code,
|
171
|
-
country: address.country?.code || null,
|
172
|
-
type: address.person_address_type?.slug || null,
|
173
|
-
})) || [],
|
174
114
|
token: this.jwt.sign(payload),
|
175
115
|
};
|
176
116
|
}
|
@@ -348,11 +288,41 @@ export class AuthService {
|
|
348
288
|
return this.getToken(user);
|
349
289
|
}
|
350
290
|
|
351
|
-
login({ email, password }: LoginDTO) {
|
291
|
+
async login({ email, password }: LoginDTO) {
|
352
292
|
return this.loginWithEmailAndPassword(email, password);
|
353
293
|
}
|
354
294
|
|
355
|
-
verify(id: number) {
|
356
|
-
return this.prisma.user.findUnique({
|
295
|
+
async verify(id: number) {
|
296
|
+
return this.prisma.user.findUnique({
|
297
|
+
where: { id },
|
298
|
+
include: {
|
299
|
+
person_user: {
|
300
|
+
include: {
|
301
|
+
person: {
|
302
|
+
include: {
|
303
|
+
person_address: {
|
304
|
+
include: {
|
305
|
+
country: true,
|
306
|
+
person_address_type: true,
|
307
|
+
},
|
308
|
+
},
|
309
|
+
person_contact: {
|
310
|
+
include: {
|
311
|
+
person_contact_type: true,
|
312
|
+
},
|
313
|
+
},
|
314
|
+
person_document: {
|
315
|
+
include: {
|
316
|
+
person_document_type: true,
|
317
|
+
country: true,
|
318
|
+
},
|
319
|
+
},
|
320
|
+
person_type: true,
|
321
|
+
},
|
322
|
+
},
|
323
|
+
},
|
324
|
+
},
|
325
|
+
},
|
326
|
+
});
|
357
327
|
}
|
358
328
|
}
|