@hedhog/admin 0.46.8 → 0.46.10
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 +56 -0
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +45 -0
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +72 -5
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +162 -2
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/dto/change.dto.d.ts +7 -0
- package/dist/auth/dto/change.dto.d.ts.map +1 -0
- package/dist/auth/dto/change.dto.js +37 -0
- package/dist/auth/dto/change.dto.js.map +1 -0
- package/dist/auth/dto/email.dto.d.ts +6 -0
- package/dist/auth/dto/email.dto.d.ts.map +1 -0
- package/dist/auth/dto/email.dto.js +32 -0
- package/dist/auth/dto/email.dto.js.map +1 -0
- package/dist/auth/dto/update.dto.d.ts +14 -0
- package/dist/auth/dto/update.dto.d.ts.map +1 -0
- package/dist/auth/dto/update.dto.js +59 -0
- package/dist/auth/dto/update.dto.js.map +1 -0
- package/package.json +1 -1
- package/src/auth/auth.controller.ts +35 -0
- package/src/auth/auth.service.ts +204 -8
- package/src/auth/dto/change.dto.ts +19 -0
- package/src/auth/dto/email.dto.ts +15 -0
- package/src/auth/dto/update.dto.ts +35 -0
@@ -1,9 +1,12 @@
|
|
1
1
|
import { AuthService } from './auth.service';
|
2
|
+
import { ChangeDTO } from './dto/change.dto';
|
3
|
+
import { EmailDTO } from './dto/email.dto';
|
2
4
|
import { ForgetDTO } from './dto/forget.dto';
|
3
5
|
import { LoginDTO } from './dto/login.dto';
|
4
6
|
import { OtpDTO } from './dto/otp.dto';
|
5
7
|
import { ResetDTO } from './dto/reset.dto';
|
6
8
|
import { SignupDTO } from './dto/signup.dto';
|
9
|
+
import { UpdateUserDataDTO } from './dto/update.dto';
|
7
10
|
import { User as UserType } from './types/user.type';
|
8
11
|
export declare class AuthController {
|
9
12
|
private readonly service;
|
@@ -19,12 +22,26 @@ export declare class AuthController {
|
|
19
22
|
password: string;
|
20
23
|
}>;
|
21
24
|
login({ email, password }: LoginDTO): Promise<{
|
25
|
+
id: any;
|
26
|
+
name: any;
|
27
|
+
email: any;
|
28
|
+
cpf: any;
|
29
|
+
telephone: any;
|
30
|
+
address: any;
|
22
31
|
token: string;
|
23
32
|
} | {
|
33
|
+
name: string;
|
34
|
+
email: string;
|
24
35
|
token: string;
|
25
36
|
mfa: boolean;
|
26
37
|
}>;
|
27
38
|
otp({ token, code }: OtpDTO): Promise<{
|
39
|
+
id: any;
|
40
|
+
name: any;
|
41
|
+
email: any;
|
42
|
+
cpf: any;
|
43
|
+
telephone: any;
|
44
|
+
address: any;
|
28
45
|
token: string;
|
29
46
|
}>;
|
30
47
|
forget({ email, subject, body, }: ForgetDTO & {
|
@@ -32,9 +49,48 @@ export declare class AuthController {
|
|
32
49
|
body: string;
|
33
50
|
}): Promise<boolean>;
|
34
51
|
reset({ newPassword, confirmNewPassword, code }: ResetDTO): Promise<false | {
|
52
|
+
id: any;
|
53
|
+
name: any;
|
54
|
+
email: any;
|
55
|
+
cpf: any;
|
56
|
+
telephone: any;
|
57
|
+
address: any;
|
35
58
|
token: string;
|
36
59
|
}>;
|
37
60
|
signup({ fullName, cpf, email, password, city, district, postal_code, state, street, telephone, number, }: SignupDTO): Promise<{
|
61
|
+
id: any;
|
62
|
+
name: any;
|
63
|
+
email: any;
|
64
|
+
cpf: any;
|
65
|
+
telephone: any;
|
66
|
+
address: any;
|
67
|
+
token: string;
|
68
|
+
}>;
|
69
|
+
changePassword({ email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO): Promise<{
|
70
|
+
id: any;
|
71
|
+
name: any;
|
72
|
+
email: any;
|
73
|
+
cpf: any;
|
74
|
+
telephone: any;
|
75
|
+
address: any;
|
76
|
+
token: string;
|
77
|
+
}>;
|
78
|
+
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
79
|
+
id: any;
|
80
|
+
name: any;
|
81
|
+
email: any;
|
82
|
+
cpf: any;
|
83
|
+
telephone: any;
|
84
|
+
address: any;
|
85
|
+
token: string;
|
86
|
+
}>;
|
87
|
+
updateUserData({ email, telephone, address }: UpdateUserDataDTO): Promise<{
|
88
|
+
id: any;
|
89
|
+
name: any;
|
90
|
+
email: any;
|
91
|
+
cpf: any;
|
92
|
+
telephone: any;
|
93
|
+
address: any;
|
38
94
|
token: string;
|
39
95
|
}>;
|
40
96
|
}
|
@@ -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,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAKjC,MAAM,CAAS,EAAE,EAAE,EAAE,EAAE,QAAQ;;;;;;;;;;IAM/B,KAAK,CAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ
|
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,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AAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;;;;IAMlE,cAAc,CACV,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,iBAAiB;;;;;;;;;CAQ3D"}
|
@@ -16,10 +16,13 @@ exports.AuthController = void 0;
|
|
16
16
|
const core_1 = require("@hedhog/core");
|
17
17
|
const common_1 = require("@nestjs/common");
|
18
18
|
const auth_service_1 = require("./auth.service");
|
19
|
+
const change_dto_1 = require("./dto/change.dto");
|
20
|
+
const email_dto_1 = require("./dto/email.dto");
|
19
21
|
const login_dto_1 = require("./dto/login.dto");
|
20
22
|
const otp_dto_1 = require("./dto/otp.dto");
|
21
23
|
const reset_dto_1 = require("./dto/reset.dto");
|
22
24
|
const signup_dto_1 = require("./dto/signup.dto");
|
25
|
+
const update_dto_1 = require("./dto/update.dto");
|
23
26
|
let AuthController = class AuthController {
|
24
27
|
constructor(service) {
|
25
28
|
this.service = service;
|
@@ -62,6 +65,24 @@ let AuthController = class AuthController {
|
|
62
65
|
number,
|
63
66
|
});
|
64
67
|
}
|
68
|
+
async changePassword({ email, currentPassword, newPassword, confirmNewPassword }) {
|
69
|
+
return this.service.changePassword({
|
70
|
+
email,
|
71
|
+
currentPassword,
|
72
|
+
newPassword,
|
73
|
+
confirmNewPassword,
|
74
|
+
});
|
75
|
+
}
|
76
|
+
async changeEmail({ currentEmail, password, newEmail }) {
|
77
|
+
return this.service.changeEmail({ currentEmail, password, newEmail });
|
78
|
+
}
|
79
|
+
async updateUserData({ email, telephone, address }) {
|
80
|
+
return this.service.updateUserData({
|
81
|
+
email,
|
82
|
+
telephone,
|
83
|
+
address,
|
84
|
+
});
|
85
|
+
}
|
65
86
|
};
|
66
87
|
exports.AuthController = AuthController;
|
67
88
|
__decorate([
|
@@ -112,6 +133,30 @@ __decorate([
|
|
112
133
|
__metadata("design:paramtypes", [signup_dto_1.SignupDTO]),
|
113
134
|
__metadata("design:returntype", Promise)
|
114
135
|
], AuthController.prototype, "signup", null);
|
136
|
+
__decorate([
|
137
|
+
(0, core_1.Public)(),
|
138
|
+
(0, common_1.Post)('change-password'),
|
139
|
+
__param(0, (0, common_1.Body)()),
|
140
|
+
__metadata("design:type", Function),
|
141
|
+
__metadata("design:paramtypes", [change_dto_1.ChangeDTO]),
|
142
|
+
__metadata("design:returntype", Promise)
|
143
|
+
], AuthController.prototype, "changePassword", null);
|
144
|
+
__decorate([
|
145
|
+
(0, core_1.Public)(),
|
146
|
+
(0, common_1.Post)('change-email'),
|
147
|
+
__param(0, (0, common_1.Body)()),
|
148
|
+
__metadata("design:type", Function),
|
149
|
+
__metadata("design:paramtypes", [email_dto_1.EmailDTO]),
|
150
|
+
__metadata("design:returntype", Promise)
|
151
|
+
], AuthController.prototype, "changeEmail", null);
|
152
|
+
__decorate([
|
153
|
+
(0, core_1.Public)(),
|
154
|
+
(0, common_1.Post)('update'),
|
155
|
+
__param(0, (0, common_1.Body)()),
|
156
|
+
__metadata("design:type", Function),
|
157
|
+
__metadata("design:paramtypes", [update_dto_1.UpdateUserDataDTO]),
|
158
|
+
__metadata("design:returntype", Promise)
|
159
|
+
], AuthController.prototype, "updateUserData", null);
|
115
160
|
exports.AuthController = AuthController = __decorate([
|
116
161
|
(0, common_1.Controller)('auth'),
|
117
162
|
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => auth_service_1.AuthService))),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAkD;AAClD,2CAOwB;AACxB,iDAA6C;
|
1
|
+
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAkD;AAClD,2CAOwB;AACxB,iDAA6C;AAC7C,iDAA6C;AAC7C,+CAA2C;AAE3C,+CAA2C;AAC3C,2CAAuC;AACvC,+CAA2C;AAC3C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IAAA,aAAM,GAAE;IACR,IAAA,aAAI,EAAC,OAAO,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAA4C,oBAAQ;;2CAMtE;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,aAAI,EAAC,QAAQ,CAAC;IAEZ,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAaJ,sBAAS;;4CAeb;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,aAAI,EAAC,iBAAiB,CAAC;IAErB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCACsD,sBAAS;;oDAQvE;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,aAAI,EAAC,cAAc,CAAC;IACF,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAuC,oBAAQ;;iDAEvE;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,aAAI,EAAC,QAAQ,CAAC;IAEZ,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAgC,8BAAiB;;oDAOzD;yBArHU,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACZ,0BAAW;GAH5B,cAAc,CAsH1B"}
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import { MailService } from '@hedhog/mail';
|
2
2
|
import { PrismaService } from '@hedhog/prisma';
|
3
3
|
import { JwtService } from '@nestjs/jwt';
|
4
|
+
import { ChangeDTO } from './dto/change.dto';
|
5
|
+
import { EmailDTO } from './dto/email.dto';
|
4
6
|
import { ForgetDTO } from './dto/forget.dto';
|
5
7
|
import { LoginDTO } from './dto/login.dto';
|
6
8
|
import { OtpDTO } from './dto/otp.dto';
|
9
|
+
import { ResetDTO } from './dto/reset.dto';
|
7
10
|
import { SignupDTO } from './dto/signup.dto';
|
11
|
+
import { UpdateUserDataDTO } from './dto/update.dto';
|
8
12
|
export declare class AuthService {
|
9
13
|
private readonly prisma;
|
10
14
|
private readonly jwt;
|
@@ -14,31 +18,88 @@ export declare class AuthService {
|
|
14
18
|
generateRandomString(length: number): string;
|
15
19
|
generateRandomNumber(): number;
|
16
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;
|
17
27
|
token: string;
|
18
28
|
} | {
|
29
|
+
name: string;
|
30
|
+
email: string;
|
19
31
|
token: string;
|
20
32
|
mfa: boolean;
|
21
33
|
}>;
|
22
34
|
getToken(user: any): Promise<{
|
35
|
+
id: any;
|
36
|
+
name: any;
|
37
|
+
email: any;
|
38
|
+
cpf: any;
|
39
|
+
telephone: any;
|
40
|
+
address: any;
|
23
41
|
token: string;
|
24
42
|
}>;
|
25
43
|
forget({ email, subject, body, }: ForgetDTO & {
|
26
44
|
subject?: string;
|
27
45
|
body?: string;
|
28
46
|
}): Promise<boolean>;
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
47
|
+
updateUserData({ email, telephone, address }: UpdateUserDataDTO): Promise<{
|
48
|
+
id: any;
|
49
|
+
name: any;
|
50
|
+
email: any;
|
51
|
+
cpf: any;
|
52
|
+
telephone: any;
|
53
|
+
address: any;
|
54
|
+
token: string;
|
55
|
+
}>;
|
56
|
+
changePassword({ email, currentPassword, newPassword, confirmNewPassword, }: ChangeDTO): Promise<{
|
57
|
+
id: any;
|
58
|
+
name: any;
|
59
|
+
email: any;
|
60
|
+
cpf: any;
|
61
|
+
telephone: any;
|
62
|
+
address: any;
|
63
|
+
token: string;
|
64
|
+
}>;
|
65
|
+
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
66
|
+
id: any;
|
67
|
+
name: any;
|
68
|
+
email: any;
|
69
|
+
cpf: any;
|
70
|
+
telephone: any;
|
71
|
+
address: any;
|
72
|
+
token: string;
|
73
|
+
}>;
|
74
|
+
resetPassword({ code, newPassword, confirmNewPassword }: ResetDTO): Promise<false | {
|
75
|
+
id: any;
|
76
|
+
name: any;
|
77
|
+
email: any;
|
78
|
+
cpf: any;
|
79
|
+
telephone: any;
|
80
|
+
address: any;
|
34
81
|
token: string;
|
35
82
|
}>;
|
36
83
|
otp({ token, code }: OtpDTO): Promise<{
|
84
|
+
id: any;
|
85
|
+
name: any;
|
86
|
+
email: any;
|
87
|
+
cpf: any;
|
88
|
+
telephone: any;
|
89
|
+
address: any;
|
37
90
|
token: string;
|
38
91
|
}>;
|
39
92
|
login({ email, password }: LoginDTO): Promise<{
|
93
|
+
id: any;
|
94
|
+
name: any;
|
95
|
+
email: any;
|
96
|
+
cpf: any;
|
97
|
+
telephone: any;
|
98
|
+
address: any;
|
40
99
|
token: string;
|
41
100
|
} | {
|
101
|
+
name: string;
|
102
|
+
email: string;
|
42
103
|
token: string;
|
43
104
|
mfa: boolean;
|
44
105
|
}>;
|
@@ -53,6 +114,12 @@ export declare class AuthService {
|
|
53
114
|
password: string;
|
54
115
|
}, null, import("@prisma/client/runtime/library").DefaultArgs>;
|
55
116
|
signup({ fullName, cpf, telephone, city, district, postal_code, state, street, number, email, password, }: SignupDTO): Promise<{
|
117
|
+
id: any;
|
118
|
+
name: any;
|
119
|
+
email: any;
|
120
|
+
cpf: any;
|
121
|
+
telephone: any;
|
122
|
+
address: any;
|
56
123
|
token: string;
|
57
124
|
}>;
|
58
125
|
}
|
@@ -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;
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,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AC,EACnB,KAAK,EACL,eAAe,EACf,WAAW,EACX,kBAAkB,GACnB,EAAE,SAAS;;;;;;;;;IA4BN,WAAW,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;;;;IA6B1D,aAAa,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,QAAQ;;;;;;;;;IAkCjE,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;;;;;;;IA0BjC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;;;;;;;;;IAInC,MAAM,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAIX,MAAM,CAAC,EACX,QAAQ,EACR,GAAG,EACH,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE,SAAS;;;;;;;;;CAoIb"}
|
@@ -80,6 +80,8 @@ let AuthService = class AuthService {
|
|
80
80
|
});
|
81
81
|
}
|
82
82
|
return {
|
83
|
+
name: user.name,
|
84
|
+
email: user.email,
|
83
85
|
token: this.jwt.sign({
|
84
86
|
id: user.id,
|
85
87
|
mfa: user.multifactor_id,
|
@@ -89,9 +91,58 @@ let AuthService = class AuthService {
|
|
89
91
|
}
|
90
92
|
}
|
91
93
|
async getToken(user) {
|
94
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
92
95
|
delete user.password;
|
93
|
-
const
|
96
|
+
const userData = await this.prisma.user.findUnique({
|
97
|
+
where: { id: user.id },
|
98
|
+
include: {
|
99
|
+
person: {
|
100
|
+
include: {
|
101
|
+
person_address: {
|
102
|
+
include: {
|
103
|
+
country: true,
|
104
|
+
person_address_type: true,
|
105
|
+
},
|
106
|
+
},
|
107
|
+
person_contact: {
|
108
|
+
include: {
|
109
|
+
person_contact_type: true,
|
110
|
+
},
|
111
|
+
},
|
112
|
+
person_document: {
|
113
|
+
include: {
|
114
|
+
person_document_type: true,
|
115
|
+
country: true,
|
116
|
+
},
|
117
|
+
},
|
118
|
+
type: true,
|
119
|
+
},
|
120
|
+
},
|
121
|
+
},
|
122
|
+
});
|
123
|
+
if (!userData) {
|
124
|
+
throw new common_1.NotFoundException('User not found');
|
125
|
+
}
|
126
|
+
const payload = { user: userData };
|
94
127
|
return {
|
128
|
+
id: userData.id,
|
129
|
+
name: userData.name,
|
130
|
+
email: userData.email,
|
131
|
+
cpf: ((_c = (_b = (_a = userData.person) === null || _a === void 0 ? void 0 : _a.person_document) === null || _b === void 0 ? void 0 : _b.find((doc) => doc.person_document_type.slug === 'cpf')) === null || _c === void 0 ? void 0 : _c.value) || null,
|
132
|
+
telephone: ((_f = (_e = (_d = userData.person) === null || _d === void 0 ? void 0 : _d.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,
|
133
|
+
address: ((_h = (_g = userData.person) === null || _g === void 0 ? void 0 : _g.person_address) === null || _h === void 0 ? void 0 : _h.map((address) => {
|
134
|
+
var _a, _b;
|
135
|
+
return ({
|
136
|
+
street: address.street,
|
137
|
+
number: address.number,
|
138
|
+
district: address.district,
|
139
|
+
city: address.city,
|
140
|
+
state: address.state,
|
141
|
+
postal_code: address.postal_code,
|
142
|
+
country: ((_a = address.country) === null || _a === void 0 ? void 0 : _a.code) || null,
|
143
|
+
type: ((_b = address.person_address_type) === null || _b === void 0 ? void 0 : _b.slug) || null,
|
144
|
+
});
|
145
|
+
})) || [],
|
95
146
|
token: this.jwt.sign(payload),
|
96
147
|
};
|
97
148
|
}
|
@@ -124,7 +175,116 @@ let AuthService = class AuthService {
|
|
124
175
|
});
|
125
176
|
return true;
|
126
177
|
}
|
127
|
-
async
|
178
|
+
async updateUserData({ email, telephone, address }) {
|
179
|
+
const user = await this.prisma.user.findUnique({
|
180
|
+
where: { email },
|
181
|
+
include: { person: true },
|
182
|
+
});
|
183
|
+
if (!user) {
|
184
|
+
throw new common_1.NotFoundException('User not found');
|
185
|
+
}
|
186
|
+
const personId = user.person.id;
|
187
|
+
if (!personId) {
|
188
|
+
throw new common_1.NotFoundException('Person data not found for this user');
|
189
|
+
}
|
190
|
+
if (telephone) {
|
191
|
+
const contactType = await this.prisma.person_contact_type.findFirst({
|
192
|
+
where: { slug: 'phone' },
|
193
|
+
});
|
194
|
+
if (!contactType) {
|
195
|
+
throw new common_1.BadRequestException('Phone contact type not found');
|
196
|
+
}
|
197
|
+
const existingContact = await this.prisma.person_contact.findFirst({
|
198
|
+
where: { person_id: personId, person_contact_type_id: contactType.id },
|
199
|
+
});
|
200
|
+
if (existingContact) {
|
201
|
+
await this.prisma.person_contact.update({
|
202
|
+
where: { id: existingContact.id },
|
203
|
+
data: { value: telephone },
|
204
|
+
});
|
205
|
+
}
|
206
|
+
else {
|
207
|
+
await this.prisma.person_contact.create({
|
208
|
+
data: {
|
209
|
+
value: telephone,
|
210
|
+
person_id: personId,
|
211
|
+
person_contact_type_id: contactType.id,
|
212
|
+
},
|
213
|
+
});
|
214
|
+
}
|
215
|
+
}
|
216
|
+
if (address) {
|
217
|
+
const addressType = await this.prisma.person_address_type.findFirst({
|
218
|
+
where: { slug: 'residential' },
|
219
|
+
});
|
220
|
+
if (!addressType) {
|
221
|
+
throw new common_1.BadRequestException('Residential address type not found');
|
222
|
+
}
|
223
|
+
const existingAddress = await this.prisma.person_address.findFirst({
|
224
|
+
where: { person_id: personId, person_address_type_id: addressType.id },
|
225
|
+
});
|
226
|
+
if (existingAddress) {
|
227
|
+
await this.prisma.person_address.update({
|
228
|
+
where: { id: existingAddress.id },
|
229
|
+
data: Object.assign({}, address),
|
230
|
+
});
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
await this.prisma.person_address.create({
|
234
|
+
data: Object.assign(Object.assign({}, address), { person_id: personId, person_address_type_id: addressType.id }),
|
235
|
+
});
|
236
|
+
}
|
237
|
+
}
|
238
|
+
const newUser = await this.prisma.user.findUnique({
|
239
|
+
where: { email },
|
240
|
+
});
|
241
|
+
return this.getToken(newUser);
|
242
|
+
}
|
243
|
+
async changePassword({ email, currentPassword, newPassword, confirmNewPassword, }) {
|
244
|
+
if (newPassword !== confirmNewPassword) {
|
245
|
+
throw new common_1.BadRequestException("Passwords don't match");
|
246
|
+
}
|
247
|
+
const user = await this.prisma.user.findFirst({
|
248
|
+
where: { email },
|
249
|
+
});
|
250
|
+
if (!(await (0, bcrypt_1.compare)(currentPassword, user.password))) {
|
251
|
+
throw new common_1.NotFoundException('Invalid password');
|
252
|
+
}
|
253
|
+
const salt = await (0, bcrypt_1.genSalt)();
|
254
|
+
const password = await (0, bcrypt_1.hash)(newPassword, salt);
|
255
|
+
const newUser = await this.prisma.user.update({
|
256
|
+
where: {
|
257
|
+
id: user.id,
|
258
|
+
},
|
259
|
+
data: {
|
260
|
+
password,
|
261
|
+
},
|
262
|
+
});
|
263
|
+
return this.getToken(newUser);
|
264
|
+
}
|
265
|
+
async changeEmail({ currentEmail, password, newEmail }) {
|
266
|
+
const user = await this.prisma.user.findUnique({
|
267
|
+
where: { email: currentEmail },
|
268
|
+
});
|
269
|
+
if (!user) {
|
270
|
+
throw new common_1.NotFoundException('User not found');
|
271
|
+
}
|
272
|
+
if (!(await (0, bcrypt_1.compare)(password, user.password))) {
|
273
|
+
throw new common_1.BadRequestException('Invalid password');
|
274
|
+
}
|
275
|
+
const existingUser = await this.prisma.user.findUnique({
|
276
|
+
where: { email: newEmail },
|
277
|
+
});
|
278
|
+
if (existingUser) {
|
279
|
+
throw new common_1.ConflictException('Email is already in use');
|
280
|
+
}
|
281
|
+
const newUser = await this.prisma.user.update({
|
282
|
+
where: { email: currentEmail },
|
283
|
+
data: { email: newEmail },
|
284
|
+
});
|
285
|
+
return this.getToken(newUser);
|
286
|
+
}
|
287
|
+
async resetPassword({ code, newPassword, confirmNewPassword }) {
|
128
288
|
if (newPassword !== confirmNewPassword) {
|
129
289
|
throw new common_1.BadRequestException("Passwords don't match");
|
130
290
|
}
|
@@ -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,2CAMwB;AACxB,qCAAyC;AACzC,mCAAgD;AAEhD,wCAAwC;AACxC,8CAAoD;AAKpD,yEAAgE;AAGzD,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,MAAqB,EAErB,GAAe,EAEf,IAAiB;QAJjB,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,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,oBAAoB;QAClB,MAAM,GAAG,GAAG,MAAM,CAAC;QACnB,MAAM,GAAG,GAAG,MAAM,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAA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CACf"}
|
@@ -0,0 +1,37 @@
|
|
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.ChangeDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class ChangeDTO {
|
15
|
+
}
|
16
|
+
exports.ChangeDTO = ChangeDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
19
|
+
(0, class_validator_1.MinLength)(8),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], ChangeDTO.prototype, "newPassword", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
24
|
+
(0, class_validator_1.MinLength)(8),
|
25
|
+
__metadata("design:type", String)
|
26
|
+
], ChangeDTO.prototype, "confirmNewPassword", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
29
|
+
(0, class_validator_1.MinLength)(8),
|
30
|
+
__metadata("design:type", String)
|
31
|
+
], ChangeDTO.prototype, "currentPassword", void 0);
|
32
|
+
__decorate([
|
33
|
+
(0, class_validator_1.IsNotEmpty)(),
|
34
|
+
(0, class_validator_1.IsEmail)(),
|
35
|
+
__metadata("design:type", String)
|
36
|
+
], ChangeDTO.prototype, "email", void 0);
|
37
|
+
//# sourceMappingURL=change.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"change.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/change.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAiE;AAEjE,MAAa,SAAS;CAgBrB;AAhBD,8BAgBC;AAbC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;8CACO;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;qDACc;AAI3B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;kDACW;AAIxB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;wCACI"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"email.dto.d.ts","sourceRoot":"","sources":["../../../src/auth/dto/email.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ;IAGnB,YAAY,EAAE,MAAM,CAAC;IAIrB,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
@@ -0,0 +1,32 @@
|
|
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.EmailDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class EmailDTO {
|
15
|
+
}
|
16
|
+
exports.EmailDTO = EmailDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
19
|
+
(0, class_validator_1.IsEmail)(),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], EmailDTO.prototype, "currentEmail", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
24
|
+
(0, class_validator_1.MinLength)(8),
|
25
|
+
__metadata("design:type", String)
|
26
|
+
], EmailDTO.prototype, "password", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
29
|
+
(0, class_validator_1.IsEmail)(),
|
30
|
+
__metadata("design:type", String)
|
31
|
+
], EmailDTO.prototype, "newEmail", void 0);
|
32
|
+
//# sourceMappingURL=email.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"email.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/email.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAiE;AAEjE,MAAa,QAAQ;CAYpB;AAZD,4BAYC;AATC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;8CACW;AAIrB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;0CACI;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;0CACO"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare class UpdateUserDataDTO {
|
2
|
+
email: string;
|
3
|
+
telephone?: string;
|
4
|
+
address?: AddressDTO;
|
5
|
+
}
|
6
|
+
export declare class AddressDTO {
|
7
|
+
street: string;
|
8
|
+
number: string;
|
9
|
+
district: string;
|
10
|
+
city: string;
|
11
|
+
state: string;
|
12
|
+
postal_code: string;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=update.dto.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/auth/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAiB;IAE5B,KAAK,EAAE,MAAM,CAAC;IAKd,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,qBAAa,UAAU;IAErB,MAAM,EAAE,MAAM,CAAC;IAGf,MAAM,EAAE,MAAM,CAAC;IAGf,QAAQ,EAAE,MAAM,CAAC;IAGjB,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAId,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
@@ -0,0 +1,59 @@
|
|
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.AddressDTO = exports.UpdateUserDataDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class UpdateUserDataDTO {
|
15
|
+
}
|
16
|
+
exports.UpdateUserDataDTO = UpdateUserDataDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsEmail)({}, { message: 'Invalid email format' }),
|
19
|
+
__metadata("design:type", String)
|
20
|
+
], UpdateUserDataDTO.prototype, "email", void 0);
|
21
|
+
__decorate([
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
23
|
+
(0, class_validator_1.IsString)(),
|
24
|
+
(0, class_validator_1.Length)(10, 15, { message: 'Telephone must be between 10 and 15 characters' }),
|
25
|
+
__metadata("design:type", String)
|
26
|
+
], UpdateUserDataDTO.prototype, "telephone", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
29
|
+
__metadata("design:type", AddressDTO)
|
30
|
+
], UpdateUserDataDTO.prototype, "address", void 0);
|
31
|
+
class AddressDTO {
|
32
|
+
}
|
33
|
+
exports.AddressDTO = AddressDTO;
|
34
|
+
__decorate([
|
35
|
+
(0, class_validator_1.IsString)(),
|
36
|
+
__metadata("design:type", String)
|
37
|
+
], AddressDTO.prototype, "street", void 0);
|
38
|
+
__decorate([
|
39
|
+
(0, class_validator_1.IsString)(),
|
40
|
+
__metadata("design:type", String)
|
41
|
+
], AddressDTO.prototype, "number", void 0);
|
42
|
+
__decorate([
|
43
|
+
(0, class_validator_1.IsString)(),
|
44
|
+
__metadata("design:type", String)
|
45
|
+
], AddressDTO.prototype, "district", void 0);
|
46
|
+
__decorate([
|
47
|
+
(0, class_validator_1.IsString)(),
|
48
|
+
__metadata("design:type", String)
|
49
|
+
], AddressDTO.prototype, "city", void 0);
|
50
|
+
__decorate([
|
51
|
+
(0, class_validator_1.IsString)(),
|
52
|
+
__metadata("design:type", String)
|
53
|
+
], AddressDTO.prototype, "state", void 0);
|
54
|
+
__decorate([
|
55
|
+
(0, class_validator_1.IsString)(),
|
56
|
+
(0, class_validator_1.Length)(8, 9, { message: 'Postal code must be between 8 and 9 characters' }),
|
57
|
+
__metadata("design:type", String)
|
58
|
+
], AddressDTO.prototype, "postal_code", void 0);
|
59
|
+
//# sourceMappingURL=update.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwE;AAExE,MAAa,iBAAiB;CAW7B;AAXD,8CAWC;AATC;IADC,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;;gDACnC;AAKd;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE,CAAC;;oDAC3D;AAGnB;IADC,IAAA,4BAAU,GAAE;8BACH,UAAU;kDAAC;AAGvB,MAAa,UAAU;CAmBtB;AAnBD,gCAmBC;AAjBC;IADC,IAAA,0BAAQ,GAAE;;0CACI;AAGf;IADC,IAAA,0BAAQ,GAAE;;0CACI;AAGf;IADC,IAAA,0BAAQ,GAAE;;4CACM;AAGjB;IADC,IAAA,0BAAQ,GAAE;;wCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;yCACG;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE,CAAC;;+CACxD"}
|
package/package.json
CHANGED
@@ -8,11 +8,14 @@ import {
|
|
8
8
|
Post,
|
9
9
|
} from '@nestjs/common';
|
10
10
|
import { AuthService } from './auth.service';
|
11
|
+
import { ChangeDTO } from './dto/change.dto';
|
12
|
+
import { EmailDTO } from './dto/email.dto';
|
11
13
|
import { ForgetDTO } from './dto/forget.dto';
|
12
14
|
import { LoginDTO } from './dto/login.dto';
|
13
15
|
import { OtpDTO } from './dto/otp.dto';
|
14
16
|
import { ResetDTO } from './dto/reset.dto';
|
15
17
|
import { SignupDTO } from './dto/signup.dto';
|
18
|
+
import { UpdateUserDataDTO } from './dto/update.dto';
|
16
19
|
import { User as UserType } from './types/user.type';
|
17
20
|
|
18
21
|
@Controller('auth')
|
@@ -102,4 +105,36 @@ export class AuthController {
|
|
102
105
|
number,
|
103
106
|
});
|
104
107
|
}
|
108
|
+
|
109
|
+
@Public()
|
110
|
+
@Post('change-password')
|
111
|
+
async changePassword(
|
112
|
+
@Body()
|
113
|
+
{ email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO,
|
114
|
+
) {
|
115
|
+
return this.service.changePassword({
|
116
|
+
email,
|
117
|
+
currentPassword,
|
118
|
+
newPassword,
|
119
|
+
confirmNewPassword,
|
120
|
+
});
|
121
|
+
}
|
122
|
+
|
123
|
+
@Public()
|
124
|
+
@Post('change-email')
|
125
|
+
async changeEmail(@Body() { currentEmail, password, newEmail }: EmailDTO) {
|
126
|
+
return this.service.changeEmail({ currentEmail, password, newEmail });
|
127
|
+
}
|
128
|
+
|
129
|
+
@Public()
|
130
|
+
@Post('update')
|
131
|
+
async updateUserData(
|
132
|
+
@Body() { email, telephone, address }: UpdateUserDataDTO,
|
133
|
+
) {
|
134
|
+
return this.service.updateUserData({
|
135
|
+
email,
|
136
|
+
telephone,
|
137
|
+
address,
|
138
|
+
});
|
139
|
+
}
|
105
140
|
}
|
package/src/auth/auth.service.ts
CHANGED
@@ -2,6 +2,7 @@ import { MailService } from '@hedhog/mail';
|
|
2
2
|
import { PrismaService } from '@hedhog/prisma';
|
3
3
|
import {
|
4
4
|
BadRequestException,
|
5
|
+
ConflictException,
|
5
6
|
forwardRef,
|
6
7
|
Inject,
|
7
8
|
Injectable,
|
@@ -12,10 +13,14 @@ import { compare, genSalt, hash } from 'bcrypt';
|
|
12
13
|
import { User } from 'hcode-core';
|
13
14
|
import { getBody } from './consts/body';
|
14
15
|
import { SUBJECT_RECOVERY } from './consts/subject';
|
16
|
+
import { ChangeDTO } from './dto/change.dto';
|
17
|
+
import { EmailDTO } from './dto/email.dto';
|
15
18
|
import { ForgetDTO } from './dto/forget.dto';
|
16
19
|
import { LoginDTO } from './dto/login.dto';
|
17
20
|
import { OtpDTO } from './dto/otp.dto';
|
21
|
+
import { ResetDTO } from './dto/reset.dto';
|
18
22
|
import { SignupDTO } from './dto/signup.dto';
|
23
|
+
import { UpdateUserDataDTO } from './dto/update.dto';
|
19
24
|
import { MultifactorType } from './enums/multifactor-type.enum';
|
20
25
|
|
21
26
|
@Injectable()
|
@@ -91,6 +96,8 @@ export class AuthService {
|
|
91
96
|
}
|
92
97
|
|
93
98
|
return {
|
99
|
+
name: user.name,
|
100
|
+
email: user.email,
|
94
101
|
token: this.jwt.sign({
|
95
102
|
id: user.id,
|
96
103
|
mfa: user.multifactor_id,
|
@@ -103,9 +110,63 @@ export class AuthService {
|
|
103
110
|
async getToken(user) {
|
104
111
|
delete user.password;
|
105
112
|
|
106
|
-
const
|
113
|
+
const userData: any = await this.prisma.user.findUnique({
|
114
|
+
where: { id: user.id },
|
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
|
+
type: true,
|
136
|
+
},
|
137
|
+
},
|
138
|
+
},
|
139
|
+
});
|
140
|
+
|
141
|
+
if (!userData) {
|
142
|
+
throw new NotFoundException('User not found');
|
143
|
+
}
|
144
|
+
|
145
|
+
const payload = { user: userData };
|
107
146
|
|
108
147
|
return {
|
148
|
+
id: userData.id,
|
149
|
+
name: userData.name,
|
150
|
+
email: userData.email,
|
151
|
+
cpf:
|
152
|
+
userData.person?.person_document?.find(
|
153
|
+
(doc) => doc.person_document_type.slug === 'cpf',
|
154
|
+
)?.value || null,
|
155
|
+
telephone:
|
156
|
+
userData.person?.person_contact?.find(
|
157
|
+
(contact) => contact.person_contact_type.slug === 'phone',
|
158
|
+
)?.value || null,
|
159
|
+
address:
|
160
|
+
userData.person?.person_address?.map((address) => ({
|
161
|
+
street: address.street,
|
162
|
+
number: address.number,
|
163
|
+
district: address.district,
|
164
|
+
city: address.city,
|
165
|
+
state: address.state,
|
166
|
+
postal_code: address.postal_code,
|
167
|
+
country: address.country?.code || null,
|
168
|
+
type: address.person_address_type?.slug || null,
|
169
|
+
})) || [],
|
109
170
|
token: this.jwt.sign(payload),
|
110
171
|
};
|
111
172
|
}
|
@@ -157,15 +218,150 @@ export class AuthService {
|
|
157
218
|
return true;
|
158
219
|
}
|
159
220
|
|
160
|
-
async
|
161
|
-
|
221
|
+
async updateUserData({ email, telephone, address }: UpdateUserDataDTO) {
|
222
|
+
const user = await this.prisma.user.findUnique({
|
223
|
+
where: { email },
|
224
|
+
include: { person: true },
|
225
|
+
});
|
226
|
+
|
227
|
+
if (!user) {
|
228
|
+
throw new NotFoundException('User not found');
|
229
|
+
}
|
230
|
+
|
231
|
+
const personId = (user.person as any).id;
|
232
|
+
|
233
|
+
if (!personId) {
|
234
|
+
throw new NotFoundException('Person data not found for this user');
|
235
|
+
}
|
236
|
+
|
237
|
+
if (telephone) {
|
238
|
+
const contactType = await this.prisma.person_contact_type.findFirst({
|
239
|
+
where: { slug: 'phone' },
|
240
|
+
});
|
241
|
+
|
242
|
+
if (!contactType) {
|
243
|
+
throw new BadRequestException('Phone contact type not found');
|
244
|
+
}
|
245
|
+
|
246
|
+
const existingContact = await this.prisma.person_contact.findFirst({
|
247
|
+
where: { person_id: personId, person_contact_type_id: contactType.id },
|
248
|
+
});
|
249
|
+
|
250
|
+
if (existingContact) {
|
251
|
+
await this.prisma.person_contact.update({
|
252
|
+
where: { id: existingContact.id },
|
253
|
+
data: { value: telephone },
|
254
|
+
});
|
255
|
+
} else {
|
256
|
+
await this.prisma.person_contact.create({
|
257
|
+
data: {
|
258
|
+
value: telephone,
|
259
|
+
person_id: personId,
|
260
|
+
person_contact_type_id: contactType.id,
|
261
|
+
},
|
262
|
+
});
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
if (address) {
|
267
|
+
const addressType = await this.prisma.person_address_type.findFirst({
|
268
|
+
where: { slug: 'residential' },
|
269
|
+
});
|
270
|
+
|
271
|
+
if (!addressType) {
|
272
|
+
throw new BadRequestException('Residential address type not found');
|
273
|
+
}
|
274
|
+
|
275
|
+
const existingAddress = await this.prisma.person_address.findFirst({
|
276
|
+
where: { person_id: personId, person_address_type_id: addressType.id },
|
277
|
+
});
|
278
|
+
|
279
|
+
if (existingAddress) {
|
280
|
+
await this.prisma.person_address.update({
|
281
|
+
where: { id: existingAddress.id },
|
282
|
+
data: { ...address },
|
283
|
+
});
|
284
|
+
} else {
|
285
|
+
await this.prisma.person_address.create({
|
286
|
+
data: {
|
287
|
+
...address,
|
288
|
+
person_id: personId,
|
289
|
+
person_address_type_id: addressType.id,
|
290
|
+
},
|
291
|
+
});
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
const newUser = await this.prisma.user.findUnique({
|
296
|
+
where: { email },
|
297
|
+
});
|
298
|
+
|
299
|
+
return this.getToken(newUser);
|
300
|
+
}
|
301
|
+
|
302
|
+
async changePassword({
|
303
|
+
email,
|
304
|
+
currentPassword,
|
162
305
|
newPassword,
|
163
306
|
confirmNewPassword,
|
164
|
-
}: {
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
307
|
+
}: ChangeDTO) {
|
308
|
+
if (newPassword !== confirmNewPassword) {
|
309
|
+
throw new BadRequestException("Passwords don't match");
|
310
|
+
}
|
311
|
+
|
312
|
+
const user = await this.prisma.user.findFirst({
|
313
|
+
where: { email },
|
314
|
+
});
|
315
|
+
|
316
|
+
if (!(await compare(currentPassword, user.password))) {
|
317
|
+
throw new NotFoundException('Invalid password');
|
318
|
+
}
|
319
|
+
|
320
|
+
const salt = await genSalt();
|
321
|
+
const password = await hash(newPassword, salt);
|
322
|
+
|
323
|
+
const newUser = await this.prisma.user.update({
|
324
|
+
where: {
|
325
|
+
id: user.id,
|
326
|
+
},
|
327
|
+
data: {
|
328
|
+
password,
|
329
|
+
},
|
330
|
+
});
|
331
|
+
|
332
|
+
return this.getToken(newUser);
|
333
|
+
}
|
334
|
+
|
335
|
+
async changeEmail({ currentEmail, password, newEmail }: EmailDTO) {
|
336
|
+
const user = await this.prisma.user.findUnique({
|
337
|
+
where: { email: currentEmail },
|
338
|
+
});
|
339
|
+
|
340
|
+
if (!user) {
|
341
|
+
throw new NotFoundException('User not found');
|
342
|
+
}
|
343
|
+
|
344
|
+
if (!(await compare(password, user.password))) {
|
345
|
+
throw new BadRequestException('Invalid password');
|
346
|
+
}
|
347
|
+
|
348
|
+
const existingUser = await this.prisma.user.findUnique({
|
349
|
+
where: { email: newEmail },
|
350
|
+
});
|
351
|
+
|
352
|
+
if (existingUser) {
|
353
|
+
throw new ConflictException('Email is already in use');
|
354
|
+
}
|
355
|
+
|
356
|
+
const newUser = await this.prisma.user.update({
|
357
|
+
where: { email: currentEmail },
|
358
|
+
data: { email: newEmail },
|
359
|
+
});
|
360
|
+
|
361
|
+
return this.getToken(newUser);
|
362
|
+
}
|
363
|
+
|
364
|
+
async resetPassword({ code, newPassword, confirmNewPassword }: ResetDTO) {
|
169
365
|
if (newPassword !== confirmNewPassword) {
|
170
366
|
throw new BadRequestException("Passwords don't match");
|
171
367
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { IsEmail, IsNotEmpty, MinLength } from 'class-validator';
|
2
|
+
|
3
|
+
export class ChangeDTO {
|
4
|
+
@IsNotEmpty()
|
5
|
+
@MinLength(8)
|
6
|
+
newPassword: string;
|
7
|
+
|
8
|
+
@IsNotEmpty()
|
9
|
+
@MinLength(8)
|
10
|
+
confirmNewPassword: string;
|
11
|
+
|
12
|
+
@IsNotEmpty()
|
13
|
+
@MinLength(8)
|
14
|
+
currentPassword: string;
|
15
|
+
|
16
|
+
@IsNotEmpty()
|
17
|
+
@IsEmail()
|
18
|
+
email: string;
|
19
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { IsEmail, IsNotEmpty, MinLength } from 'class-validator';
|
2
|
+
|
3
|
+
export class EmailDTO {
|
4
|
+
@IsNotEmpty()
|
5
|
+
@IsEmail()
|
6
|
+
currentEmail: string;
|
7
|
+
|
8
|
+
@IsNotEmpty()
|
9
|
+
@MinLength(8)
|
10
|
+
password: string;
|
11
|
+
|
12
|
+
@IsNotEmpty()
|
13
|
+
@IsEmail()
|
14
|
+
newEmail: string;
|
15
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { IsEmail, IsOptional, IsString, Length } from 'class-validator';
|
2
|
+
|
3
|
+
export class UpdateUserDataDTO {
|
4
|
+
@IsEmail({}, { message: 'Invalid email format' })
|
5
|
+
email: string;
|
6
|
+
|
7
|
+
@IsOptional()
|
8
|
+
@IsString()
|
9
|
+
@Length(10, 15, { message: 'Telephone must be between 10 and 15 characters' })
|
10
|
+
telephone?: string;
|
11
|
+
|
12
|
+
@IsOptional()
|
13
|
+
address?: AddressDTO;
|
14
|
+
}
|
15
|
+
|
16
|
+
export class AddressDTO {
|
17
|
+
@IsString()
|
18
|
+
street: string;
|
19
|
+
|
20
|
+
@IsString()
|
21
|
+
number: string;
|
22
|
+
|
23
|
+
@IsString()
|
24
|
+
district: string;
|
25
|
+
|
26
|
+
@IsString()
|
27
|
+
city: string;
|
28
|
+
|
29
|
+
@IsString()
|
30
|
+
state: string;
|
31
|
+
|
32
|
+
@IsString()
|
33
|
+
@Length(8, 9, { message: 'Postal code must be between 8 and 9 characters' })
|
34
|
+
postal_code: string;
|
35
|
+
}
|