@ciscode/authentication-kit 1.1.6 → 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 -7
- package/dist/controllers/users.controller.js +52 -227
- 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,269 +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
|
|
24
|
-
const authenticate_guard_1 = require("../middleware/authenticate.guard");
|
|
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");
|
|
25
21
|
let UsersController = class UsersController {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!microsoftId && !password) {
|
|
33
|
-
return res.status(400).json({ message: 'Password is required for local login.' });
|
|
34
|
-
}
|
|
35
|
-
const existingUser = await user_model_1.default.findOne({ email });
|
|
36
|
-
if (existingUser) {
|
|
37
|
-
return res.status(400).json({ message: 'User with this email already exists.' });
|
|
38
|
-
}
|
|
39
|
-
const salt = await bcryptjs_1.default.genSalt(10);
|
|
40
|
-
const hashedPassword = password ? await bcryptjs_1.default.hash(password, salt) : undefined;
|
|
41
|
-
const status = 'pending';
|
|
42
|
-
const tokenExpiryHours = parseFloat(process.env.EMAIL_TOKEN_EXPIRATION_HOURS || '0') || 24;
|
|
43
|
-
const tokenExpiration = Date.now() + tokenExpiryHours * 60 * 60 * 1000;
|
|
44
|
-
const confirmationToken = (0, node_crypto_1.randomBytes)(20).toString('hex');
|
|
45
|
-
const newUser = new user_model_1.default({
|
|
46
|
-
email,
|
|
47
|
-
password: hashedPassword,
|
|
48
|
-
name,
|
|
49
|
-
microsoftId,
|
|
50
|
-
roles,
|
|
51
|
-
jobTitle,
|
|
52
|
-
company,
|
|
53
|
-
status,
|
|
54
|
-
resetPasswordToken: confirmationToken,
|
|
55
|
-
resetPasswordExpires: tokenExpiration
|
|
56
|
-
});
|
|
57
|
-
await newUser.save();
|
|
58
|
-
const transporter = nodemailer_1.default.createTransport({
|
|
59
|
-
host: process.env.SMTP_HOST,
|
|
60
|
-
port: parseInt(process.env.SMTP_PORT, 10),
|
|
61
|
-
secure: process.env.SMTP_SECURE === 'true',
|
|
62
|
-
auth: {
|
|
63
|
-
user: process.env.SMTP_USER,
|
|
64
|
-
pass: process.env.SMTP_PASS
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const confirmationUrl = `${process.env.FRONTEND_URL}/confirm-email?token=${confirmationToken}&email=${encodeURIComponent(email)}`;
|
|
68
|
-
const mailOptions = {
|
|
69
|
-
from: process.env.FROM_EMAIL,
|
|
70
|
-
to: email,
|
|
71
|
-
subject: 'Confirm Your Email Address',
|
|
72
|
-
text: `Hello,
|
|
73
|
-
|
|
74
|
-
Thank you for registering. Please confirm your account by clicking the link below:
|
|
75
|
-
|
|
76
|
-
${confirmationUrl}
|
|
77
|
-
|
|
78
|
-
This link will expire in ${tokenExpiryHours} hour(s).
|
|
79
|
-
|
|
80
|
-
If you did not initiate this registration, please ignore this email.
|
|
81
|
-
|
|
82
|
-
Thank you.`
|
|
83
|
-
};
|
|
84
|
-
await transporter.sendMail(mailOptions);
|
|
85
|
-
return res.status(201).json({ message: 'User created and confirmation email sent successfully.', user: newUser });
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
console.error('Error creating user:', error);
|
|
89
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
90
|
-
}
|
|
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);
|
|
91
28
|
}
|
|
92
|
-
async
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (req.body.password) {
|
|
96
|
-
const salt = await bcryptjs_1.default.genSalt(10);
|
|
97
|
-
req.body.password = await bcryptjs_1.default.hash(req.body.password, salt);
|
|
98
|
-
}
|
|
99
|
-
const updatedUser = await user_model_1.default.findByIdAndUpdate(userId, req.body, { new: true });
|
|
100
|
-
if (!updatedUser) {
|
|
101
|
-
return res.status(404).json({ message: 'User not found.' });
|
|
102
|
-
}
|
|
103
|
-
return res.status(200).json(updatedUser);
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
console.error('Error updating user:', error);
|
|
107
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
108
|
-
}
|
|
29
|
+
async list(query, res) {
|
|
30
|
+
const result = await this.users.list(query);
|
|
31
|
+
return res.status(200).json(result);
|
|
109
32
|
}
|
|
110
|
-
async
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const deletedUser = await user_model_1.default.findByIdAndDelete(userId);
|
|
114
|
-
if (!deletedUser) {
|
|
115
|
-
return res.status(404).json({ message: 'User not found.' });
|
|
116
|
-
}
|
|
117
|
-
return res.status(200).json({ message: 'User deleted successfully.' });
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
console.error('Error deleting user:', error);
|
|
121
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
122
|
-
}
|
|
33
|
+
async ban(id, res) {
|
|
34
|
+
const result = await this.users.setBan(id, true);
|
|
35
|
+
return res.status(200).json(result);
|
|
123
36
|
}
|
|
124
|
-
async
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (!email) {
|
|
128
|
-
return res.status(400).json({ message: 'Email is required.' });
|
|
129
|
-
}
|
|
130
|
-
const existingUser = await user_model_1.default.findOne({ email });
|
|
131
|
-
if (existingUser) {
|
|
132
|
-
return res.status(400).json({ message: 'User with this email already exists.' });
|
|
133
|
-
}
|
|
134
|
-
const token = (0, node_crypto_1.randomBytes)(20).toString('hex');
|
|
135
|
-
const tokenExpiration = Date.now() + 24 * 60 * 60 * 1000;
|
|
136
|
-
const newUser = new user_model_1.default({
|
|
137
|
-
email,
|
|
138
|
-
name,
|
|
139
|
-
resetPasswordToken: token,
|
|
140
|
-
resetPasswordExpires: tokenExpiration
|
|
141
|
-
});
|
|
142
|
-
await newUser.save();
|
|
143
|
-
const transporter = nodemailer_1.default.createTransport({
|
|
144
|
-
host: process.env.SMTP_HOST,
|
|
145
|
-
port: parseInt(process.env.SMTP_PORT, 10),
|
|
146
|
-
secure: process.env.SMTP_SECURE === 'true',
|
|
147
|
-
auth: {
|
|
148
|
-
user: process.env.SMTP_USER,
|
|
149
|
-
pass: process.env.SMTP_PASS
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
const invitationUrl = `${process.env.FRONTEND_URL}/set-password?token=${token}&email=${encodeURIComponent(email)}`;
|
|
153
|
-
const mailOptions = {
|
|
154
|
-
from: process.env.FROM_EMAIL,
|
|
155
|
-
to: email,
|
|
156
|
-
subject: "You're invited: Set up your password",
|
|
157
|
-
text: `Hello,
|
|
158
|
-
|
|
159
|
-
You have been invited to join our platform. Please click on the link below to set your password and complete your registration:
|
|
160
|
-
|
|
161
|
-
${invitationUrl}
|
|
162
|
-
|
|
163
|
-
This link will expire in 24 hours. If you did not request this or believe it to be in error, please ignore this email.
|
|
164
|
-
|
|
165
|
-
Thank you!`
|
|
166
|
-
};
|
|
167
|
-
await transporter.sendMail(mailOptions);
|
|
168
|
-
return res.status(201).json({ message: 'Invitation sent successfully. Please check your email.' });
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
console.error('Error in createUserInvitation:', error);
|
|
172
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
173
|
-
}
|
|
37
|
+
async unban(id, res) {
|
|
38
|
+
const result = await this.users.setBan(id, false);
|
|
39
|
+
return res.status(200).json(result);
|
|
174
40
|
}
|
|
175
|
-
async
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (req.query.email)
|
|
179
|
-
filter.email = req.query.email;
|
|
180
|
-
const page = Math.max(parseInt(req.query.page, 10) || 1, 1);
|
|
181
|
-
const limit = Math.min(parseInt(req.query.limit, 10) || 20, 100);
|
|
182
|
-
const skip = (page - 1) * limit;
|
|
183
|
-
const [totalItems, users] = await Promise.all([
|
|
184
|
-
user_model_1.default.countDocuments(filter),
|
|
185
|
-
user_model_1.default.find(filter)
|
|
186
|
-
.populate({ path: 'roles', select: '-__v' })
|
|
187
|
-
.skip(skip)
|
|
188
|
-
.limit(limit)
|
|
189
|
-
.lean()
|
|
190
|
-
]);
|
|
191
|
-
return res.status(200).json({
|
|
192
|
-
data: users,
|
|
193
|
-
pagination: {
|
|
194
|
-
totalItems,
|
|
195
|
-
limit,
|
|
196
|
-
totalPages: Math.ceil(totalItems / limit) || 1,
|
|
197
|
-
currentPage: page,
|
|
198
|
-
hasNextPage: page * limit < totalItems,
|
|
199
|
-
hasPrevPage: page > 1
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
console.error('Error fetching users:', error);
|
|
205
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
206
|
-
}
|
|
41
|
+
async delete(id, res) {
|
|
42
|
+
const result = await this.users.delete(id);
|
|
43
|
+
return res.status(200).json(result);
|
|
207
44
|
}
|
|
208
|
-
async
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const userId = (_a = req.user) === null || _a === void 0 ? void 0 : _a.id;
|
|
212
|
-
if (!userId) {
|
|
213
|
-
return res.status(401).json({ message: 'Unauthorized' });
|
|
214
|
-
}
|
|
215
|
-
const user = await user_model_1.default.findById(userId).select('-password -resetPasswordToken -resetPasswordExpires -refreshToken -__v');
|
|
216
|
-
if (!user) {
|
|
217
|
-
return res.status(404).json({ message: 'User not found.' });
|
|
218
|
-
}
|
|
219
|
-
return res.status(200).json(user);
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
console.error('Error fetching current user:', error);
|
|
223
|
-
return res.status(500).json({ message: 'Server error', error: error.message });
|
|
224
|
-
}
|
|
45
|
+
async updateRoles(id, dto, res) {
|
|
46
|
+
const result = await this.users.updateRoles(id, dto.roles);
|
|
47
|
+
return res.status(200).json(result);
|
|
225
48
|
}
|
|
226
49
|
};
|
|
227
50
|
exports.UsersController = UsersController;
|
|
228
51
|
__decorate([
|
|
229
52
|
(0, common_1.Post)(),
|
|
230
|
-
__param(0, (0, common_1.
|
|
53
|
+
__param(0, (0, common_1.Body)()),
|
|
231
54
|
__param(1, (0, common_1.Res)()),
|
|
232
55
|
__metadata("design:type", Function),
|
|
233
|
-
__metadata("design:paramtypes", [
|
|
56
|
+
__metadata("design:paramtypes", [register_dto_1.RegisterDto, Object]),
|
|
234
57
|
__metadata("design:returntype", Promise)
|
|
235
|
-
], UsersController.prototype, "
|
|
58
|
+
], UsersController.prototype, "create", null);
|
|
236
59
|
__decorate([
|
|
237
|
-
(0, common_1.
|
|
238
|
-
__param(0, (0, common_1.
|
|
60
|
+
(0, common_1.Get)(),
|
|
61
|
+
__param(0, (0, common_1.Query)()),
|
|
239
62
|
__param(1, (0, common_1.Res)()),
|
|
240
63
|
__metadata("design:type", Function),
|
|
241
64
|
__metadata("design:paramtypes", [Object, Object]),
|
|
242
65
|
__metadata("design:returntype", Promise)
|
|
243
|
-
], UsersController.prototype, "
|
|
66
|
+
], UsersController.prototype, "list", null);
|
|
244
67
|
__decorate([
|
|
245
|
-
(0, common_1.
|
|
246
|
-
__param(0, (0, common_1.
|
|
68
|
+
(0, common_1.Patch)(':id/ban'),
|
|
69
|
+
__param(0, (0, common_1.Param)('id')),
|
|
247
70
|
__param(1, (0, common_1.Res)()),
|
|
248
71
|
__metadata("design:type", Function),
|
|
249
|
-
__metadata("design:paramtypes", [
|
|
72
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
250
73
|
__metadata("design:returntype", Promise)
|
|
251
|
-
], UsersController.prototype, "
|
|
74
|
+
], UsersController.prototype, "ban", null);
|
|
252
75
|
__decorate([
|
|
253
|
-
(0, common_1.
|
|
254
|
-
__param(0, (0, common_1.
|
|
76
|
+
(0, common_1.Patch)(':id/unban'),
|
|
77
|
+
__param(0, (0, common_1.Param)('id')),
|
|
255
78
|
__param(1, (0, common_1.Res)()),
|
|
256
79
|
__metadata("design:type", Function),
|
|
257
|
-
__metadata("design:paramtypes", [
|
|
80
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
258
81
|
__metadata("design:returntype", Promise)
|
|
259
|
-
], UsersController.prototype, "
|
|
82
|
+
], UsersController.prototype, "unban", null);
|
|
260
83
|
__decorate([
|
|
261
|
-
(0, common_1.
|
|
262
|
-
__param(0, (0, common_1.
|
|
84
|
+
(0, common_1.Delete)(':id'),
|
|
85
|
+
__param(0, (0, common_1.Param)('id')),
|
|
263
86
|
__param(1, (0, common_1.Res)()),
|
|
264
87
|
__metadata("design:type", Function),
|
|
265
|
-
__metadata("design:paramtypes", [
|
|
88
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
266
89
|
__metadata("design:returntype", Promise)
|
|
267
|
-
], UsersController.prototype, "
|
|
90
|
+
], UsersController.prototype, "delete", null);
|
|
268
91
|
__decorate([
|
|
269
|
-
(0, common_1.
|
|
270
|
-
(0, common_1.
|
|
271
|
-
__param(
|
|
272
|
-
__param(
|
|
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)()),
|
|
273
96
|
__metadata("design:type", Function),
|
|
274
|
-
__metadata("design:paramtypes", [
|
|
97
|
+
__metadata("design:paramtypes", [String, update_user_role_dto_1.UpdateUserRolesDto, Object]),
|
|
275
98
|
__metadata("design:returntype", Promise)
|
|
276
|
-
], UsersController.prototype, "
|
|
99
|
+
], UsersController.prototype, "updateRoles", null);
|
|
277
100
|
exports.UsersController = UsersController = __decorate([
|
|
278
|
-
(0,
|
|
101
|
+
(0, admin_decorator_1.Admin)(),
|
|
102
|
+
(0, common_1.Controller)('api/admin/users'),
|
|
103
|
+
__metadata("design:paramtypes", [users_service_1.UsersService])
|
|
279
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);
|