@rafikidota/iroh 0.45.0 → 0.47.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/dist/common/database/typeorm-unit-of-work/interfaces/IUnitOfWork.d.ts +2 -2
- package/dist/common/database/typeorm-unit-of-work/typeorm-unit-of-work.provider.d.ts +2 -2
- package/dist/common/database/typeorm-unit-of-work/typeorm-unit-of-work.provider.js.map +1 -1
- package/dist/common/decorators/api-response.decorator.d.ts +2 -0
- package/dist/common/decorators/api-response.decorator.js +23 -0
- package/dist/common/decorators/api-response.decorator.js.map +1 -0
- package/dist/common/decorators/entity-response.decorator.d.ts +2 -0
- package/dist/common/decorators/entity-response.decorator.js +23 -0
- package/dist/common/decorators/entity-response.decorator.js.map +1 -0
- package/dist/common/decorators/generic-delete.decorator.d.ts +1 -1
- package/dist/common/decorators/generic-delete.decorator.js +4 -4
- package/dist/common/decorators/generic-delete.decorator.js.map +1 -1
- package/dist/common/decorators/generic-get-by-id.decorator.d.ts +1 -1
- package/dist/common/decorators/generic-get-by-id.decorator.js +6 -5
- package/dist/common/decorators/generic-get-by-id.decorator.js.map +1 -1
- package/dist/common/decorators/generic-get.decorator.d.ts +1 -1
- package/dist/common/decorators/generic-get.decorator.js +5 -6
- package/dist/common/decorators/generic-get.decorator.js.map +1 -1
- package/dist/common/decorators/generic-patch.decorator.d.ts +1 -1
- package/dist/common/decorators/generic-patch.decorator.js +6 -9
- package/dist/common/decorators/generic-patch.decorator.js.map +1 -1
- package/dist/common/decorators/generic-post.decorator.d.ts +1 -1
- package/dist/common/decorators/generic-post.decorator.js +6 -9
- package/dist/common/decorators/generic-post.decorator.js.map +1 -1
- package/dist/common/decorators/handle-response.decorator.d.ts +7 -0
- package/dist/common/decorators/handle-response.decorator.js +36 -0
- package/dist/common/decorators/handle-response.decorator.js.map +1 -0
- package/dist/common/decorators/index.d.ts +3 -1
- package/dist/common/decorators/index.js +3 -1
- package/dist/common/decorators/index.js.map +1 -1
- package/dist/common/decorators/pagination.decorator.js +12 -8
- package/dist/common/decorators/pagination.decorator.js.map +1 -1
- package/dist/common/dto/index.d.ts +1 -0
- package/dist/common/dto/index.js +1 -0
- package/dist/common/dto/index.js.map +1 -1
- package/dist/common/dto/pagination.view.d.ts +9 -4
- package/dist/common/dto/pagination.view.js +28 -13
- package/dist/common/dto/pagination.view.js.map +1 -1
- package/dist/common/dto/response.view.d.ts +9 -0
- package/dist/common/dto/response.view.js +46 -0
- package/dist/common/dto/response.view.js.map +1 -0
- 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.repository.d.ts +3 -3
- package/dist/common/interfaces/crud.service.d.ts +5 -5
- package/dist/common/interfaces/exception-mapper.d.ts +5 -0
- package/dist/common/interfaces/exception-mapper.js +3 -0
- package/dist/common/interfaces/exception-mapper.js.map +1 -0
- package/dist/common/interfaces/generic.mapper.d.ts +1 -1
- package/dist/common/interfaces/generic.props.d.ts +1 -1
- package/dist/common/interfaces/index.d.ts +1 -0
- package/dist/common/interfaces/index.js +1 -0
- package/dist/common/interfaces/index.js.map +1 -1
- package/dist/common/interfaces/nomenclator.props.d.ts +2 -2
- package/dist/common/types/pagination.d.ts +9 -4
- package/dist/core/app/dto/generic.create.dto.d.ts +3 -3
- package/dist/core/app/dto/generic.create.dto.js +3 -3
- package/dist/core/app/dto/generic.create.dto.js.map +1 -1
- package/dist/core/app/response-handler.d.ts +3 -2
- package/dist/core/app/response-handler.js +8 -2
- package/dist/core/app/response-handler.js.map +1 -1
- package/dist/core/domain/generic.domain.d.ts +1 -1
- package/dist/core/infra/iroh.mapper.d.ts +2 -2
- package/dist/core/infra/iroh.mapper.js +3 -3
- package/dist/core/infra/iroh.mapper.js.map +1 -1
- package/dist/core/infra/iroh.repository.d.ts +8 -8
- package/dist/core/infra/iroh.repository.js +17 -12
- package/dist/core/infra/iroh.repository.js.map +1 -1
- package/dist/core/iroh.controller.d.ts +5 -5
- package/dist/core/iroh.controller.js.map +1 -1
- package/dist/core/iroh.service.d.ts +8 -8
- package/dist/core/iroh.service.js +3 -3
- package/dist/core/iroh.service.js.map +1 -1
- package/package.json +9 -9
- package/dist/common/decorators/use-dto.decorator.d.ts +0 -6
- package/dist/common/decorators/use-dto.decorator.js +0 -34
- package/dist/common/decorators/use-dto.decorator.js.map +0 -1
|
@@ -3,9 +3,9 @@ import { UnitOfWorkResponse } from '../unit-of-work.response.type';
|
|
|
3
3
|
import { Persistence } from '../../../../core/infra/generic.persistence';
|
|
4
4
|
import { View } from '../../../../core/app/dto/generic.view';
|
|
5
5
|
import { Domain } from '../../../../core/domain/generic.domain';
|
|
6
|
-
import {
|
|
6
|
+
import { IRepository } from '../../../interfaces/crud.repository';
|
|
7
7
|
export interface IUnitOfWork {
|
|
8
8
|
start(): Promise<void> | void;
|
|
9
9
|
commit<T>(work: () => Promise<UnitOfWorkResponse<T>>): Promise<UnitOfWorkResponse<T>>;
|
|
10
|
-
getRepository<T extends Persistence = Persistence, D extends Domain = Domain, V extends View = View, R extends
|
|
10
|
+
getRepository<T extends Persistence = Persistence, D extends Domain = Domain, V extends View = View, R extends IRepository<T, D, V> = IRepository<T, D, V>>(Repo: Type<R>): R;
|
|
11
11
|
}
|
|
@@ -7,7 +7,7 @@ import { IUnitOfWork } from './interfaces';
|
|
|
7
7
|
import { Persistence } from '../../../core/infra/generic.persistence';
|
|
8
8
|
import { Domain } from '../../../core/domain/generic.domain';
|
|
9
9
|
import { View } from '../../../core/app/dto/generic.view';
|
|
10
|
-
import {
|
|
10
|
+
import { IRepository } from '../../interfaces/crud.repository';
|
|
11
11
|
import { Result } from '../../../core/app/result';
|
|
12
12
|
export declare class TypeOrmUnitOfWork implements IUnitOfWork {
|
|
13
13
|
private readonly dataSource;
|
|
@@ -16,7 +16,7 @@ export declare class TypeOrmUnitOfWork implements IUnitOfWork {
|
|
|
16
16
|
private logger;
|
|
17
17
|
constructor(dataSource: DataSource);
|
|
18
18
|
getQueryRunner(): QueryRunner;
|
|
19
|
-
getRepository<T extends Persistence = Persistence, D extends Domain = Domain, V extends View = View, R extends
|
|
19
|
+
getRepository<T extends Persistence = Persistence, D extends Domain = Domain, V extends View = View, R extends IRepository<T, D, V> = IRepository<T, D, V>>(Repo: Type<IRepository<T, D, V>>): R;
|
|
20
20
|
getRepositoryEntity<T>(repo: Type<T>): Repository<T>;
|
|
21
21
|
start(isolationLevel?: IsolationLevel): Promise<void>;
|
|
22
22
|
commit<T>(work: () => Promise<Result<T>>): Promise<Result<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-unit-of-work.provider.js","sourceRoot":"","sources":["../../../../src/common/database/typeorm-unit-of-work/typeorm-unit-of-work.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAA8D;AAC9D,2CAAuC;AAEvC,qCAAqC;AAIrC,+BAAkC;AAMlC,qDAAkD;AAClD,+EAA2E;AAGpE,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAK5B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAF3C,WAAM,GAAoB,IAAI,kCAAe,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QAG5E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;QACvD,IAAI,CAAC,EAAE,GAAG,IAAA,SAAI,GAAE,CAAC;IACnB,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,aAAa,CAKX,
|
|
1
|
+
{"version":3,"file":"typeorm-unit-of-work.provider.js","sourceRoot":"","sources":["../../../../src/common/database/typeorm-unit-of-work/typeorm-unit-of-work.provider.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiResponse = ApiResponse;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const swagger_2 = require("@nestjs/swagger");
|
|
7
|
+
const swagger_3 = require("@nestjs/swagger");
|
|
8
|
+
const response_view_1 = require("../dto/response.view");
|
|
9
|
+
function ApiResponse(View, description) {
|
|
10
|
+
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(response_view_1.ResponseView, View), (0, swagger_2.ApiResponse)({
|
|
11
|
+
status: 200,
|
|
12
|
+
description,
|
|
13
|
+
schema: {
|
|
14
|
+
allOf: [{ $ref: (0, swagger_3.getSchemaPath)(response_view_1.ResponseView) }],
|
|
15
|
+
properties: {
|
|
16
|
+
payload: {
|
|
17
|
+
$ref: (0, swagger_3.getSchemaPath)(View),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=api-response.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-response.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/api-response.decorator.ts"],"names":[],"mappings":";;AAOA,kCAgBC;AAvBD,2CAAiD;AAEjD,6CAAiD;AACjD,6CAAwE;AACxE,6CAAgD;AAChD,wDAAoD;AAEpD,SAAgB,WAAW,CAAI,IAAa,EAAE,WAAmB;IAC/D,OAAO,IAAA,wBAAe,EACpB,IAAA,wBAAc,EAAC,4BAAY,EAAE,IAAI,CAAC,EAClC,IAAA,qBAAsB,EAAC;QACrB,MAAM,EAAE,GAAG;QACX,WAAW;QACX,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,4BAAY,CAAC,EAAE,CAAC;YAC9C,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,IAAA,uBAAa,EAAC,IAAI,CAAC;iBAC1B;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityResponse = EntityResponse;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const swagger_2 = require("@nestjs/swagger");
|
|
7
|
+
const swagger_3 = require("@nestjs/swagger");
|
|
8
|
+
const response_view_1 = require("../dto/response.view");
|
|
9
|
+
function EntityResponse(View, description) {
|
|
10
|
+
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(response_view_1.ResponseView, View), (0, swagger_2.ApiResponse)({
|
|
11
|
+
status: 200,
|
|
12
|
+
description,
|
|
13
|
+
schema: {
|
|
14
|
+
allOf: [{ $ref: (0, swagger_3.getSchemaPath)(response_view_1.ResponseView) }],
|
|
15
|
+
properties: {
|
|
16
|
+
payload: {
|
|
17
|
+
$ref: (0, swagger_3.getSchemaPath)(View),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=entity-response.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-response.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/entity-response.decorator.ts"],"names":[],"mappings":";;AAOA,wCAgBC;AAvBD,2CAAiD;AAEjD,6CAAiD;AACjD,6CAA8C;AAC9C,6CAAgD;AAChD,wDAAoD;AAEpD,SAAgB,cAAc,CAAI,IAAa,EAAE,WAAmB;IAClE,OAAO,IAAA,wBAAe,EACpB,IAAA,wBAAc,EAAC,4BAAY,EAAE,IAAI,CAAC,EAClC,IAAA,qBAAW,EAAC;QACV,MAAM,EAAE,GAAG;QACX,WAAW;QACX,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,4BAAY,CAAC,EAAE,CAAC;YAC9C,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,IAAA,uBAAa,EAAC,IAAI,CAAC;iBAC1B;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function Delete(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Delete = Delete;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const common_2 = require("@nestjs/common");
|
|
6
|
-
const common_3 = require("@nestjs/common");
|
|
7
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
|
|
7
|
+
const handle_response_decorator_1 = require("./handle-response.decorator");
|
|
8
|
+
function Delete() {
|
|
9
9
|
return (0, common_1.applyDecorators)((0, common_2.Delete)(':id'), (0, swagger_1.ApiResponse)({
|
|
10
10
|
status: 204,
|
|
11
11
|
description: `Entity was deleted successfully`,
|
|
12
|
-
}), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, swagger_1.ApiResponse)({ status: 404, description: 'Not found' }), (0,
|
|
12
|
+
}), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, swagger_1.ApiResponse)({ status: 404, description: 'Not found' }), (0, handle_response_decorator_1.HandleResponse)(), (0, common_1.HttpCode)(204));
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=generic-delete.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-delete.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-delete.decorator.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"generic-delete.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-delete.decorator.ts"],"names":[],"mappings":";;AAKA,wBAcC;AAnBD,2CAA2D;AAC3D,2CAAsD;AACtD,6CAA8C;AAC9C,2EAA6D;AAE7D,SAAgB,MAAM;IACpB,OAAO,IAAA,wBAAe,EACpB,IAAA,eAAU,EAAC,KAAK,CAAC,EACjB,IAAA,qBAAW,EAAC;QACV,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,iCAAiC;KAC/C,CAAC,EACF,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EACzD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,0CAAc,GAAE,EAChB,IAAA,iBAAQ,EAAC,GAAG,CAAC,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function GetById<V>(View: Type<V>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GetById = GetById;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const common_2 = require("@nestjs/common");
|
|
6
|
-
const common_3 = require("@nestjs/common");
|
|
7
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
const swagger_2 = require("@nestjs/swagger");
|
|
9
7
|
const validation_pipe_1 = require("../pipes/validation.pipe");
|
|
10
8
|
const search_dto_1 = require("../dto/search.dto");
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const entity_response_decorator_1 = require("./entity-response.decorator");
|
|
10
|
+
const handle_response_decorator_1 = require("./handle-response.decorator");
|
|
11
|
+
const description = `Entity found by id`;
|
|
12
|
+
function GetById(View) {
|
|
13
|
+
return (0, common_1.applyDecorators)((0, common_2.Get)(':id'), (0, swagger_1.ApiQuery)({ name: 'options', type: String, required: false }), (0, entity_response_decorator_1.EntityResponse)(View, description), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, swagger_1.ApiResponse)({ status: 404, description: 'Not found' }), (0, common_2.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(search_dto_1.SearchDto)), (0, handle_response_decorator_1.HandleResponse)());
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=generic-get-by-id.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-get-by-id.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-get-by-id.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generic-get-by-id.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-get-by-id.decorator.ts"],"names":[],"mappings":";;AAWA,0BAYC;AAvBD,2CAAuD;AACvD,2CAA+C;AAC/C,6CAAwD;AACxD,8DAAiE;AAEjE,kDAA8C;AAC9C,2EAA6D;AAC7D,2EAA6D;AAE7D,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC,SAAgB,OAAO,CAAI,IAAa;IACtC,OAAO,IAAA,wBAAe,EACpB,IAAA,YAAG,EAAC,KAAK,CAAC,EACV,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAC5D,IAAA,0CAAc,EAAC,IAAI,EAAE,WAAW,CAAC,EACjC,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EACzD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,iBAAQ,EAAC,IAAA,uCAAqB,EAAC,sBAAS,CAAC,CAAC,EAC1C,IAAA,0CAAc,GAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function Get<V>(View: Type<V>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Get = Get;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const common_2 = require("@nestjs/common");
|
|
6
|
-
const common_3 = require("@nestjs/common");
|
|
7
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
const
|
|
7
|
+
const pagination_decorator_1 = require("./pagination.decorator");
|
|
9
8
|
const validation_pipe_1 = require("../pipes/validation.pipe");
|
|
10
9
|
const search_dto_1 = require("../dto/search.dto");
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return (0, common_1.applyDecorators)((0, common_2.Get)(), (0, swagger_1.ApiQuery)({ name: 'page', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'limit', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'offset', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'options', type: String, required: false }), (0, pagination_decorator_1.PaginationResponse)(View), (0,
|
|
10
|
+
const handle_response_decorator_1 = require("./handle-response.decorator");
|
|
11
|
+
function Get(View) {
|
|
12
|
+
return (0, common_1.applyDecorators)((0, common_2.Get)(), (0, swagger_1.ApiQuery)({ name: 'page', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'limit', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'offset', type: Number, required: false }), (0, swagger_1.ApiQuery)({ name: 'options', type: String, required: false }), (0, pagination_decorator_1.PaginationResponse)(View), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, common_2.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(search_dto_1.SearchDto)), (0, handle_response_decorator_1.HandleResponse)());
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=generic-get.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-get.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-get.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generic-get.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-get.decorator.ts"],"names":[],"mappings":";;AASA,kBAcC;AAvBD,2CAAuD;AACvD,2CAA0D;AAC1D,6CAAwD;AAExD,iEAA4D;AAC5D,8DAAiE;AACjE,kDAA8C;AAC9C,2EAA6D;AAE7D,SAAgB,GAAG,CAAI,IAAa;IAClC,OAAO,IAAA,wBAAe,EACpB,IAAA,YAAO,GAAE,EACT,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EACzD,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAC1D,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAC3D,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAC5D,IAAA,yCAAkB,EAAC,IAAI,CAAC,EACxB,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EACzD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,iBAAQ,EAAC,IAAA,uCAAqB,EAAC,sBAAS,CAAC,CAAC,EAC1C,IAAA,0CAAc,GAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function Patch<U, V>(UpdateDto: Type<U>, View: Type<V>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Patch = Patch;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const common_2 = require("@nestjs/common");
|
|
6
|
-
const common_3 = require("@nestjs/common");
|
|
7
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
const
|
|
7
|
+
const entity_response_decorator_1 = require("./entity-response.decorator");
|
|
9
8
|
const validation_pipe_1 = require("../pipes/validation.pipe");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type: View,
|
|
15
|
-
}), (0, swagger_2.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_2.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_2.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, swagger_2.ApiResponse)({ status: 404, description: 'Not found' }), (0, common_3.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(UpdateDto)));
|
|
9
|
+
const handle_response_decorator_1 = require("./handle-response.decorator");
|
|
10
|
+
const description = `Entity was updated successfully`;
|
|
11
|
+
function Patch(UpdateDto, View) {
|
|
12
|
+
return (0, common_1.applyDecorators)((0, common_2.Patch)(':id'), (0, swagger_1.ApiBody)({ type: UpdateDto }), (0, entity_response_decorator_1.EntityResponse)(View, description), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, swagger_1.ApiResponse)({ status: 404, description: 'Not found' }), (0, common_2.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(UpdateDto)), (0, handle_response_decorator_1.HandleResponse)());
|
|
16
13
|
}
|
|
17
14
|
//# sourceMappingURL=generic-patch.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-patch.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-patch.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generic-patch.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-patch.decorator.ts"],"names":[],"mappings":";;AAUA,sBAYC;AAtBD,2CAAuD;AACvD,2CAA8D;AAC9D,6CAAuD;AAEvD,2EAA6D;AAC7D,8DAAiE;AACjE,2EAA6D;AAE7D,MAAM,WAAW,GAAG,iCAAiC,CAAC;AAEtD,SAAgB,KAAK,CAAO,SAAkB,EAAE,IAAa;IAC3D,OAAO,IAAA,wBAAe,EACpB,IAAA,cAAS,EAAC,KAAK,CAAC,EAChB,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC5B,IAAA,0CAAc,EAAC,IAAI,EAAE,WAAW,CAAC,EACjC,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EACzD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,iBAAQ,EAAC,IAAA,uCAAqB,EAAC,SAAS,CAAC,CAAC,EAC1C,IAAA,0CAAc,GAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function Post<D, V>(CreateDto: Type<D>, View: Type<V>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Post = Post;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const common_2 = require("@nestjs/common");
|
|
6
|
-
const common_3 = require("@nestjs/common");
|
|
7
6
|
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
-
const
|
|
7
|
+
const entity_response_decorator_1 = require("./entity-response.decorator");
|
|
9
8
|
const validation_pipe_1 = require("../pipes/validation.pipe");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type: View,
|
|
15
|
-
}), (0, swagger_2.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_2.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_2.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, common_3.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(CreateDto)));
|
|
9
|
+
const handle_response_decorator_1 = require("./handle-response.decorator");
|
|
10
|
+
const description = `Entity was created successfully`;
|
|
11
|
+
function Post(CreateDto, View) {
|
|
12
|
+
return (0, common_1.applyDecorators)((0, common_2.Post)(), (0, swagger_1.ApiBody)({ type: CreateDto }), (0, entity_response_decorator_1.EntityResponse)(View, description), (0, swagger_1.ApiResponse)({ status: 400, description: 'Bad request' }), (0, swagger_1.ApiResponse)({ status: 401, description: 'Unauthorized' }), (0, swagger_1.ApiResponse)({ status: 403, description: 'Forbidden' }), (0, common_2.UsePipes)((0, validation_pipe_1.GenericValidationPipe)(CreateDto)), (0, handle_response_decorator_1.HandleResponse)());
|
|
16
13
|
}
|
|
17
14
|
//# sourceMappingURL=generic-post.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-post.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-post.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generic-post.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/generic-post.decorator.ts"],"names":[],"mappings":";;AAUA,oBAWC;AArBD,2CAAuD;AACvD,2CAA4D;AAC5D,6CAAuD;AAEvD,2EAA6D;AAC7D,8DAAiE;AACjE,2EAA6D;AAE7D,MAAM,WAAW,GAAG,iCAAiC,CAAC;AAEtD,SAAgB,IAAI,CAAO,SAAkB,EAAE,IAAa;IAC1D,OAAO,IAAA,wBAAe,EACpB,IAAA,aAAQ,GAAE,EACV,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC5B,IAAA,0CAAc,EAAC,IAAI,EAAE,WAAW,CAAC,EACjC,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,EACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,EACzD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EACtD,IAAA,iBAAQ,EAAC,IAAA,uCAAqB,EAAC,SAAS,CAAC,CAAC,EAC1C,IAAA,0CAAc,GAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Type } from '@nestjs/common';
|
|
2
|
+
import { IMapper } from '../interfaces/generic.mapper';
|
|
3
|
+
import { IExceptionMapper } from '../interfaces/exception-mapper';
|
|
4
|
+
import { Persistence } from '../../core/infra/generic.persistence';
|
|
5
|
+
import { Domain } from '../../core/domain/generic.domain';
|
|
6
|
+
import { View } from '../../core/app/dto/generic.view';
|
|
7
|
+
export declare function HandleResponse<M extends IMapper<T, D, V>, T extends Persistence = ReturnType<M['DomainToPersistence']>, D extends Domain = ReturnType<M['PersistenceToDomain']>, V extends View = ReturnType<M['DomainToView']>>(Handler?: Type<IExceptionMapper>): MethodDecorator;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HandleResponse = HandleResponse;
|
|
4
|
+
const response_handler_1 = require("../../core/app/response-handler");
|
|
5
|
+
const iroh_service_1 = require("../../core/iroh.service");
|
|
6
|
+
function HandleResponse(Handler) {
|
|
7
|
+
return function (target, propertyKey, descriptor) {
|
|
8
|
+
const { value: method } = descriptor;
|
|
9
|
+
descriptor.value = function (...args) {
|
|
10
|
+
const result = method.apply(this, args);
|
|
11
|
+
const controller = this;
|
|
12
|
+
const mapper = () => {
|
|
13
|
+
if (controller?.service instanceof iroh_service_1.Service) {
|
|
14
|
+
const EntityMapper = controller.service.mapper;
|
|
15
|
+
return EntityMapper.DomainToView;
|
|
16
|
+
}
|
|
17
|
+
return (x) => x;
|
|
18
|
+
};
|
|
19
|
+
const handler = () => {
|
|
20
|
+
if (Handler) {
|
|
21
|
+
return Handler.prototype.handle;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
const params = { mapper: mapper(), handler: handler() };
|
|
26
|
+
if (result instanceof Promise) {
|
|
27
|
+
const promise = result;
|
|
28
|
+
return response_handler_1.ResponseHandler.async({ ...params, promise });
|
|
29
|
+
}
|
|
30
|
+
const data = result;
|
|
31
|
+
return response_handler_1.ResponseHandler.sync({ ...params, data });
|
|
32
|
+
};
|
|
33
|
+
return descriptor;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=handle-response.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-response.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/handle-response.decorator.ts"],"names":[],"mappings":";;AAWA,wCA4CC;AArDD,sEAAkE;AAOlE,0DAAkD;AAElD,SAAgB,cAAc,CAK5B,OAAgC;IAChC,OAAO,UACL,MAAW,EACX,WAA4B,EAC5B,UAA8B;QAE9B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAErC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;YACzC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACxC,MAAM,UAAU,GAAG,IAAW,CAAC;YAE/B,MAAM,MAAM,GAAG,GAAG,EAAE;gBAClB,IAAI,UAAU,EAAE,OAAO,YAAY,sBAAO,EAAE,CAAC;oBAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,MAAW,CAAC;oBACpD,OAAO,YAAY,CAAC,YAAY,CAAC;gBACnC,CAAC;gBACD,OAAO,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC;YAEF,MAAM,OAAO,GAAG,GAAG,EAAE;gBACnB,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;gBAClC,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;YAEF,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;YAExD,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;gBAC9B,MAAM,OAAO,GAAG,MAA4B,CAAC;gBAC7C,OAAO,kCAAe,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,MAAM,IAAI,GAAG,MAAmB,CAAC;YACjC,OAAO,kCAAe,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
export * from './api-response.decorator';
|
|
1
2
|
export * from './controller.decorator';
|
|
2
3
|
export * from './entity-id.decorator';
|
|
4
|
+
export * from './entity-response.decorator';
|
|
3
5
|
export * from './entity.decorator';
|
|
4
6
|
export * from './generic-delete.decorator';
|
|
5
7
|
export * from './generic-get-by-id.decorator';
|
|
6
8
|
export * from './generic-get.decorator';
|
|
7
9
|
export * from './generic-patch.decorator';
|
|
8
10
|
export * from './generic-post.decorator';
|
|
11
|
+
export * from './handle-response.decorator';
|
|
9
12
|
export * from './pagination.decorator';
|
|
10
13
|
export * from './param.decorator';
|
|
11
14
|
export * from './query-option.decorator';
|
|
12
15
|
export * from './query.decorator';
|
|
13
16
|
export * from './soft-unique.decorator';
|
|
14
|
-
export * from './use-dto.decorator';
|
|
@@ -14,18 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-response.decorator"), exports);
|
|
17
18
|
__exportStar(require("./controller.decorator"), exports);
|
|
18
19
|
__exportStar(require("./entity-id.decorator"), exports);
|
|
20
|
+
__exportStar(require("./entity-response.decorator"), exports);
|
|
19
21
|
__exportStar(require("./entity.decorator"), exports);
|
|
20
22
|
__exportStar(require("./generic-delete.decorator"), exports);
|
|
21
23
|
__exportStar(require("./generic-get-by-id.decorator"), exports);
|
|
22
24
|
__exportStar(require("./generic-get.decorator"), exports);
|
|
23
25
|
__exportStar(require("./generic-patch.decorator"), exports);
|
|
24
26
|
__exportStar(require("./generic-post.decorator"), exports);
|
|
27
|
+
__exportStar(require("./handle-response.decorator"), exports);
|
|
25
28
|
__exportStar(require("./pagination.decorator"), exports);
|
|
26
29
|
__exportStar(require("./param.decorator"), exports);
|
|
27
30
|
__exportStar(require("./query-option.decorator"), exports);
|
|
28
31
|
__exportStar(require("./query.decorator"), exports);
|
|
29
32
|
__exportStar(require("./soft-unique.decorator"), exports);
|
|
30
|
-
__exportStar(require("./use-dto.decorator"), exports);
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,wDAAsC;AACtC,qDAAmC;AACnC,6DAA2C;AAC3C,gEAA8C;AAC9C,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC;AAClC,0DAAwC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,yDAAuC;AACvC,wDAAsC;AACtC,8DAA4C;AAC5C,qDAAmC;AACnC,6DAA2C;AAC3C,gEAA8C;AAC9C,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC;AAClC,0DAAwC"}
|
|
@@ -3,22 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PaginationResponse = PaginationResponse;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
-
const
|
|
7
|
-
const swagger_3 = require("@nestjs/swagger");
|
|
6
|
+
const response_view_1 = require("../dto/response.view");
|
|
8
7
|
const pagination_view_1 = require("../dto/pagination.view");
|
|
9
8
|
const pagination_view_2 = require("../dto/pagination.view");
|
|
10
9
|
function PaginationResponse(View) {
|
|
11
|
-
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(pagination_view_1.PaginationView, View), (0,
|
|
10
|
+
return (0, common_1.applyDecorators)((0, swagger_1.ApiExtraModels)(response_view_1.ResponseView, pagination_view_1.PaginationView, View), (0, swagger_1.ApiResponse)({
|
|
12
11
|
status: 200,
|
|
13
12
|
description: `List of paginated entities`,
|
|
14
13
|
schema: {
|
|
15
|
-
allOf: [{ $ref: (0,
|
|
14
|
+
allOf: [{ $ref: (0, swagger_1.getSchemaPath)(response_view_1.ResponseView) }],
|
|
16
15
|
properties: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
payload: {
|
|
17
|
+
$ref: (0, swagger_1.getSchemaPath)(pagination_view_1.PaginationView),
|
|
18
|
+
properties: {
|
|
19
|
+
items: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
items: { $ref: (0, swagger_1.getSchemaPath)(View) },
|
|
22
|
+
},
|
|
23
|
+
pagination: { $ref: (0, swagger_1.getSchemaPath)(pagination_view_2.PaginationInfoView) },
|
|
24
|
+
},
|
|
20
25
|
},
|
|
21
|
-
meta: { $ref: (0, swagger_3.getSchemaPath)(pagination_view_2.PaginationMetaView) },
|
|
22
26
|
},
|
|
23
27
|
},
|
|
24
28
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/pagination.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"pagination.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/pagination.decorator.ts"],"names":[],"mappings":";;AAMA,gDAuBC;AA7BD,2CAAuD;AACvD,6CAA6E;AAC7E,wDAAoD;AACpD,4DAAwD;AACxD,4DAA4D;AAE5D,SAAgB,kBAAkB,CAAI,IAAa;IACjD,OAAO,IAAA,wBAAe,EACpB,IAAA,wBAAc,EAAC,4BAAY,EAAE,gCAAc,EAAE,IAAI,CAAC,EAClD,IAAA,qBAAW,EAAC;QACV,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,4BAA4B;QACzC,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,4BAAY,CAAC,EAAE,CAAC;YAC9C,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,IAAA,uBAAa,EAAC,gCAAc,CAAC;oBACnC,UAAU,EAAE;wBACV,KAAK,EAAE;4BACL,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,IAAI,CAAC,EAAE;yBACrC;wBACD,UAAU,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,oCAAkB,CAAC,EAAE;qBACxD;iBACF;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/common/dto/index.js
CHANGED
|
@@ -21,5 +21,6 @@ __exportStar(require("./pagination.view"), exports);
|
|
|
21
21
|
__exportStar(require("./parsed-query-option.dto"), exports);
|
|
22
22
|
__exportStar(require("./parsed-search.dto"), exports);
|
|
23
23
|
__exportStar(require("./query-option.dto"), exports);
|
|
24
|
+
__exportStar(require("./response.view"), exports);
|
|
24
25
|
__exportStar(require("./search.dto"), exports);
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,4DAA0C;AAC1C,sDAAoC;AACpC,qDAAmC;AACnC,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,4DAA0C;AAC1C,sDAAoC;AACpC,qDAAmC;AACnC,kDAAgC;AAChC,+CAA6B"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class PageInfoView {
|
|
2
|
+
current?: number;
|
|
2
3
|
total?: number;
|
|
3
|
-
|
|
4
|
+
next?: number;
|
|
5
|
+
previous?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class PaginationInfoView {
|
|
4
8
|
limit?: number;
|
|
5
9
|
offset?: number;
|
|
6
|
-
|
|
10
|
+
count?: number;
|
|
11
|
+
page?: PageInfoView;
|
|
7
12
|
}
|
|
8
13
|
export declare class PaginationView<V> {
|
|
9
14
|
items: V[];
|
|
10
|
-
|
|
15
|
+
pagination: PaginationInfoView;
|
|
11
16
|
}
|
|
@@ -9,31 +9,46 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PaginationView = exports.
|
|
12
|
+
exports.PaginationView = exports.PaginationInfoView = exports.PageInfoView = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
-
class
|
|
14
|
+
class PageInfoView {
|
|
15
15
|
}
|
|
16
|
-
exports.
|
|
16
|
+
exports.PageInfoView = PageInfoView;
|
|
17
17
|
__decorate([
|
|
18
|
-
(0, swagger_1.ApiProperty)({ required:
|
|
18
|
+
(0, swagger_1.ApiProperty)({ required: false, example: 3 }),
|
|
19
19
|
__metadata("design:type", Number)
|
|
20
|
-
],
|
|
20
|
+
], PageInfoView.prototype, "current", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, swagger_1.ApiProperty)({ required: false, example: 10 }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], PageInfoView.prototype, "total", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ required: false, example: 4 }),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], PageInfoView.prototype, "next", void 0);
|
|
21
29
|
__decorate([
|
|
22
30
|
(0, swagger_1.ApiProperty)({ required: false, example: 2 }),
|
|
23
31
|
__metadata("design:type", Number)
|
|
24
|
-
],
|
|
32
|
+
], PageInfoView.prototype, "previous", void 0);
|
|
33
|
+
class PaginationInfoView {
|
|
34
|
+
}
|
|
35
|
+
exports.PaginationInfoView = PaginationInfoView;
|
|
25
36
|
__decorate([
|
|
26
37
|
(0, swagger_1.ApiProperty)({ required: false, example: 10 }),
|
|
27
38
|
__metadata("design:type", Number)
|
|
28
|
-
],
|
|
39
|
+
], PaginationInfoView.prototype, "limit", void 0);
|
|
29
40
|
__decorate([
|
|
30
41
|
(0, swagger_1.ApiProperty)({ required: false, example: 20 }),
|
|
31
42
|
__metadata("design:type", Number)
|
|
32
|
-
],
|
|
43
|
+
], PaginationInfoView.prototype, "offset", void 0);
|
|
33
44
|
__decorate([
|
|
34
|
-
(0, swagger_1.ApiProperty)({ required:
|
|
45
|
+
(0, swagger_1.ApiProperty)({ required: true, example: 120 }),
|
|
35
46
|
__metadata("design:type", Number)
|
|
36
|
-
],
|
|
47
|
+
], PaginationInfoView.prototype, "count", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ type: () => PageInfoView }),
|
|
50
|
+
__metadata("design:type", PageInfoView)
|
|
51
|
+
], PaginationInfoView.prototype, "page", void 0);
|
|
37
52
|
class PaginationView {
|
|
38
53
|
}
|
|
39
54
|
exports.PaginationView = PaginationView;
|
|
@@ -42,7 +57,7 @@ __decorate([
|
|
|
42
57
|
__metadata("design:type", Array)
|
|
43
58
|
], PaginationView.prototype, "items", void 0);
|
|
44
59
|
__decorate([
|
|
45
|
-
(0, swagger_1.ApiProperty)({ type: () =>
|
|
46
|
-
__metadata("design:type",
|
|
47
|
-
], PaginationView.prototype, "
|
|
60
|
+
(0, swagger_1.ApiProperty)({ type: () => PaginationInfoView }),
|
|
61
|
+
__metadata("design:type", PaginationInfoView)
|
|
62
|
+
], PaginationView.prototype, "pagination", void 0);
|
|
48
63
|
//# sourceMappingURL=pagination.view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.view.js","sourceRoot":"","sources":["../../../src/common/dto/pagination.view.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAE9C,MAAa,
|
|
1
|
+
{"version":3,"file":"pagination.view.js","sourceRoot":"","sources":["../../../src/common/dto/pagination.view.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAE9C,MAAa,YAAY;CAYxB;AAZD,oCAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6CAC5B;AAGjB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CAC/B;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0CAC/B;AAGd;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CAC3B;AAGpB,MAAa,kBAAkB;CAY9B;AAZD,gDAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;iDAC/B;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;kDAC9B;AAGhB;IADC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;;iDAC/B;AAGf;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;8BACnC,YAAY;gDAAC;AAGtB,MAAa,cAAc;CAM1B;AAND,wCAMC;AAJC;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;6CACpB;AAGX;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC;8BACpC,kBAAkB;kDAAC"}
|