@ciscode/authentication-kit 1.1.5 → 1.2.0
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/README.md +455 -120
- package/dist/auth-kit.module.d.ts +6 -4
- package/dist/auth-kit.module.js +64 -13
- package/dist/config/passport.config.d.ts +2 -1
- package/dist/config/passport.config.js +64 -241
- package/dist/controllers/auth.controller.d.ts +35 -19
- package/dist/controllers/auth.controller.js +155 -488
- package/dist/controllers/permissions.controller.d.ts +10 -5
- package/dist/controllers/permissions.controller.js +40 -76
- package/dist/controllers/roles.controller.d.ts +11 -5
- package/dist/controllers/roles.controller.js +49 -66
- package/dist/controllers/users.controller.d.ts +15 -6
- package/dist/controllers/users.controller.js +56 -203
- package/dist/dtos/auth/forgot-password.dto.d.ts +3 -0
- package/dist/dtos/auth/forgot-password.dto.js +20 -0
- package/dist/dtos/auth/login.dto.d.ts +4 -0
- package/dist/dtos/auth/login.dto.js +24 -0
- package/dist/dtos/auth/refresh-token.dto.d.ts +3 -0
- package/dist/dtos/auth/refresh-token.dto.js +21 -0
- package/dist/dtos/auth/register.dto.d.ts +13 -0
- package/dist/dtos/auth/register.dto.js +56 -0
- package/dist/dtos/auth/resend-verification.dto.d.ts +3 -0
- package/dist/dtos/auth/resend-verification.dto.js +20 -0
- package/dist/dtos/auth/reset-password.dto.d.ts +4 -0
- package/dist/dtos/auth/reset-password.dto.js +25 -0
- package/dist/dtos/auth/update-user-role.dto.d.ts +3 -0
- package/dist/dtos/auth/update-user-role.dto.js +21 -0
- package/dist/dtos/auth/verify-email.dto.d.ts +3 -0
- package/dist/dtos/auth/verify-email.dto.js +20 -0
- package/dist/dtos/permission/create-permission.dto.d.ts +4 -0
- package/dist/dtos/permission/create-permission.dto.js +25 -0
- package/dist/dtos/permission/update-permission.dto.d.ts +4 -0
- package/dist/dtos/permission/update-permission.dto.js +26 -0
- package/dist/dtos/role/create-role.dto.d.ts +4 -0
- package/dist/dtos/role/create-role.dto.js +26 -0
- package/dist/dtos/role/update-role.dto.d.ts +7 -0
- package/dist/dtos/role/update-role.dto.js +35 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +11 -5
- package/dist/middleware/admin.decorator.d.ts +1 -0
- package/dist/middleware/admin.decorator.js +8 -0
- package/dist/middleware/admin.guard.d.ts +7 -0
- package/dist/middleware/admin.guard.js +35 -0
- package/dist/middleware/authenticate.guard.d.ts +5 -1
- package/dist/middleware/authenticate.guard.js +35 -8
- package/dist/middleware/role.guard.d.ts +4 -0
- package/dist/middleware/role.guard.js +29 -0
- package/dist/models/permission.model.d.ts +8 -16
- package/dist/models/permission.model.js +25 -14
- package/dist/models/role.model.d.ts +9 -28
- package/dist/models/role.model.js +26 -14
- package/dist/models/user.model.d.ts +22 -64
- package/dist/models/user.model.js +82 -41
- package/dist/repositories/permission.repository.d.ts +34 -0
- package/dist/repositories/permission.repository.js +47 -0
- package/dist/repositories/role.repository.d.ts +39 -0
- package/dist/repositories/role.repository.js +50 -0
- package/dist/repositories/user.repository.d.ts +57 -0
- package/dist/repositories/user.repository.js +71 -0
- package/dist/services/admin-role.service.d.ts +7 -0
- package/dist/services/admin-role.service.js +33 -0
- package/dist/services/auth.service.d.ts +49 -0
- package/dist/services/auth.service.js +219 -0
- package/dist/services/mail.service.d.ts +5 -0
- package/dist/services/mail.service.js +39 -0
- package/dist/services/oauth.service.d.ts +32 -0
- package/dist/services/oauth.service.js +138 -0
- package/dist/services/permissions.service.d.ts +19 -0
- package/dist/services/permissions.service.js +44 -0
- package/dist/services/roles.service.d.ts +23 -0
- package/dist/services/roles.service.js +57 -0
- package/dist/services/seed.service.d.ts +11 -0
- package/dist/services/seed.service.js +50 -0
- package/dist/services/users.service.d.ts +30 -0
- package/dist/services/users.service.js +81 -0
- package/package.json +31 -21
- package/dist/config/db.config.d.ts +0 -1
- package/dist/config/db.config.js +0 -22
- package/dist/controllers/admin.controller.d.ts +0 -4
- package/dist/controllers/admin.controller.js +0 -59
- package/dist/controllers/password-reset.controller.d.ts +0 -8
- package/dist/controllers/password-reset.controller.js +0 -146
- package/dist/middleware/auth.guard.d.ts +0 -4
- package/dist/middleware/auth.guard.js +0 -39
- package/dist/middleware/permission.guard.d.ts +0 -4
- package/dist/middleware/permission.guard.js +0 -52
- package/dist/models/client.model.d.ts +0 -54
- package/dist/models/client.model.js +0 -37
- package/dist/models/tenant.model.d.ts +0 -19
- package/dist/models/tenant.model.js +0 -15
|
@@ -11,241 +11,94 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
-
};
|
|
17
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
15
|
exports.UsersController = void 0;
|
|
19
16
|
const common_1 = require("@nestjs/common");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
17
|
+
const users_service_1 = require("../services/users.service");
|
|
18
|
+
const register_dto_1 = require("../dtos/auth/register.dto");
|
|
19
|
+
const admin_decorator_1 = require("../middleware/admin.decorator");
|
|
20
|
+
const update_user_role_dto_1 = require("../dtos/auth/update-user-role.dto");
|
|
24
21
|
let UsersController = class UsersController {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!microsoftId && !password) {
|
|
32
|
-
return res.status(400).json({ message: 'Password is required for local login.' });
|
|
33
|
-
}
|
|
34
|
-
const existingUser = await user_model_1.default.findOne({ email });
|
|
35
|
-
if (existingUser) {
|
|
36
|
-
return res.status(400).json({ message: 'User with this email already exists.' });
|
|
37
|
-
}
|
|
38
|
-
const salt = await bcryptjs_1.default.genSalt(10);
|
|
39
|
-
const hashedPassword = password ? await bcryptjs_1.default.hash(password, salt) : undefined;
|
|
40
|
-
const status = 'pending';
|
|
41
|
-
const tokenExpiryHours = parseFloat(process.env.EMAIL_TOKEN_EXPIRATION_HOURS || '0') || 24;
|
|
42
|
-
const tokenExpiration = Date.now() + tokenExpiryHours * 60 * 60 * 1000;
|
|
43
|
-
const confirmationToken = (0, node_crypto_1.randomBytes)(20).toString('hex');
|
|
44
|
-
const newUser = new user_model_1.default({
|
|
45
|
-
email,
|
|
46
|
-
password: hashedPassword,
|
|
47
|
-
name,
|
|
48
|
-
microsoftId,
|
|
49
|
-
roles,
|
|
50
|
-
jobTitle,
|
|
51
|
-
company,
|
|
52
|
-
status,
|
|
53
|
-
resetPasswordToken: confirmationToken,
|
|
54
|
-
resetPasswordExpires: tokenExpiration
|
|
55
|
-
});
|
|
56
|
-
await newUser.save();
|
|
57
|
-
const transporter = nodemailer_1.default.createTransport({
|
|
58
|
-
host: process.env.SMTP_HOST,
|
|
59
|
-
port: parseInt(process.env.SMTP_PORT, 10),
|
|
60
|
-
secure: process.env.SMTP_SECURE === 'true',
|
|
61
|
-
auth: {
|
|
62
|
-
user: process.env.SMTP_USER,
|
|
63
|
-
pass: process.env.SMTP_PASS
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const confirmationUrl = `${process.env.FRONTEND_URL}/confirm-email?token=${confirmationToken}&email=${encodeURIComponent(email)}`;
|
|
67
|
-
const mailOptions = {
|
|
68
|
-
from: process.env.FROM_EMAIL,
|
|
69
|
-
to: email,
|
|
70
|
-
subject: 'Confirm Your Email Address',
|
|
71
|
-
text: `Hello,
|
|
72
|
-
|
|
73
|
-
Thank you for registering. Please confirm your account by clicking the link below:
|
|
74
|
-
|
|
75
|
-
${confirmationUrl}
|
|
76
|
-
|
|
77
|
-
This link will expire in ${tokenExpiryHours} hour(s).
|
|
78
|
-
|
|
79
|
-
If you did not initiate this registration, please ignore this email.
|
|
80
|
-
|
|
81
|
-
Thank you.`
|
|
82
|
-
};
|
|
83
|
-
await transporter.sendMail(mailOptions);
|
|
84
|
-
return res.status(201).json({ message: 'User created and confirmation email sent successfully.', user: newUser });
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
console.error('Error creating user:', error);
|
|
88
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
89
|
-
}
|
|
22
|
+
constructor(users) {
|
|
23
|
+
this.users = users;
|
|
24
|
+
}
|
|
25
|
+
async create(dto, res) {
|
|
26
|
+
const result = await this.users.create(dto);
|
|
27
|
+
return res.status(201).json(result);
|
|
90
28
|
}
|
|
91
|
-
async
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (req.body.password) {
|
|
95
|
-
const salt = await bcryptjs_1.default.genSalt(10);
|
|
96
|
-
req.body.password = await bcryptjs_1.default.hash(req.body.password, salt);
|
|
97
|
-
}
|
|
98
|
-
const updatedUser = await user_model_1.default.findByIdAndUpdate(userId, req.body, { new: true });
|
|
99
|
-
if (!updatedUser) {
|
|
100
|
-
return res.status(404).json({ message: 'User not found.' });
|
|
101
|
-
}
|
|
102
|
-
return res.status(200).json(updatedUser);
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
console.error('Error updating user:', error);
|
|
106
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
107
|
-
}
|
|
29
|
+
async list(query, res) {
|
|
30
|
+
const result = await this.users.list(query);
|
|
31
|
+
return res.status(200).json(result);
|
|
108
32
|
}
|
|
109
|
-
async
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const deletedUser = await user_model_1.default.findByIdAndDelete(userId);
|
|
113
|
-
if (!deletedUser) {
|
|
114
|
-
return res.status(404).json({ message: 'User not found.' });
|
|
115
|
-
}
|
|
116
|
-
return res.status(200).json({ message: 'User deleted successfully.' });
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
console.error('Error deleting user:', error);
|
|
120
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
121
|
-
}
|
|
33
|
+
async ban(id, res) {
|
|
34
|
+
const result = await this.users.setBan(id, true);
|
|
35
|
+
return res.status(200).json(result);
|
|
122
36
|
}
|
|
123
|
-
async
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!email) {
|
|
127
|
-
return res.status(400).json({ message: 'Email is required.' });
|
|
128
|
-
}
|
|
129
|
-
const existingUser = await user_model_1.default.findOne({ email });
|
|
130
|
-
if (existingUser) {
|
|
131
|
-
return res.status(400).json({ message: 'User with this email already exists.' });
|
|
132
|
-
}
|
|
133
|
-
const token = (0, node_crypto_1.randomBytes)(20).toString('hex');
|
|
134
|
-
const tokenExpiration = Date.now() + 24 * 60 * 60 * 1000;
|
|
135
|
-
const newUser = new user_model_1.default({
|
|
136
|
-
email,
|
|
137
|
-
name,
|
|
138
|
-
resetPasswordToken: token,
|
|
139
|
-
resetPasswordExpires: tokenExpiration
|
|
140
|
-
});
|
|
141
|
-
await newUser.save();
|
|
142
|
-
const transporter = nodemailer_1.default.createTransport({
|
|
143
|
-
host: process.env.SMTP_HOST,
|
|
144
|
-
port: parseInt(process.env.SMTP_PORT, 10),
|
|
145
|
-
secure: process.env.SMTP_SECURE === 'true',
|
|
146
|
-
auth: {
|
|
147
|
-
user: process.env.SMTP_USER,
|
|
148
|
-
pass: process.env.SMTP_PASS
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const invitationUrl = `${process.env.FRONTEND_URL}/set-password?token=${token}&email=${encodeURIComponent(email)}`;
|
|
152
|
-
const mailOptions = {
|
|
153
|
-
from: process.env.FROM_EMAIL,
|
|
154
|
-
to: email,
|
|
155
|
-
subject: "You're invited: Set up your password",
|
|
156
|
-
text: `Hello,
|
|
157
|
-
|
|
158
|
-
You have been invited to join our platform. Please click on the link below to set your password and complete your registration:
|
|
159
|
-
|
|
160
|
-
${invitationUrl}
|
|
161
|
-
|
|
162
|
-
This link will expire in 24 hours. If you did not request this or believe it to be in error, please ignore this email.
|
|
163
|
-
|
|
164
|
-
Thank you!`
|
|
165
|
-
};
|
|
166
|
-
await transporter.sendMail(mailOptions);
|
|
167
|
-
return res.status(201).json({ message: 'Invitation sent successfully. Please check your email.' });
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
console.error('Error in createUserInvitation:', error);
|
|
171
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
172
|
-
}
|
|
37
|
+
async unban(id, res) {
|
|
38
|
+
const result = await this.users.setBan(id, false);
|
|
39
|
+
return res.status(200).json(result);
|
|
173
40
|
}
|
|
174
|
-
async
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const skip = (page - 1) * limit;
|
|
182
|
-
const [totalItems, users] = await Promise.all([
|
|
183
|
-
user_model_1.default.countDocuments(filter),
|
|
184
|
-
user_model_1.default.find(filter)
|
|
185
|
-
.populate({ path: 'roles', select: '-__v' })
|
|
186
|
-
.skip(skip)
|
|
187
|
-
.limit(limit)
|
|
188
|
-
.lean()
|
|
189
|
-
]);
|
|
190
|
-
return res.status(200).json({
|
|
191
|
-
data: users,
|
|
192
|
-
pagination: {
|
|
193
|
-
totalItems,
|
|
194
|
-
limit,
|
|
195
|
-
totalPages: Math.ceil(totalItems / limit) || 1,
|
|
196
|
-
currentPage: page,
|
|
197
|
-
hasNextPage: page * limit < totalItems,
|
|
198
|
-
hasPrevPage: page > 1
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
console.error('Error fetching users:', error);
|
|
204
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
205
|
-
}
|
|
41
|
+
async delete(id, res) {
|
|
42
|
+
const result = await this.users.delete(id);
|
|
43
|
+
return res.status(200).json(result);
|
|
44
|
+
}
|
|
45
|
+
async updateRoles(id, dto, res) {
|
|
46
|
+
const result = await this.users.updateRoles(id, dto.roles);
|
|
47
|
+
return res.status(200).json(result);
|
|
206
48
|
}
|
|
207
49
|
};
|
|
208
50
|
exports.UsersController = UsersController;
|
|
209
51
|
__decorate([
|
|
210
52
|
(0, common_1.Post)(),
|
|
211
|
-
__param(0, (0, common_1.
|
|
53
|
+
__param(0, (0, common_1.Body)()),
|
|
212
54
|
__param(1, (0, common_1.Res)()),
|
|
213
55
|
__metadata("design:type", Function),
|
|
214
|
-
__metadata("design:paramtypes", [
|
|
56
|
+
__metadata("design:paramtypes", [register_dto_1.RegisterDto, Object]),
|
|
215
57
|
__metadata("design:returntype", Promise)
|
|
216
|
-
], UsersController.prototype, "
|
|
58
|
+
], UsersController.prototype, "create", null);
|
|
217
59
|
__decorate([
|
|
218
|
-
(0, common_1.
|
|
219
|
-
__param(0, (0, common_1.
|
|
60
|
+
(0, common_1.Get)(),
|
|
61
|
+
__param(0, (0, common_1.Query)()),
|
|
220
62
|
__param(1, (0, common_1.Res)()),
|
|
221
63
|
__metadata("design:type", Function),
|
|
222
64
|
__metadata("design:paramtypes", [Object, Object]),
|
|
223
65
|
__metadata("design:returntype", Promise)
|
|
224
|
-
], UsersController.prototype, "
|
|
66
|
+
], UsersController.prototype, "list", null);
|
|
225
67
|
__decorate([
|
|
226
|
-
(0, common_1.
|
|
227
|
-
__param(0, (0, common_1.
|
|
68
|
+
(0, common_1.Patch)(':id/ban'),
|
|
69
|
+
__param(0, (0, common_1.Param)('id')),
|
|
228
70
|
__param(1, (0, common_1.Res)()),
|
|
229
71
|
__metadata("design:type", Function),
|
|
230
|
-
__metadata("design:paramtypes", [
|
|
72
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
231
73
|
__metadata("design:returntype", Promise)
|
|
232
|
-
], UsersController.prototype, "
|
|
74
|
+
], UsersController.prototype, "ban", null);
|
|
233
75
|
__decorate([
|
|
234
|
-
(0, common_1.
|
|
235
|
-
__param(0, (0, common_1.
|
|
76
|
+
(0, common_1.Patch)(':id/unban'),
|
|
77
|
+
__param(0, (0, common_1.Param)('id')),
|
|
236
78
|
__param(1, (0, common_1.Res)()),
|
|
237
79
|
__metadata("design:type", Function),
|
|
238
|
-
__metadata("design:paramtypes", [
|
|
80
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
239
81
|
__metadata("design:returntype", Promise)
|
|
240
|
-
], UsersController.prototype, "
|
|
82
|
+
], UsersController.prototype, "unban", null);
|
|
241
83
|
__decorate([
|
|
242
|
-
(0, common_1.
|
|
243
|
-
__param(0, (0, common_1.
|
|
84
|
+
(0, common_1.Delete)(':id'),
|
|
85
|
+
__param(0, (0, common_1.Param)('id')),
|
|
244
86
|
__param(1, (0, common_1.Res)()),
|
|
245
87
|
__metadata("design:type", Function),
|
|
246
|
-
__metadata("design:paramtypes", [
|
|
88
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
89
|
+
__metadata("design:returntype", Promise)
|
|
90
|
+
], UsersController.prototype, "delete", null);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, common_1.Patch)(':id/roles'),
|
|
93
|
+
__param(0, (0, common_1.Param)('id')),
|
|
94
|
+
__param(1, (0, common_1.Body)()),
|
|
95
|
+
__param(2, (0, common_1.Res)()),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [String, update_user_role_dto_1.UpdateUserRolesDto, Object]),
|
|
247
98
|
__metadata("design:returntype", Promise)
|
|
248
|
-
], UsersController.prototype, "
|
|
99
|
+
], UsersController.prototype, "updateRoles", null);
|
|
249
100
|
exports.UsersController = UsersController = __decorate([
|
|
250
|
-
(0,
|
|
101
|
+
(0, admin_decorator_1.Admin)(),
|
|
102
|
+
(0, common_1.Controller)('api/admin/users'),
|
|
103
|
+
__metadata("design:paramtypes", [users_service_1.UsersService])
|
|
251
104
|
], UsersController);
|
|
@@ -0,0 +1,20 @@
|
|
|
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.ForgotPasswordDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class ForgotPasswordDto {
|
|
15
|
+
}
|
|
16
|
+
exports.ForgotPasswordDto = ForgotPasswordDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsEmail)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], ForgotPasswordDto.prototype, "email", void 0);
|
|
@@ -0,0 +1,24 @@
|
|
|
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.LoginDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class LoginDto {
|
|
15
|
+
}
|
|
16
|
+
exports.LoginDto = LoginDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsEmail)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], LoginDto.prototype, "email", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], LoginDto.prototype, "password", void 0);
|
|
@@ -0,0 +1,21 @@
|
|
|
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.RefreshTokenDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class RefreshTokenDto {
|
|
15
|
+
}
|
|
16
|
+
exports.RefreshTokenDto = RefreshTokenDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], RefreshTokenDto.prototype, "refreshToken", void 0);
|
|
@@ -0,0 +1,56 @@
|
|
|
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.RegisterDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
class FullNameDto {
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], FullNameDto.prototype, "fname", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], FullNameDto.prototype, "lname", void 0);
|
|
25
|
+
class RegisterDto {
|
|
26
|
+
}
|
|
27
|
+
exports.RegisterDto = RegisterDto;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.ValidateNested)(),
|
|
30
|
+
(0, class_transformer_1.Type)(() => FullNameDto),
|
|
31
|
+
__metadata("design:type", FullNameDto)
|
|
32
|
+
], RegisterDto.prototype, "fullname", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.MinLength)(3),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], RegisterDto.prototype, "username", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsEmail)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], RegisterDto.prototype, "email", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
(0, class_validator_1.MinLength)(6),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], RegisterDto.prototype, "password", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, class_validator_1.IsOptional)(),
|
|
49
|
+
(0, class_validator_1.IsString)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], RegisterDto.prototype, "phoneNumber", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsOptional)(),
|
|
54
|
+
(0, class_validator_1.IsString)(),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], RegisterDto.prototype, "avatar", void 0);
|
|
@@ -0,0 +1,20 @@
|
|
|
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.ResendVerificationDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class ResendVerificationDto {
|
|
15
|
+
}
|
|
16
|
+
exports.ResendVerificationDto = ResendVerificationDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsEmail)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], ResendVerificationDto.prototype, "email", void 0);
|
|
@@ -0,0 +1,25 @@
|
|
|
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.ResetPasswordDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class ResetPasswordDto {
|
|
15
|
+
}
|
|
16
|
+
exports.ResetPasswordDto = ResetPasswordDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], ResetPasswordDto.prototype, "token", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
(0, class_validator_1.MinLength)(6),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
@@ -0,0 +1,21 @@
|
|
|
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.UpdateUserRolesDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class UpdateUserRolesDto {
|
|
15
|
+
}
|
|
16
|
+
exports.UpdateUserRolesDto = UpdateUserRolesDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsArray)(),
|
|
19
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
20
|
+
__metadata("design:type", Array)
|
|
21
|
+
], UpdateUserRolesDto.prototype, "roles", void 0);
|
|
@@ -0,0 +1,20 @@
|
|
|
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.VerifyEmailDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class VerifyEmailDto {
|
|
15
|
+
}
|
|
16
|
+
exports.VerifyEmailDto = VerifyEmailDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], VerifyEmailDto.prototype, "token", void 0);
|
|
@@ -0,0 +1,25 @@
|
|
|
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.CreatePermissionDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class CreatePermissionDto {
|
|
15
|
+
}
|
|
16
|
+
exports.CreatePermissionDto = CreatePermissionDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], CreatePermissionDto.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], CreatePermissionDto.prototype, "description", void 0);
|
|
@@ -0,0 +1,26 @@
|
|
|
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.UpdatePermissionDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class UpdatePermissionDto {
|
|
15
|
+
}
|
|
16
|
+
exports.UpdatePermissionDto = UpdatePermissionDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], UpdatePermissionDto.prototype, "name", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], UpdatePermissionDto.prototype, "description", void 0);
|