@rafikidota/iroh 0.24.1 → 0.25.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 +48 -5
- package/dist/common/decorators/generic-get-by-id.decorator.js +2 -1
- package/dist/common/decorators/generic-get-by-id.decorator.js.map +1 -1
- package/dist/common/decorators/generic-get.decorator.js +3 -2
- package/dist/common/decorators/generic-get.decorator.js.map +1 -1
- package/dist/common/dto/index.d.ts +3 -0
- package/dist/common/dto/index.js +3 -0
- package/dist/common/dto/index.js.map +1 -1
- package/dist/common/dto/parsed-query-option.dto.d.ts +4 -0
- package/dist/common/dto/parsed-query-option.dto.js +32 -0
- package/dist/common/dto/parsed-query-option.dto.js.map +1 -0
- package/dist/common/dto/parsed-search.dto.d.ts +5 -0
- package/dist/common/dto/parsed-search.dto.js +33 -0
- package/dist/common/dto/parsed-search.dto.js.map +1 -0
- package/dist/common/dto/query-option.dto.d.ts +3 -0
- package/dist/common/dto/query-option.dto.js +30 -0
- package/dist/common/dto/query-option.dto.js.map +1 -0
- package/dist/common/dto/search.dto.d.ts +0 -4
- package/dist/common/dto/search.dto.js +4 -20
- package/dist/common/dto/search.dto.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/interfaces/crud.controller.d.ts +2 -1
- package/dist/common/interfaces/crud.repository.d.ts +2 -1
- package/dist/common/interfaces/crud.service.d.ts +2 -1
- package/dist/common/loggers/index.d.ts +2 -1
- package/dist/common/loggers/index.js +2 -1
- package/dist/common/loggers/index.js.map +1 -1
- package/dist/common/loggers/notification/index.d.ts +3 -0
- package/dist/common/loggers/notification/index.js +20 -0
- package/dist/common/loggers/notification/index.js.map +1 -0
- package/dist/common/loggers/notification/notification.type.d.ts +8 -0
- package/dist/common/loggers/notification/notification.type.enum.d.ts +6 -0
- package/dist/common/loggers/notification/notification.type.enum.js +10 -0
- package/dist/common/loggers/notification/notification.type.enum.js.map +1 -0
- package/dist/common/loggers/notification/notification.type.js +3 -0
- package/dist/common/loggers/notification/notification.type.js.map +1 -0
- package/dist/common/loggers/notification/notifier.d.ts +11 -0
- package/dist/common/loggers/notification/notifier.js +57 -0
- package/dist/common/loggers/notification/notifier.js.map +1 -0
- package/dist/common/pipes/index.d.ts +1 -0
- package/dist/common/pipes/index.js +1 -0
- package/dist/common/pipes/index.js.map +1 -1
- package/dist/common/pipes/parse-query.pipe.d.ts +10 -0
- package/dist/common/pipes/parse-query.pipe.js +21 -0
- package/dist/common/pipes/parse-query.pipe.js.map +1 -0
- package/dist/common/types/find-by-id-params.d.ts +3 -0
- package/dist/common/types/find-by-id-params.js +3 -0
- package/dist/common/types/find-by-id-params.js.map +1 -0
- package/dist/common/types/index.d.ts +1 -0
- package/dist/common/types/index.js +18 -0
- package/dist/common/types/index.js.map +1 -0
- package/dist/core/infra/iroh.repository.d.ts +4 -2
- package/dist/core/infra/iroh.repository.js +44 -39
- package/dist/core/infra/iroh.repository.js.map +1 -1
- package/dist/core/iroh.controller.d.ts +2 -1
- package/dist/core/iroh.controller.js +9 -8
- package/dist/core/iroh.controller.js.map +1 -1
- package/dist/core/iroh.service.d.ts +3 -1
- package/dist/core/iroh.service.js +28 -43
- package/dist/core/iroh.service.js.map +1 -1
- package/dist/schematics/crud/files/ts/__name__.controller.ts +46 -3
- package/dist/schematics/crud/files/ts/infra/__name__.mapper.ts +1 -1
- package/dist/security/modules/device/device.controller.d.ts +2 -10
- package/dist/security/modules/device/device.controller.js +4 -97
- package/dist/security/modules/device/device.controller.js.map +1 -1
- package/dist/security/modules/device/device.service.d.ts +2 -19
- package/dist/security/modules/device/device.service.js +3 -154
- package/dist/security/modules/device/device.service.js.map +1 -1
- package/dist/security/modules/permission/permission.controller.d.ts +2 -10
- package/dist/security/modules/permission/permission.controller.js +4 -97
- package/dist/security/modules/permission/permission.controller.js.map +1 -1
- package/dist/security/modules/permission/permission.service.d.ts +2 -19
- package/dist/security/modules/permission/permission.service.js +3 -154
- package/dist/security/modules/permission/permission.service.js.map +1 -1
- package/dist/security/modules/role/role.controller.d.ts +2 -10
- package/dist/security/modules/role/role.controller.js +4 -97
- package/dist/security/modules/role/role.controller.js.map +1 -1
- package/dist/security/modules/role/role.service.d.ts +2 -19
- package/dist/security/modules/role/role.service.js +3 -154
- package/dist/security/modules/role/role.service.js.map +1 -1
- package/dist/security/modules/user/user.controller.d.ts +2 -10
- package/dist/security/modules/user/user.controller.js +4 -97
- package/dist/security/modules/user/user.controller.js.map +1 -1
- package/dist/security/modules/user/user.service.d.ts +3 -17
- package/dist/security/modules/user/user.service.js +7 -123
- package/dist/security/modules/user/user.service.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,105 +1,12 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.IrohDeviceController = void 0;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const common_3 = require("@nestjs/common");
|
|
19
|
-
const common_4 = require("@nestjs/common");
|
|
20
|
-
const common_5 = require("@nestjs/common");
|
|
21
|
-
const common_6 = require("@nestjs/common");
|
|
22
|
-
const response_handler_1 = require("../../../core/app/response-handler");
|
|
23
|
-
const interceptors_1 = require("../../../common/interceptors");
|
|
24
|
-
const filters_1 = require("../../../common/filters");
|
|
25
|
-
const dto_1 = require("../../../common/dto");
|
|
26
|
-
let IrohDeviceController = class IrohDeviceController {
|
|
4
|
+
const iroh_controller_1 = require("../../../core/iroh.controller");
|
|
5
|
+
class IrohDeviceController extends iroh_controller_1.IrohController {
|
|
27
6
|
constructor(service) {
|
|
7
|
+
super(service);
|
|
28
8
|
this.service = service;
|
|
29
9
|
}
|
|
30
|
-
|
|
31
|
-
return response_handler_1.ResponseHandler.async({
|
|
32
|
-
promise: this.service.create(body),
|
|
33
|
-
mapper: this.mapView.bind(this),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
async paginate(query) {
|
|
37
|
-
return response_handler_1.ResponseHandler.async({
|
|
38
|
-
promise: this.service.paginate(query),
|
|
39
|
-
mapper: this.mapViewList.bind(this),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async findById(id) {
|
|
43
|
-
const options = { logging: true };
|
|
44
|
-
return response_handler_1.ResponseHandler.async({
|
|
45
|
-
promise: this.service.findById(id, options),
|
|
46
|
-
mapper: this.mapView.bind(this),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async update(id, body) {
|
|
50
|
-
return response_handler_1.ResponseHandler.async({
|
|
51
|
-
promise: this.service.update(id, body),
|
|
52
|
-
mapper: this.mapView.bind(this),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
async remove(id) {
|
|
56
|
-
return response_handler_1.ResponseHandler.async({
|
|
57
|
-
promise: this.service.remove(id),
|
|
58
|
-
mapper: this.mapView.bind(this),
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
mapView(domain) {
|
|
62
|
-
return this.service.mapper.DomainToView(domain);
|
|
63
|
-
}
|
|
64
|
-
mapViewList(domains) {
|
|
65
|
-
return domains.map((domain) => this.service.mapper.DomainToView(domain));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
10
|
+
}
|
|
68
11
|
exports.IrohDeviceController = IrohDeviceController;
|
|
69
|
-
__decorate([
|
|
70
|
-
__param(0, (0, common_1.Body)()),
|
|
71
|
-
__metadata("design:type", Function),
|
|
72
|
-
__metadata("design:paramtypes", [Object]),
|
|
73
|
-
__metadata("design:returntype", Promise)
|
|
74
|
-
], IrohDeviceController.prototype, "create", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
__param(0, (0, common_2.Query)()),
|
|
77
|
-
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", [dto_1.SearchDto]),
|
|
79
|
-
__metadata("design:returntype", Promise)
|
|
80
|
-
], IrohDeviceController.prototype, "paginate", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [String]),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], IrohDeviceController.prototype, "findById", null);
|
|
87
|
-
__decorate([
|
|
88
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
89
|
-
__param(1, (0, common_1.Body)()),
|
|
90
|
-
__metadata("design:type", Function),
|
|
91
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
92
|
-
__metadata("design:returntype", Promise)
|
|
93
|
-
], IrohDeviceController.prototype, "update", null);
|
|
94
|
-
__decorate([
|
|
95
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
96
|
-
__metadata("design:type", Function),
|
|
97
|
-
__metadata("design:paramtypes", [String]),
|
|
98
|
-
__metadata("design:returntype", Promise)
|
|
99
|
-
], IrohDeviceController.prototype, "remove", null);
|
|
100
|
-
exports.IrohDeviceController = IrohDeviceController = __decorate([
|
|
101
|
-
(0, common_6.UseFilters)(filters_1.HttpExceptionFilter),
|
|
102
|
-
(0, common_5.UseInterceptors)(interceptors_1.LoggingInterceptor),
|
|
103
|
-
__metadata("design:paramtypes", [Object])
|
|
104
|
-
], IrohDeviceController);
|
|
105
12
|
//# sourceMappingURL=device.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.controller.js","sourceRoot":"","sources":["../../../../src/security/modules/device/device.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"device.controller.js","sourceRoot":"","sources":["../../../../src/security/modules/device/device.controller.ts"],"names":[],"mappings":";;;AAAA,mEAA+D;AAS/D,MAAsB,oBAOpB,SAAQ,gCAA+B;IACvC,YAAqB,OAAsC;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QADI,YAAO,GAAP,OAAO,CAA+B;IAE3D,CAAC;CACF;AAXD,oDAWC"}
|
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorHandler } from '../../../common';
|
|
3
|
-
import { SearchDto } from '../../../common/dto';
|
|
4
|
-
import { TimestampLogger } from '../../../common/';
|
|
5
|
-
import { LoggerOptions } from '../../../common/loggers';
|
|
6
|
-
import { Result } from '../../../core/app/result';
|
|
1
|
+
import { IrohService } from '../../../core/iroh.service';
|
|
7
2
|
import type { IEntityMapper } from '../../../common/interfaces';
|
|
8
3
|
import type { IGenericRepository } from '../../../common/interfaces';
|
|
9
|
-
import type { IGenericService } from '../../../common/interfaces';
|
|
10
4
|
import { GenericDevicePersistence } from './infra';
|
|
11
5
|
import { GenericDeviceDomain } from './domain';
|
|
12
6
|
import { GenericDeviceView } from './app';
|
|
13
7
|
import { IUpdatableDomain } from '../../../core/domain/generic.domain';
|
|
14
8
|
import { DtoMapper } from '../../../core/app';
|
|
15
|
-
export declare abstract class IrohDeviceService<M extends IEntityMapper<T, D, V>, T extends GenericDevicePersistence = ReturnType<M['DomainToPersistence']>, D extends GenericDeviceDomain = ReturnType<M['PersistenceToDomain']> & IUpdatableDomain<ReturnType<M['PersistenceToDomain']>>, V extends GenericDeviceView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>>
|
|
9
|
+
export declare abstract class IrohDeviceService<M extends IEntityMapper<T, D, V>, T extends GenericDevicePersistence = ReturnType<M['DomainToPersistence']>, D extends GenericDeviceDomain = ReturnType<M['PersistenceToDomain']> & IUpdatableDomain<ReturnType<M['PersistenceToDomain']>>, V extends GenericDeviceView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>> extends IrohService<M, T, D, V, DTO> {
|
|
16
10
|
readonly repository: IGenericRepository<T, D, V>;
|
|
17
|
-
readonly logger: TimestampLogger;
|
|
18
|
-
readonly handler: ErrorHandler;
|
|
19
|
-
readonly mapper: IEntityMapper<T, D, V>;
|
|
20
11
|
constructor(repository: IGenericRepository<T, D, V>);
|
|
21
|
-
create(dto: DTO): Promise<Result<D>>;
|
|
22
|
-
paginate(query: SearchDto): Promise<Result<D[]>>;
|
|
23
|
-
findAll(): Promise<Result<D[]>>;
|
|
24
|
-
findById(id: string, options?: LoggerOptions): Promise<Result<D>>;
|
|
25
|
-
findOne(query: FindOneOptions<T>, options?: LoggerOptions): Promise<Result<D>>;
|
|
26
|
-
update(id: string, updateDto: Partial<DTO>): Promise<Result<D>>;
|
|
27
|
-
remove(id: string): Promise<Result<D>>;
|
|
28
|
-
getRepository(): IGenericRepository<T, D, V>;
|
|
29
12
|
}
|
|
@@ -1,162 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IrohDeviceService = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const common_3 = require("../../../common/");
|
|
7
|
-
const result_1 = require("../../../core/app/result");
|
|
8
|
-
class IrohDeviceService {
|
|
4
|
+
const iroh_service_1 = require("../../../core/iroh.service");
|
|
5
|
+
class IrohDeviceService extends iroh_service_1.IrohService {
|
|
9
6
|
constructor(repository) {
|
|
7
|
+
super(repository);
|
|
10
8
|
this.repository = repository;
|
|
11
|
-
this.logger = new common_3.TimestampLogger(this.constructor.name);
|
|
12
|
-
this.handler = common_2.ErrorHandler.getInstance();
|
|
13
|
-
this.mapper = this.repository.mapper;
|
|
14
|
-
}
|
|
15
|
-
async create(dto) {
|
|
16
|
-
try {
|
|
17
|
-
this.logger.start();
|
|
18
|
-
const newDomain = dto.ToDomain(dto);
|
|
19
|
-
const createdDomain = await this.repository.create(newDomain);
|
|
20
|
-
const { id } = createdDomain;
|
|
21
|
-
this.logger.log(`${id} created successfully`);
|
|
22
|
-
return result_1.Result.Ok(createdDomain);
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
this.handler.catch(error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async paginate(query) {
|
|
29
|
-
try {
|
|
30
|
-
this.logger.start();
|
|
31
|
-
const domains = await this.repository.paginate(query);
|
|
32
|
-
const count = domains.length;
|
|
33
|
-
switch (count) {
|
|
34
|
-
case 0:
|
|
35
|
-
this.logger.log(`No entities found`);
|
|
36
|
-
return result_1.Result.Ok([]);
|
|
37
|
-
case 1: {
|
|
38
|
-
const message = `Successfully retrieved one entity with pagination`;
|
|
39
|
-
this.logger.log(message);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
default: {
|
|
43
|
-
const message = `Successfully retrieved ${count} entities with pagination`;
|
|
44
|
-
this.logger.log(message);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return result_1.Result.Ok(domains);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
this.handler.catch(error);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async findAll() {
|
|
55
|
-
try {
|
|
56
|
-
const domains = await this.repository.findAll();
|
|
57
|
-
const count = domains.length;
|
|
58
|
-
switch (count) {
|
|
59
|
-
case 0:
|
|
60
|
-
this.logger.log(`No entities found`);
|
|
61
|
-
return result_1.Result.Ok([]);
|
|
62
|
-
case 1: {
|
|
63
|
-
const message = `Successfully retrieved one entity with pagination`;
|
|
64
|
-
this.logger.log(message);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
default: {
|
|
68
|
-
const message = `Successfully retrieved ${count} entities with pagination`;
|
|
69
|
-
this.logger.log(message);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return result_1.Result.Ok(domains);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
this.handler.catch(error);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async findById(id, options = { logging: false }) {
|
|
80
|
-
try {
|
|
81
|
-
this.logger.start();
|
|
82
|
-
const domain = await this.repository.findById(id, options);
|
|
83
|
-
if (!domain) {
|
|
84
|
-
this.logger.log(`${id} not found`);
|
|
85
|
-
const { name } = this.repository.getMetadata();
|
|
86
|
-
const message = `${name} with id ${id} not found`;
|
|
87
|
-
return result_1.Result.Fail(new common_1.NotFoundException(message));
|
|
88
|
-
}
|
|
89
|
-
if (options.logging) {
|
|
90
|
-
const { id } = domain;
|
|
91
|
-
const message = `${id} found successfully`;
|
|
92
|
-
this.logger.log(message);
|
|
93
|
-
}
|
|
94
|
-
return result_1.Result.Ok(domain);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
this.handler.catch(error);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async findOne(query, options = { logging: false }) {
|
|
101
|
-
try {
|
|
102
|
-
this.logger.start();
|
|
103
|
-
const domain = await this.repository.findOne(query, options);
|
|
104
|
-
if (!domain) {
|
|
105
|
-
this.logger.log(`Entity not found by query`);
|
|
106
|
-
const { name } = this.repository.getMetadata();
|
|
107
|
-
return result_1.Result.Fail(new common_1.NotFoundException(`${name} not found`));
|
|
108
|
-
}
|
|
109
|
-
if (options.logging) {
|
|
110
|
-
const { id } = domain;
|
|
111
|
-
const message = `${id} found successfully`;
|
|
112
|
-
this.logger.log(message);
|
|
113
|
-
}
|
|
114
|
-
return result_1.Result.Ok(domain);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
this.handler.catch(error);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async update(id, updateDto) {
|
|
121
|
-
try {
|
|
122
|
-
this.logger.start();
|
|
123
|
-
const found = await this.repository.findById(id);
|
|
124
|
-
if (!found) {
|
|
125
|
-
this.logger.log(`${id} not found`);
|
|
126
|
-
const { name } = this.repository.getMetadata();
|
|
127
|
-
const message = `${name} with id ${id} not found`;
|
|
128
|
-
return result_1.Result.Fail(new common_1.NotFoundException(message));
|
|
129
|
-
}
|
|
130
|
-
const domain = found;
|
|
131
|
-
domain.update(updateDto);
|
|
132
|
-
const updatedDomain = await this.repository.save(domain);
|
|
133
|
-
this.logger.log(`${id} updated successfully`);
|
|
134
|
-
return result_1.Result.Ok(updatedDomain);
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
this.handler.catch(error);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async remove(id) {
|
|
141
|
-
try {
|
|
142
|
-
this.logger.start();
|
|
143
|
-
const domain = await this.repository.findById(id);
|
|
144
|
-
if (!domain) {
|
|
145
|
-
this.logger.log(`${id} not found`);
|
|
146
|
-
const { name } = this.repository.getMetadata();
|
|
147
|
-
const message = `${name} with id ${id} not found`;
|
|
148
|
-
return result_1.Result.Fail(new common_1.NotFoundException(message));
|
|
149
|
-
}
|
|
150
|
-
await this.repository.remove(id);
|
|
151
|
-
this.logger.log(`${id} removed successfully`);
|
|
152
|
-
return result_1.Result.Ok(domain);
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
this.handler.catch(error);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
getRepository() {
|
|
159
|
-
return this.repository;
|
|
160
9
|
}
|
|
161
10
|
}
|
|
162
11
|
exports.IrohDeviceService = IrohDeviceService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.service.js","sourceRoot":"","sources":["../../../../src/security/modules/device/device.service.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"device.service.js","sourceRoot":"","sources":["../../../../src/security/modules/device/device.service.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AASzD,MAAsB,iBAOpB,SAAQ,0BAA4B;IACpC,YAAqB,UAAuC;QAC1D,KAAK,CAAC,UAAU,CAAC,CAAC;QADC,eAAU,GAAV,UAAU,CAA6B;IAE5D,CAAC;CACF;AAXD,8CAWC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IrohController } from '../../../core/iroh.controller';
|
|
2
2
|
import type { IGenericService } from '../../../common/interfaces';
|
|
3
3
|
import type { IEntityMapper } from '../../../common/interfaces';
|
|
4
4
|
import { GenericPermissionPersistence } from './infra';
|
|
@@ -6,15 +6,7 @@ import { GenericPermissionDomain } from './domain';
|
|
|
6
6
|
import { GenericPermissionView } from './app';
|
|
7
7
|
import { IUpdatableDomain } from '../../../core/domain/generic.domain';
|
|
8
8
|
import { DtoMapper } from '../../../core/app';
|
|
9
|
-
|
|
10
|
-
export declare abstract class IrohPermissionController<M extends IEntityMapper<T, D, V>, T extends GenericPermissionPersistence = ReturnType<M['DomainToPersistence']>, D extends GenericPermissionDomain = ReturnType<M['PersistenceToDomain']> & IUpdatableDomain<ReturnType<M['PersistenceToDomain']>>, V extends GenericPermissionView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>> implements IGenericController<D, V, DTO> {
|
|
9
|
+
export declare abstract class IrohPermissionController<M extends IEntityMapper<T, D, V>, T extends GenericPermissionPersistence = ReturnType<M['DomainToPersistence']>, D extends GenericPermissionDomain = ReturnType<M['PersistenceToDomain']> & IUpdatableDomain<ReturnType<M['PersistenceToDomain']>>, V extends GenericPermissionView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>> extends IrohController<M, T, D, V, DTO> {
|
|
11
10
|
readonly service: IGenericService<T, D, V, DTO>;
|
|
12
11
|
constructor(service: IGenericService<T, D, V, DTO>);
|
|
13
|
-
create(body: DTO): Promise<V>;
|
|
14
|
-
paginate(query: SearchDto): Promise<V[]>;
|
|
15
|
-
findById(id: string): Promise<V>;
|
|
16
|
-
update(id: string, body: Partial<DTO>): Promise<V>;
|
|
17
|
-
remove(id: string): Promise<V>;
|
|
18
|
-
mapView(domain: D): V;
|
|
19
|
-
mapViewList(domains: D[]): V[];
|
|
20
12
|
}
|
|
@@ -1,105 +1,12 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.IrohPermissionController = void 0;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const common_3 = require("@nestjs/common");
|
|
19
|
-
const common_4 = require("@nestjs/common");
|
|
20
|
-
const common_5 = require("@nestjs/common");
|
|
21
|
-
const common_6 = require("@nestjs/common");
|
|
22
|
-
const response_handler_1 = require("../../../core/app/response-handler");
|
|
23
|
-
const interceptors_1 = require("./../../../common/interceptors");
|
|
24
|
-
const filters_1 = require("./../../../common/filters");
|
|
25
|
-
const dto_1 = require("../../../common/dto");
|
|
26
|
-
let IrohPermissionController = class IrohPermissionController {
|
|
4
|
+
const iroh_controller_1 = require("../../../core/iroh.controller");
|
|
5
|
+
class IrohPermissionController extends iroh_controller_1.IrohController {
|
|
27
6
|
constructor(service) {
|
|
7
|
+
super(service);
|
|
28
8
|
this.service = service;
|
|
29
9
|
}
|
|
30
|
-
|
|
31
|
-
return response_handler_1.ResponseHandler.async({
|
|
32
|
-
promise: this.service.create(body),
|
|
33
|
-
mapper: this.mapView.bind(this),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
async paginate(query) {
|
|
37
|
-
return response_handler_1.ResponseHandler.async({
|
|
38
|
-
promise: this.service.paginate(query),
|
|
39
|
-
mapper: this.mapViewList.bind(this),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async findById(id) {
|
|
43
|
-
const options = { logging: true };
|
|
44
|
-
return response_handler_1.ResponseHandler.async({
|
|
45
|
-
promise: this.service.findById(id, options),
|
|
46
|
-
mapper: this.mapView.bind(this),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async update(id, body) {
|
|
50
|
-
return response_handler_1.ResponseHandler.async({
|
|
51
|
-
promise: this.service.update(id, body),
|
|
52
|
-
mapper: this.mapView.bind(this),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
async remove(id) {
|
|
56
|
-
return response_handler_1.ResponseHandler.async({
|
|
57
|
-
promise: this.service.remove(id),
|
|
58
|
-
mapper: this.mapView.bind(this),
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
mapView(domain) {
|
|
62
|
-
return this.service.mapper.DomainToView(domain);
|
|
63
|
-
}
|
|
64
|
-
mapViewList(domains) {
|
|
65
|
-
return domains.map((domain) => this.service.mapper.DomainToView(domain));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
10
|
+
}
|
|
68
11
|
exports.IrohPermissionController = IrohPermissionController;
|
|
69
|
-
__decorate([
|
|
70
|
-
__param(0, (0, common_1.Body)()),
|
|
71
|
-
__metadata("design:type", Function),
|
|
72
|
-
__metadata("design:paramtypes", [Object]),
|
|
73
|
-
__metadata("design:returntype", Promise)
|
|
74
|
-
], IrohPermissionController.prototype, "create", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
__param(0, (0, common_2.Query)()),
|
|
77
|
-
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", [dto_1.SearchDto]),
|
|
79
|
-
__metadata("design:returntype", Promise)
|
|
80
|
-
], IrohPermissionController.prototype, "paginate", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [String]),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], IrohPermissionController.prototype, "findById", null);
|
|
87
|
-
__decorate([
|
|
88
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
89
|
-
__param(1, (0, common_1.Body)()),
|
|
90
|
-
__metadata("design:type", Function),
|
|
91
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
92
|
-
__metadata("design:returntype", Promise)
|
|
93
|
-
], IrohPermissionController.prototype, "update", null);
|
|
94
|
-
__decorate([
|
|
95
|
-
__param(0, (0, common_3.Param)('id', common_4.ParseUUIDPipe)),
|
|
96
|
-
__metadata("design:type", Function),
|
|
97
|
-
__metadata("design:paramtypes", [String]),
|
|
98
|
-
__metadata("design:returntype", Promise)
|
|
99
|
-
], IrohPermissionController.prototype, "remove", null);
|
|
100
|
-
exports.IrohPermissionController = IrohPermissionController = __decorate([
|
|
101
|
-
(0, common_6.UseFilters)(filters_1.HttpExceptionFilter),
|
|
102
|
-
(0, common_5.UseInterceptors)(interceptors_1.LoggingInterceptor),
|
|
103
|
-
__metadata("design:paramtypes", [Object])
|
|
104
|
-
], IrohPermissionController);
|
|
105
12
|
//# sourceMappingURL=permission.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.controller.js","sourceRoot":"","sources":["../../../../src/security/modules/permission/permission.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permission.controller.js","sourceRoot":"","sources":["../../../../src/security/modules/permission/permission.controller.ts"],"names":[],"mappings":";;;AAAA,mEAA+D;AAS/D,MAAsB,wBAOpB,SAAQ,gCAA+B;IACvC,YAAqB,OAAsC;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QADI,YAAO,GAAP,OAAO,CAA+B;IAE3D,CAAC;CACF;AAXD,4DAWC"}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorHandler } from '../../../common';
|
|
1
|
+
import { IrohService } from '../../../core/iroh.service';
|
|
3
2
|
import { GenericPermissionPersistence } from './infra';
|
|
4
|
-
import { Result } from '../../../core/app/result';
|
|
5
3
|
import { GenericPermissionDomain } from './domain';
|
|
6
4
|
import { GenericPermissionView } from './app';
|
|
7
|
-
import { TimestampLogger } from '../../../common/';
|
|
8
|
-
import { LoggerOptions } from '../../../common/loggers';
|
|
9
|
-
import { SearchDto } from '../../../common/dto';
|
|
10
5
|
import type { IEntityMapper } from '../../../common/interfaces';
|
|
11
6
|
import type { IGenericRepository } from '../../../common/interfaces';
|
|
12
|
-
import type { IGenericService } from '../../../common/interfaces';
|
|
13
7
|
import { DtoMapper } from '../../../core/app';
|
|
14
|
-
export declare abstract class IrohPermissionService<M extends IEntityMapper<T, D, V>, T extends GenericPermissionPersistence = ReturnType<M['DomainToPersistence']>, D extends GenericPermissionDomain = ReturnType<M['PersistenceToDomain']>, V extends GenericPermissionView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>>
|
|
8
|
+
export declare abstract class IrohPermissionService<M extends IEntityMapper<T, D, V>, T extends GenericPermissionPersistence = ReturnType<M['DomainToPersistence']>, D extends GenericPermissionDomain = ReturnType<M['PersistenceToDomain']>, V extends GenericPermissionView = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>> extends IrohService<M, T, D, V, DTO> {
|
|
15
9
|
readonly repository: IGenericRepository<T, D, V>;
|
|
16
|
-
readonly logger: TimestampLogger;
|
|
17
|
-
readonly handler: ErrorHandler;
|
|
18
|
-
readonly mapper: IEntityMapper<T, D, V>;
|
|
19
10
|
constructor(repository: IGenericRepository<T, D, V>);
|
|
20
|
-
create(dto: DTO): Promise<Result<D>>;
|
|
21
|
-
paginate(query: SearchDto): Promise<Result<D[]>>;
|
|
22
|
-
findAll(): Promise<Result<D[]>>;
|
|
23
|
-
findById(id: string, options?: LoggerOptions): Promise<Result<D>>;
|
|
24
|
-
findOne(query: FindOneOptions<T>, options?: LoggerOptions): Promise<Result<D>>;
|
|
25
|
-
update(id: string, updateDto: Partial<DTO>): Promise<Result<D>>;
|
|
26
|
-
remove(id: string): Promise<Result<D>>;
|
|
27
|
-
getRepository(): IGenericRepository<T, D, V>;
|
|
28
11
|
}
|