@hedhog/admin 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin.module.d.ts +3 -0
- package/dist/admin.module.d.ts.map +1 -0
- package/dist/admin.module.js +34 -0
- package/dist/admin.module.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +21 -0
- package/dist/auth/auth.controller.d.ts.map +1 -0
- package/dist/auth/auth.controller.js +77 -0
- package/dist/auth/auth.controller.js.map +1 -0
- package/dist/auth/auth.module.d.ts +3 -0
- package/dist/auth/auth.module.d.ts.map +1 -0
- package/dist/auth/auth.module.js +50 -0
- package/dist/auth/auth.module.js.map +1 -0
- package/dist/auth/auth.service.d.ts +36 -0
- package/dist/auth/auth.service.d.ts.map +1 -0
- package/dist/auth/auth.service.js +162 -0
- package/dist/auth/auth.service.js.map +1 -0
- package/dist/auth/auth.service.spec.d.ts +2 -0
- package/dist/auth/auth.service.spec.d.ts.map +1 -0
- package/dist/auth/auth.service.spec.js +17 -0
- package/dist/auth/auth.service.spec.js.map +1 -0
- package/dist/auth/decorators/public.decorator.d.ts +3 -0
- package/dist/auth/decorators/public.decorator.d.ts.map +1 -0
- package/dist/auth/decorators/public.decorator.js +8 -0
- package/dist/auth/decorators/public.decorator.js.map +1 -0
- package/dist/auth/decorators/user.decorator.d.ts +2 -0
- package/dist/auth/decorators/user.decorator.d.ts.map +1 -0
- package/dist/auth/decorators/user.decorator.js +12 -0
- package/dist/auth/decorators/user.decorator.js.map +1 -0
- package/dist/auth/dto/forget.dto.d.ts +4 -0
- package/dist/auth/dto/forget.dto.d.ts.map +1 -0
- package/dist/auth/dto/forget.dto.js +21 -0
- package/dist/auth/dto/forget.dto.js.map +1 -0
- package/dist/auth/dto/login.dto.d.ts +5 -0
- package/dist/auth/dto/login.dto.d.ts.map +1 -0
- package/dist/auth/dto/login.dto.js +31 -0
- package/dist/auth/dto/login.dto.js.map +1 -0
- package/dist/auth/dto/otp.dto.d.ts +5 -0
- package/dist/auth/dto/otp.dto.d.ts.map +1 -0
- package/dist/auth/dto/otp.dto.js +27 -0
- package/dist/auth/dto/otp.dto.js.map +1 -0
- package/dist/auth/enums/multifactor-type.enum.d.ts +5 -0
- package/dist/auth/enums/multifactor-type.enum.d.ts.map +1 -0
- package/dist/auth/enums/multifactor-type.enum.js +9 -0
- package/dist/auth/enums/multifactor-type.enum.js.map +1 -0
- package/dist/auth/guards/auth.guard.d.ts +11 -0
- package/dist/auth/guards/auth.guard.d.ts.map +1 -0
- package/dist/auth/guards/auth.guard.js +56 -0
- package/dist/auth/guards/auth.guard.js.map +1 -0
- package/dist/auth/migrations/index.d.ts +6 -0
- package/dist/auth/migrations/index.d.ts.map +1 -0
- package/dist/auth/migrations/index.js +121 -0
- package/dist/auth/migrations/index.js.map +1 -0
- package/dist/auth/types/user.type.d.ts +9 -0
- package/dist/auth/types/user.type.d.ts.map +1 -0
- package/dist/auth/types/user.type.js +3 -0
- package/dist/auth/types/user.type.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/menu/dto/create.dto.d.ts +8 -0
- package/dist/menu/dto/create.dto.d.ts.map +1 -0
- package/dist/menu/dto/create.dto.js +44 -0
- package/dist/menu/dto/create.dto.js.map +1 -0
- package/dist/menu/dto/delete.dto.d.ts +4 -0
- package/dist/menu/dto/delete.dto.d.ts.map +1 -0
- package/dist/menu/dto/delete.dto.js +24 -0
- package/dist/menu/dto/delete.dto.js.map +1 -0
- package/dist/menu/dto/order.dto.d.ts +4 -0
- package/dist/menu/dto/order.dto.d.ts.map +1 -0
- package/dist/menu/dto/order.dto.js +23 -0
- package/dist/menu/dto/order.dto.js.map +1 -0
- package/dist/menu/dto/update.dto.d.ts +7 -0
- package/dist/menu/dto/update.dto.d.ts.map +1 -0
- package/dist/menu/dto/update.dto.js +37 -0
- package/dist/menu/dto/update.dto.js.map +1 -0
- package/dist/menu/menu.controller.d.ts +19 -0
- package/dist/menu/menu.controller.d.ts.map +1 -0
- package/dist/menu/menu.controller.js +119 -0
- package/dist/menu/menu.controller.js.map +1 -0
- package/dist/menu/menu.module.d.ts +3 -0
- package/dist/menu/menu.module.d.ts.map +1 -0
- package/dist/menu/menu.module.js +33 -0
- package/dist/menu/menu.module.js.map +1 -0
- package/dist/menu/menu.service.d.ts +23 -0
- package/dist/menu/menu.service.d.ts.map +1 -0
- package/dist/menu/menu.service.js +117 -0
- package/dist/menu/menu.service.js.map +1 -0
- package/dist/menu/migrations/index.d.ts +7 -0
- package/dist/menu/migrations/index.d.ts.map +1 -0
- package/dist/menu/migrations/index.js +101 -0
- package/dist/menu/migrations/index.js.map +1 -0
- package/dist/permission/decorators/permission.decorator.d.ts +3 -0
- package/dist/permission/decorators/permission.decorator.d.ts.map +1 -0
- package/dist/permission/decorators/permission.decorator.js +8 -0
- package/dist/permission/decorators/permission.decorator.js.map +1 -0
- package/dist/permission/dto/create.dto.d.ts +5 -0
- package/dist/permission/dto/create.dto.d.ts.map +1 -0
- package/dist/permission/dto/create.dto.js +27 -0
- package/dist/permission/dto/create.dto.js.map +1 -0
- package/dist/permission/dto/delete.dto.d.ts +4 -0
- package/dist/permission/dto/delete.dto.d.ts.map +1 -0
- package/dist/permission/dto/delete.dto.js +23 -0
- package/dist/permission/dto/delete.dto.js.map +1 -0
- package/dist/permission/dto/update.dto.d.ts +5 -0
- package/dist/permission/dto/update.dto.d.ts.map +1 -0
- package/dist/permission/dto/update.dto.js +27 -0
- package/dist/permission/dto/update.dto.js.map +1 -0
- package/dist/permission/guards/permission.guard.d.ts +11 -0
- package/dist/permission/guards/permission.guard.d.ts.map +1 -0
- package/dist/permission/guards/permission.guard.js +99 -0
- package/dist/permission/guards/permission.guard.js.map +1 -0
- package/dist/permission/migrations/index.d.ts +6 -0
- package/dist/permission/migrations/index.d.ts.map +1 -0
- package/dist/permission/migrations/index.js +520 -0
- package/dist/permission/migrations/index.js.map +1 -0
- package/dist/permission/permission.controller.d.ts +14 -0
- package/dist/permission/permission.controller.d.ts.map +1 -0
- package/dist/permission/permission.controller.js +95 -0
- package/dist/permission/permission.controller.js.map +1 -0
- package/dist/permission/permission.module.d.ts +3 -0
- package/dist/permission/permission.module.d.ts.map +1 -0
- package/dist/permission/permission.module.js +39 -0
- package/dist/permission/permission.module.js.map +1 -0
- package/dist/permission/permission.service.d.ts +19 -0
- package/dist/permission/permission.service.d.ts.map +1 -0
- package/dist/permission/permission.service.js +73 -0
- package/dist/permission/permission.service.js.map +1 -0
- package/dist/permission/types/permission.types.d.ts +33 -0
- package/dist/permission/types/permission.types.d.ts.map +1 -0
- package/dist/permission/types/permission.types.js +3 -0
- package/dist/permission/types/permission.types.js.map +1 -0
- package/dist/screen/dto/create.dto.d.ts +7 -0
- package/dist/screen/dto/create.dto.d.ts.map +1 -0
- package/dist/screen/dto/create.dto.js +37 -0
- package/dist/screen/dto/create.dto.js.map +1 -0
- package/dist/screen/dto/delete.dto.d.ts +4 -0
- package/dist/screen/dto/delete.dto.d.ts.map +1 -0
- package/dist/screen/dto/delete.dto.js +23 -0
- package/dist/screen/dto/delete.dto.js.map +1 -0
- package/dist/screen/dto/update.dto.d.ts +7 -0
- package/dist/screen/dto/update.dto.d.ts.map +1 -0
- package/dist/screen/dto/update.dto.js +37 -0
- package/dist/screen/dto/update.dto.js.map +1 -0
- package/dist/screen/migrations/index.d.ts +6 -0
- package/dist/screen/migrations/index.d.ts.map +1 -0
- package/dist/screen/migrations/index.js +40 -0
- package/dist/screen/migrations/index.js.map +1 -0
- package/dist/screen/screen.controller.d.ts +14 -0
- package/dist/screen/screen.controller.d.ts.map +1 -0
- package/dist/screen/screen.controller.js +95 -0
- package/dist/screen/screen.controller.js.map +1 -0
- package/dist/screen/screen.module.d.ts +3 -0
- package/dist/screen/screen.module.d.ts.map +1 -0
- package/dist/screen/screen.module.js +31 -0
- package/dist/screen/screen.module.js.map +1 -0
- package/dist/screen/screen.service.d.ts +19 -0
- package/dist/screen/screen.service.d.ts.map +1 -0
- package/dist/screen/screen.service.js +73 -0
- package/dist/screen/screen.service.js.map +1 -0
- package/dist/user/constants/user.constants.d.ts +2 -0
- package/dist/user/constants/user.constants.d.ts.map +1 -0
- package/dist/user/constants/user.constants.js +5 -0
- package/dist/user/constants/user.constants.js.map +1 -0
- package/dist/user/dto/create.dto.d.ts +6 -0
- package/dist/user/dto/create.dto.d.ts.map +1 -0
- package/dist/user/dto/create.dto.js +37 -0
- package/dist/user/dto/create.dto.js.map +1 -0
- package/dist/user/dto/delete.dto.d.ts +4 -0
- package/dist/user/dto/delete.dto.d.ts.map +1 -0
- package/dist/user/dto/delete.dto.js +23 -0
- package/dist/user/dto/delete.dto.js.map +1 -0
- package/dist/user/dto/update.dto.d.ts +8 -0
- package/dist/user/dto/update.dto.d.ts.map +1 -0
- package/dist/user/dto/update.dto.js +50 -0
- package/dist/user/dto/update.dto.js.map +1 -0
- package/dist/user/user.controller.d.ts +14 -0
- package/dist/user/user.controller.d.ts.map +1 -0
- package/dist/user/user.controller.js +95 -0
- package/dist/user/user.controller.js.map +1 -0
- package/dist/user/user.module.d.ts +3 -0
- package/dist/user/user.module.d.ts.map +1 -0
- package/dist/user/user.module.js +31 -0
- package/dist/user/user.module.js.map +1 -0
- package/dist/user/user.service.d.ts +20 -0
- package/dist/user/user.service.d.ts.map +1 -0
- package/dist/user/user.service.js +84 -0
- package/dist/user/user.service.js.map +1 -0
- package/dist/user/user.service.spec.d.ts +2 -0
- package/dist/user/user.service.spec.d.ts.map +1 -0
- package/dist/user/user.service.spec.js +17 -0
- package/dist/user/user.service.spec.js.map +1 -0
- package/package.json +2 -1
@@ -0,0 +1,73 @@
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.ScreenService = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const prisma_1 = require("@hedhog/prisma");
|
18
|
+
const common_1 = require("@nestjs/common");
|
19
|
+
let ScreenService = class ScreenService {
|
20
|
+
constructor(prismaService, paginationService) {
|
21
|
+
this.prismaService = prismaService;
|
22
|
+
this.paginationService = paginationService;
|
23
|
+
}
|
24
|
+
async getScreens(paginationParams) {
|
25
|
+
const fields = ['name', 'slug', 'description', 'icon'];
|
26
|
+
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
27
|
+
return this.paginationService.paginate(this.prismaService.screens, paginationParams, {
|
28
|
+
where: {
|
29
|
+
OR,
|
30
|
+
},
|
31
|
+
});
|
32
|
+
}
|
33
|
+
async get(screenId) {
|
34
|
+
return this.prismaService.screens.findUnique({ where: { id: screenId } });
|
35
|
+
}
|
36
|
+
async create({ name, slug, description, icon }) {
|
37
|
+
return this.prismaService.screens.create({
|
38
|
+
data: {
|
39
|
+
name,
|
40
|
+
slug,
|
41
|
+
description,
|
42
|
+
icon,
|
43
|
+
},
|
44
|
+
});
|
45
|
+
}
|
46
|
+
async update({ id, data }) {
|
47
|
+
return this.prismaService.screens.update({
|
48
|
+
where: { id },
|
49
|
+
data,
|
50
|
+
});
|
51
|
+
}
|
52
|
+
async delete({ ids }) {
|
53
|
+
if (ids == undefined || ids == null) {
|
54
|
+
throw new common_1.BadRequestException(`You must select at least one screen to delete.`);
|
55
|
+
}
|
56
|
+
return this.prismaService.screens.deleteMany({
|
57
|
+
where: {
|
58
|
+
id: {
|
59
|
+
in: ids,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
});
|
63
|
+
}
|
64
|
+
};
|
65
|
+
exports.ScreenService = ScreenService;
|
66
|
+
exports.ScreenService = ScreenService = __decorate([
|
67
|
+
(0, common_1.Injectable)(),
|
68
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
69
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
|
70
|
+
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
71
|
+
pagination_1.PaginationService])
|
72
|
+
], ScreenService);
|
73
|
+
//# sourceMappingURL=screen.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"screen.service.js","sourceRoot":"","sources":["../../src/screen/screen.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,UAAU,CAAC,gBAA+B;QAC9C,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QACvD,MAAM,EAAE,GAAU,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAC1D,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,OAAO,EAC1B,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;SACF,CACF,CAAC;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a;QAET,8BAAiB;GAL5C,aAAa,CA+DzB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.constants.d.ts","sourceRoot":"","sources":["../../../src/user/constants/user.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,KAAK,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.constants.js","sourceRoot":"","sources":["../../../src/user/constants/user.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/user/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAEpB,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAed,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
@@ -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.CreateDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class CreateDTO {
|
15
|
+
}
|
16
|
+
exports.CreateDTO = CreateDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
|
19
|
+
__metadata("design:type", String)
|
20
|
+
], CreateDTO.prototype, "name", void 0);
|
21
|
+
__decorate([
|
22
|
+
(0, class_validator_1.IsEmail)({}, { message: 'O email deve ser um email válido' }),
|
23
|
+
__metadata("design:type", String)
|
24
|
+
], CreateDTO.prototype, "email", void 0);
|
25
|
+
__decorate([
|
26
|
+
(0, class_validator_1.IsStrongPassword)({
|
27
|
+
minLength: 6,
|
28
|
+
minLowercase: 1,
|
29
|
+
minUppercase: 0,
|
30
|
+
minNumbers: 0,
|
31
|
+
minSymbols: 0,
|
32
|
+
}, {
|
33
|
+
message: 'A senha deve ter pelo menos 6 caracteres, contendo pelo menos uma letra minúscula',
|
34
|
+
}),
|
35
|
+
__metadata("design:type", String)
|
36
|
+
], CreateDTO.prototype, "password", void 0);
|
37
|
+
//# sourceMappingURL=create.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/user/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsE;AAEtE,MAAa,SAAS;CAqBrB;AArBD,8BAqBC;AAnBC;IADC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;uCACvC;AAGb;IADC,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;;wCAChD;AAed;IAbC,IAAA,kCAAgB,EACf;QACE,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;KACd,EACD;QACE,OAAO,EACL,mFAAmF;KACtF,CACF;;2CACgB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../src/user/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
|
@@ -0,0 +1,23 @@
|
|
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.DeleteDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class DeleteDTO {
|
15
|
+
}
|
16
|
+
exports.DeleteDTO = DeleteDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsArray)(),
|
19
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
20
|
+
(0, class_validator_1.IsInt)({ each: true }),
|
21
|
+
__metadata("design:type", Array)
|
22
|
+
], DeleteDTO.prototype, "ids", void 0);
|
23
|
+
//# sourceMappingURL=delete.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../src/user/dto/delete.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAE/D,MAAa,SAAS;CAKrB;AALD,8BAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sCACR"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/user/dto/update.dto.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,KAAK,CAAC,EAAE,MAAM,CAAC;IAgBf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
@@ -0,0 +1,50 @@
|
|
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.UpdateDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class UpdateDTO {
|
15
|
+
}
|
16
|
+
exports.UpdateDTO = UpdateDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsString)({ message: 'The name must be a string' }),
|
19
|
+
(0, class_validator_1.IsOptional)(),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], UpdateDTO.prototype, "name", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsEmail)({}, { message: 'The email must be a valid email' }),
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
25
|
+
__metadata("design:type", String)
|
26
|
+
], UpdateDTO.prototype, "email", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, class_validator_1.IsOptional)(),
|
29
|
+
(0, class_validator_1.IsStrongPassword)({
|
30
|
+
minLength: 6,
|
31
|
+
minLowercase: 1,
|
32
|
+
minUppercase: 0,
|
33
|
+
minNumbers: 0,
|
34
|
+
minSymbols: 0,
|
35
|
+
}, {
|
36
|
+
message: 'The password must be at least 6 characters long and contain at least one lowercase',
|
37
|
+
}),
|
38
|
+
__metadata("design:type", String)
|
39
|
+
], UpdateDTO.prototype, "password", void 0);
|
40
|
+
__decorate([
|
41
|
+
(0, class_validator_1.IsOptional)(),
|
42
|
+
(0, class_validator_1.IsInt)({ message: 'The multifactor_id must be an integer' }),
|
43
|
+
__metadata("design:type", Number)
|
44
|
+
], UpdateDTO.prototype, "multifactor_id", void 0);
|
45
|
+
__decorate([
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
47
|
+
(0, class_validator_1.IsString)({ message: 'The code must be a string' }),
|
48
|
+
__metadata("design:type", String)
|
49
|
+
], UpdateDTO.prototype, "code", void 0);
|
50
|
+
//# sourceMappingURL=update.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/user/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAMyB;AAEzB,MAAa,SAAS;CAgCrB;AAhCD,8BAgCC;AA7BC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;IAC3D,IAAA,4BAAU,GAAE;;wCACE;AAgBf;IAdC,IAAA,4BAAU,GAAE;IACZ,IAAA,kCAAgB,EACf;QACE,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;KACd,EACD;QACE,OAAO,EACL,oFAAoF;KACvF,CACF;;2CACiB;AAIlB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,EAAC,EAAE,OAAO,EAAE,uCAAuC,EAAE,CAAC;;iDACpC;AAIxB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;;uCACrC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { CreateDTO } from './dto/create.dto';
|
2
|
+
import { DeleteDTO } from './dto/delete.dto';
|
3
|
+
import { UpdateDTO } from './dto/update.dto';
|
4
|
+
import { UserService } from './user.service';
|
5
|
+
export declare class UserController {
|
6
|
+
private readonly userService;
|
7
|
+
constructor(userService: UserService);
|
8
|
+
getUsers(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
9
|
+
show(userId: number): Promise<any>;
|
10
|
+
create(data: CreateDTO): Promise<any>;
|
11
|
+
update(userId: number, data: UpdateDTO): Promise<any>;
|
12
|
+
delete(data: DeleteDTO): Promise<any>;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=user.controller.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.controller.d.ts","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,qBAEa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAKrC,QAAQ,CAAe,gBAAgB,KAAA;IAMvC,IAAI,CAAgC,MAAM,EAAE,MAAM;IAMxD,MAAM,CAAS,IAAI,EAAE,SAAS;IAMxB,MAAM,CACqB,MAAM,EAAE,MAAM,EACrC,IAAI,EAAE,SAAS;IAUnB,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
|
@@ -0,0 +1,95 @@
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.UserController = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const common_1 = require("@nestjs/common");
|
18
|
+
const create_dto_1 = require("./dto/create.dto");
|
19
|
+
const delete_dto_1 = require("./dto/delete.dto");
|
20
|
+
const update_dto_1 = require("./dto/update.dto");
|
21
|
+
const user_service_1 = require("./user.service");
|
22
|
+
const permission_decorator_1 = require("../permission/decorators/permission.decorator");
|
23
|
+
const auth_guard_1 = require("../auth/guards/auth.guard");
|
24
|
+
let UserController = class UserController {
|
25
|
+
constructor(userService) {
|
26
|
+
this.userService = userService;
|
27
|
+
}
|
28
|
+
async getUsers(paginationParams) {
|
29
|
+
return this.userService.getUsers(paginationParams);
|
30
|
+
}
|
31
|
+
async show(userId) {
|
32
|
+
return this.userService.get(userId);
|
33
|
+
}
|
34
|
+
create(data) {
|
35
|
+
return this.userService.create(data);
|
36
|
+
}
|
37
|
+
async update(userId, data) {
|
38
|
+
return this.userService.update({
|
39
|
+
id: userId,
|
40
|
+
data,
|
41
|
+
});
|
42
|
+
}
|
43
|
+
async delete(data) {
|
44
|
+
return this.userService.delete(data);
|
45
|
+
}
|
46
|
+
};
|
47
|
+
exports.UserController = UserController;
|
48
|
+
__decorate([
|
49
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
50
|
+
(0, common_1.Get)(),
|
51
|
+
__param(0, (0, pagination_1.Pagination)()),
|
52
|
+
__metadata("design:type", Function),
|
53
|
+
__metadata("design:paramtypes", [Object]),
|
54
|
+
__metadata("design:returntype", Promise)
|
55
|
+
], UserController.prototype, "getUsers", null);
|
56
|
+
__decorate([
|
57
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
58
|
+
(0, common_1.Get)(':userId'),
|
59
|
+
__param(0, (0, common_1.Param)('userId', common_1.ParseIntPipe)),
|
60
|
+
__metadata("design:type", Function),
|
61
|
+
__metadata("design:paramtypes", [Number]),
|
62
|
+
__metadata("design:returntype", Promise)
|
63
|
+
], UserController.prototype, "show", null);
|
64
|
+
__decorate([
|
65
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
66
|
+
(0, common_1.Post)(),
|
67
|
+
__param(0, (0, common_1.Body)()),
|
68
|
+
__metadata("design:type", Function),
|
69
|
+
__metadata("design:paramtypes", [create_dto_1.CreateDTO]),
|
70
|
+
__metadata("design:returntype", void 0)
|
71
|
+
], UserController.prototype, "create", null);
|
72
|
+
__decorate([
|
73
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
74
|
+
(0, common_1.Patch)(':userId'),
|
75
|
+
__param(0, (0, common_1.Param)('userId', common_1.ParseIntPipe)),
|
76
|
+
__param(1, (0, common_1.Body)()),
|
77
|
+
__metadata("design:type", Function),
|
78
|
+
__metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
|
79
|
+
__metadata("design:returntype", Promise)
|
80
|
+
], UserController.prototype, "update", null);
|
81
|
+
__decorate([
|
82
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
83
|
+
(0, common_1.Delete)(),
|
84
|
+
__param(0, (0, common_1.Body)()),
|
85
|
+
__metadata("design:type", Function),
|
86
|
+
__metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
|
87
|
+
__metadata("design:returntype", Promise)
|
88
|
+
], UserController.prototype, "delete", null);
|
89
|
+
exports.UserController = UserController = __decorate([
|
90
|
+
(0, permission_decorator_1.Permission)(),
|
91
|
+
(0, common_1.Controller)('users'),
|
92
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => user_service_1.UserService))),
|
93
|
+
__metadata("design:paramtypes", [user_service_1.UserService])
|
94
|
+
], UserController);
|
95
|
+
//# sourceMappingURL=user.controller.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAYwB;AACxB,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAC7C,wFAA2E;AAC3E,0DAAsD;AAI/C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAIE,AAAN,KAAK,CAAC,QAAQ,CAAe,gBAAgB;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC;IAIK,AAAN,KAAK,CAAC,IAAI,CAAgC,MAAc;QACtD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Ac;IAF1B,IAAA,iCAAU,GAAE;IACZ,IAAA,mBAAU,EAAC,OAAO,CAAC;IAGf,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACR,0BAAW;GAHhC,cAAc,CAyC1B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.module.d.ts","sourceRoot":"","sources":["../../src/user/user.module.ts"],"names":[],"mappings":"AAOA,qBAUa,UAAU;CAAG"}
|
@@ -0,0 +1,31 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.UserModule = void 0;
|
10
|
+
const pagination_1 = require("@hedhog/pagination");
|
11
|
+
const prisma_1 = require("@hedhog/prisma");
|
12
|
+
const common_1 = require("@nestjs/common");
|
13
|
+
const user_controller_1 = require("./user.controller");
|
14
|
+
const user_service_1 = require("./user.service");
|
15
|
+
const auth_module_1 = require("../auth/auth.module");
|
16
|
+
let UserModule = class UserModule {
|
17
|
+
};
|
18
|
+
exports.UserModule = UserModule;
|
19
|
+
exports.UserModule = UserModule = __decorate([
|
20
|
+
(0, common_1.Module)({
|
21
|
+
providers: [user_service_1.UserService],
|
22
|
+
exports: [user_service_1.UserService],
|
23
|
+
controllers: [user_controller_1.UserController],
|
24
|
+
imports: [
|
25
|
+
(0, common_1.forwardRef)(() => auth_module_1.AuthModule),
|
26
|
+
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
27
|
+
(0, common_1.forwardRef)(() => pagination_1.PaginationModule),
|
28
|
+
],
|
29
|
+
})
|
30
|
+
], UserModule);
|
31
|
+
//# sourceMappingURL=user.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.module.js","sourceRoot":"","sources":["../../src/user/user.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAsD;AACtD,2CAA8C;AAC9C,2CAAoD;AACpD,uDAAmD;AACnD,iDAA6C;AAC7C,qDAAiD;AAY1C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAVtB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;QACtB,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;KACF,CAAC;GACW,UAAU,CAAG"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
|
+
import { PrismaService } from '@hedhog/prisma';
|
3
|
+
import { CreateDTO } from './dto/create.dto';
|
4
|
+
import { DeleteDTO } from './dto/delete.dto';
|
5
|
+
import { UpdateDTO } from './dto/update.dto';
|
6
|
+
export declare class UserService {
|
7
|
+
private readonly prismaService;
|
8
|
+
private readonly paginationService;
|
9
|
+
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
10
|
+
getUsers(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
11
|
+
get(userId: number): Promise<any>;
|
12
|
+
hashPassword(password: string): Promise<string>;
|
13
|
+
create({ email, name, password }: CreateDTO): Promise<any>;
|
14
|
+
update({ id, data }: {
|
15
|
+
id: number;
|
16
|
+
data: UpdateDTO;
|
17
|
+
}): Promise<any>;
|
18
|
+
delete({ ids }: DeleteDTO): Promise<any>;
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=user.service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../src/user/user.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,QAAQ,CAAC,gBAAgB,EAAE,aAAa;IAkBxC,GAAG,CAAC,MAAM,EAAE,MAAM;IAIlB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK/C,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,SAAS;IAY3C,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAoBhC"}
|
@@ -0,0 +1,84 @@
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.UserService = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const prisma_1 = require("@hedhog/prisma");
|
18
|
+
const common_1 = require("@nestjs/common");
|
19
|
+
const bcrypt_1 = require("bcrypt");
|
20
|
+
const user_constants_1 = require("./constants/user.constants");
|
21
|
+
let UserService = class UserService {
|
22
|
+
constructor(prismaService, paginationService) {
|
23
|
+
this.prismaService = prismaService;
|
24
|
+
this.paginationService = paginationService;
|
25
|
+
}
|
26
|
+
async getUsers(paginationParams) {
|
27
|
+
const fields = ['name', 'email'];
|
28
|
+
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
29
|
+
return this.paginationService.paginate(this.prismaService.users, paginationParams, {
|
30
|
+
where: {
|
31
|
+
OR,
|
32
|
+
},
|
33
|
+
});
|
34
|
+
}
|
35
|
+
async get(userId) {
|
36
|
+
return this.prismaService.users.findUnique({ where: { id: userId } });
|
37
|
+
}
|
38
|
+
async hashPassword(password) {
|
39
|
+
const salt = await (0, bcrypt_1.genSalt)(user_constants_1.SALT_ROUNDS);
|
40
|
+
return (0, bcrypt_1.hash)(password, salt);
|
41
|
+
}
|
42
|
+
async create({ email, name, password }) {
|
43
|
+
const hashedPassword = await this.hashPassword(password);
|
44
|
+
return this.prismaService.users.create({
|
45
|
+
data: {
|
46
|
+
email,
|
47
|
+
name,
|
48
|
+
password: hashedPassword,
|
49
|
+
},
|
50
|
+
});
|
51
|
+
}
|
52
|
+
async update({ id, data }) {
|
53
|
+
return this.prismaService.users.update({
|
54
|
+
where: { id },
|
55
|
+
data,
|
56
|
+
});
|
57
|
+
}
|
58
|
+
async delete({ ids }) {
|
59
|
+
if (ids == undefined || ids == null) {
|
60
|
+
throw new common_1.BadRequestException(`You must select at least one user to delete.`);
|
61
|
+
}
|
62
|
+
return this.prismaService.users.deleteMany({
|
63
|
+
where: {
|
64
|
+
id: {
|
65
|
+
in: ids,
|
66
|
+
},
|
67
|
+
email: {
|
68
|
+
not: {
|
69
|
+
startsWith: 'root@',
|
70
|
+
},
|
71
|
+
},
|
72
|
+
},
|
73
|
+
});
|
74
|
+
}
|
75
|
+
};
|
76
|
+
exports.UserService = UserService;
|
77
|
+
exports.UserService = UserService = __decorate([
|
78
|
+
(0, common_1.Injectable)(),
|
79
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
80
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
|
81
|
+
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
82
|
+
pagination_1.PaginationService])
|
83
|
+
], UserService);
|
84
|
+
//# sourceMappingURL=user.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AACxB,mCAAuC;AACvC,+DAAyD;AAMlD,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,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CAAC,MAAM,CAAC;YACrC,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC;YACzC,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;gBACD,KAAK,EAAE;oBACL,GAAG,EAAE;wBACH,UAAU,EAAE,OAAO;qBACpB;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1EY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,WAAW,CA0EvB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.service.spec.d.ts","sourceRoot":"","sources":["../../src/user/user.service.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
4
|
+
const user_service_1 = require("./user.service");
|
5
|
+
describe('UserService', () => {
|
6
|
+
let service;
|
7
|
+
beforeEach(async () => {
|
8
|
+
const module = await testing_1.Test.createTestingModule({
|
9
|
+
providers: [user_service_1.UserService],
|
10
|
+
}).compile();
|
11
|
+
service = module.get(user_service_1.UserService);
|
12
|
+
});
|
13
|
+
it('should be defined', () => {
|
14
|
+
expect(service).toBeDefined();
|
15
|
+
});
|
16
|
+
});
|
17
|
+
//# sourceMappingURL=user.service.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user.service.spec.js","sourceRoot":"","sources":["../../src/user/user.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,iDAA6C;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,OAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,0BAAW,CAAC;SACzB,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc,0BAAW,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hedhog/admin",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.5",
|
4
4
|
"private": false,
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"scripts": {
|
@@ -10,6 +10,7 @@
|
|
10
10
|
"prod": "npm run build && npm publish --access public"
|
11
11
|
},
|
12
12
|
"files": [
|
13
|
+
"dist/**/*",
|
13
14
|
"src/migrations/**/*.ts",
|
14
15
|
"src/**/*.ejs"
|
15
16
|
],
|