@zola_do/crud 0.1.9
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/controller/entity-crud.controller.d.ts +16 -0
- package/dist/controller/entity-crud.controller.js +139 -0
- package/dist/controller/entity-crud.controller.js.map +1 -0
- package/dist/controller/extra-crud.controller.d.ts +18 -0
- package/dist/controller/extra-crud.controller.js +145 -0
- package/dist/controller/extra-crud.controller.js.map +1 -0
- package/dist/controller/index.d.ts +3 -0
- package/dist/controller/index.js +20 -0
- package/dist/controller/index.js.map +1 -0
- package/dist/controller/relation-crud.controller.d.ts +13 -0
- package/dist/controller/relation-crud.controller.js +101 -0
- package/dist/controller/relation-crud.controller.js.map +1 -0
- package/dist/crud-operation/controller/entity-crud.controller.d.ts +16 -0
- package/dist/crud-operation/controller/entity-crud.controller.js +136 -0
- package/dist/crud-operation/controller/entity-crud.controller.js.map +1 -0
- package/dist/crud-operation/controller/extra-crud.controller.d.ts +18 -0
- package/dist/crud-operation/controller/extra-crud.controller.js +142 -0
- package/dist/crud-operation/controller/extra-crud.controller.js.map +1 -0
- package/dist/crud-operation/controller/index.d.ts +3 -0
- package/dist/crud-operation/controller/index.js +20 -0
- package/dist/crud-operation/controller/index.js.map +1 -0
- package/dist/crud-operation/controller/relation-crud.controller.d.ts +13 -0
- package/dist/crud-operation/controller/relation-crud.controller.js +103 -0
- package/dist/crud-operation/controller/relation-crud.controller.js.map +1 -0
- package/dist/crud-operation/index.d.ts +3 -0
- package/dist/crud-operation/index.js +20 -0
- package/dist/crud-operation/index.js.map +1 -0
- package/dist/crud-operation/repository/entity-crud.repository.d.ts +18 -0
- package/dist/crud-operation/repository/entity-crud.repository.js +124 -0
- package/dist/crud-operation/repository/entity-crud.repository.js.map +1 -0
- package/dist/crud-operation/repository/extra-crud.repository.d.ts +20 -0
- package/dist/crud-operation/repository/extra-crud.repository.js +129 -0
- package/dist/crud-operation/repository/extra-crud.repository.js.map +1 -0
- package/dist/crud-operation/repository/index.d.ts +3 -0
- package/dist/crud-operation/repository/index.js +20 -0
- package/dist/crud-operation/repository/index.js.map +1 -0
- package/dist/crud-operation/repository/relation-crud.repository.d.ts +13 -0
- package/dist/crud-operation/repository/relation-crud.repository.js +116 -0
- package/dist/crud-operation/repository/relation-crud.repository.js.map +1 -0
- package/dist/crud-operation/service/entity-crud.service.d.ts +15 -0
- package/dist/crud-operation/service/entity-crud.service.js +49 -0
- package/dist/crud-operation/service/entity-crud.service.js.map +1 -0
- package/dist/crud-operation/service/extra-crud.service.d.ts +18 -0
- package/dist/crud-operation/service/extra-crud.service.js +55 -0
- package/dist/crud-operation/service/extra-crud.service.js.map +1 -0
- package/dist/crud-operation/service/index.d.ts +3 -0
- package/dist/crud-operation/service/index.js +20 -0
- package/dist/crud-operation/service/index.js.map +1 -0
- package/dist/crud-operation/service/relation-crud.service.d.ts +12 -0
- package/dist/crud-operation/service/relation-crud.service.js +37 -0
- package/dist/crud-operation/service/relation-crud.service.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/service/entity-crud.service.d.ts +17 -0
- package/dist/service/entity-crud.service.js +115 -0
- package/dist/service/entity-crud.service.js.map +1 -0
- package/dist/service/extra-crud.service.d.ts +18 -0
- package/dist/service/extra-crud.service.js +128 -0
- package/dist/service/extra-crud.service.js.map +1 -0
- package/dist/service/index.d.ts +3 -0
- package/dist/service/index.js +20 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/relation-crud.service.d.ts +13 -0
- package/dist/service/relation-crud.service.js +102 -0
- package/dist/service/relation-crud.service.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,115 @@
|
|
|
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 _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.EntityCrudService = void 0;
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
const collection_query_1 = require("@zola_do/collection-query");
|
|
17
|
+
const core_1 = require("@zola_do/core");
|
|
18
|
+
let EntityCrudService = class EntityCrudService {
|
|
19
|
+
constructor(repository) {
|
|
20
|
+
this.repository = repository;
|
|
21
|
+
}
|
|
22
|
+
async create(itemData, req) {
|
|
23
|
+
var _a;
|
|
24
|
+
if ((_a = req === null || req === void 0 ? void 0 : req.user) === null || _a === void 0 ? void 0 : _a.organization) {
|
|
25
|
+
itemData.organizationId = req.user.organization.id;
|
|
26
|
+
itemData.organizationName = req.user.organization.name;
|
|
27
|
+
}
|
|
28
|
+
const item = this.repository.create(itemData);
|
|
29
|
+
await this.repository.insert(item);
|
|
30
|
+
return item;
|
|
31
|
+
}
|
|
32
|
+
async findAll(query, req) {
|
|
33
|
+
const dataQuery = collection_query_1.QueryConstructor.constructQuery(this.repository, query);
|
|
34
|
+
const response = new core_1.DataResponseFormat();
|
|
35
|
+
if (query.count) {
|
|
36
|
+
response.total = await dataQuery.getCount();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
40
|
+
response.total = total;
|
|
41
|
+
response.items = result;
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
async findOne(id, req) {
|
|
46
|
+
return await this.repository.findOneBy({ id });
|
|
47
|
+
}
|
|
48
|
+
async update(id, itemData) {
|
|
49
|
+
const item = await this.findOneOrFail(id);
|
|
50
|
+
await this.repository.update(item.id, itemData);
|
|
51
|
+
return Object.assign(Object.assign({}, item), itemData);
|
|
52
|
+
}
|
|
53
|
+
async softDelete(id, req) {
|
|
54
|
+
const item = await this.findOneOrFail(id);
|
|
55
|
+
await this.repository.remove(item);
|
|
56
|
+
}
|
|
57
|
+
async restore(id, req) {
|
|
58
|
+
await this.findOneOrFailWithDeleted(id);
|
|
59
|
+
await this.repository.restore(id);
|
|
60
|
+
}
|
|
61
|
+
async findAllArchived(query, req) {
|
|
62
|
+
query.where.push([
|
|
63
|
+
{ column: 'deletedAt', value: '', operator: collection_query_1.FilterOperators.IsNotNull },
|
|
64
|
+
]);
|
|
65
|
+
const dataQuery = collection_query_1.QueryConstructor.constructQuery(this.repository, query);
|
|
66
|
+
dataQuery.withDeleted();
|
|
67
|
+
const response = new core_1.DataResponseFormat();
|
|
68
|
+
if (query.count) {
|
|
69
|
+
response.total = await dataQuery.getCount();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
73
|
+
response.total = total;
|
|
74
|
+
response.items = result;
|
|
75
|
+
}
|
|
76
|
+
return response;
|
|
77
|
+
}
|
|
78
|
+
async findOneOrFail(id) {
|
|
79
|
+
const item = await this.repository.findOneBy({ id });
|
|
80
|
+
if (!item) {
|
|
81
|
+
throw new common_1.NotFoundException(`not_found`);
|
|
82
|
+
}
|
|
83
|
+
return item;
|
|
84
|
+
}
|
|
85
|
+
async findOneOrFailWithDeleted(id) {
|
|
86
|
+
const item = await this.repository.findOne({
|
|
87
|
+
where: {
|
|
88
|
+
id,
|
|
89
|
+
},
|
|
90
|
+
withDeleted: true,
|
|
91
|
+
});
|
|
92
|
+
if (!item) {
|
|
93
|
+
throw new common_1.NotFoundException(`not_found`);
|
|
94
|
+
}
|
|
95
|
+
return item;
|
|
96
|
+
}
|
|
97
|
+
async giveQueryResponse(query, dataQuery) {
|
|
98
|
+
const response = new core_1.DataResponseFormat();
|
|
99
|
+
if (query.count) {
|
|
100
|
+
response.total = await dataQuery.getCount();
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
104
|
+
response.total = total;
|
|
105
|
+
response.items = result;
|
|
106
|
+
}
|
|
107
|
+
return response;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.EntityCrudService = EntityCrudService;
|
|
111
|
+
exports.EntityCrudService = EntityCrudService = __decorate([
|
|
112
|
+
(0, common_1.Injectable)(),
|
|
113
|
+
__metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.Repository !== "undefined" && typeorm_1.Repository) === "function" ? _a : Object])
|
|
114
|
+
], EntityCrudService);
|
|
115
|
+
//# sourceMappingURL=entity-crud.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-crud.service.js","sourceRoot":"","sources":["../../src/service/entity-crud.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAKiB;AACjB,2CAA+D;AAC/D,gEAImC;AACnC,wCAAmD;AAG5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAA6B,UAAyB;QAAzB,eAAU,GAAV,UAAU,CAAe;IAAG,CAAC;IAE1D,KAAK,CAAC,MAAM,CAAC,QAA0B,EAAE,GAAS;;QAChD,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,0CAAE,YAAY,EAAE,CAAC;YAC5B,QAAQ,CAAC,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACnD,QAAQ,CAAC,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,I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,0BAAiB,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,CAAC,wBAAwB,CAAC,EAAO;QAC5C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE;gBACL,EAAE;aACH;YACD,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,0BAAiB,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,KAAsB,EACtB,SAAgC;QAEhC,MAAM,QAAQ,GAAG,IAAI,yBAAkB,EAAK,CAAC;QAC7C,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,QAAQ,CAAC,KAAK,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;YAC1D,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;YACvB,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC;QAC1B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhHY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;yDAE8B,oBAAU,oBAAV,oBAAU;GADxC,iBAAiB,CAgH7B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Repository, DeepPartial, ObjectLiteral, SelectQueryBuilder } from 'typeorm';
|
|
2
|
+
import { CollectionQuery } from '@zola_do/collection-query';
|
|
3
|
+
import { DataResponseFormat } from '@zola_do/core';
|
|
4
|
+
import { ExtraCrudOptions } from '@zola_do/core';
|
|
5
|
+
export declare class ExtraCrudService<T extends ObjectLiteral> {
|
|
6
|
+
private readonly repository;
|
|
7
|
+
constructor(repository: Repository<T>);
|
|
8
|
+
create(itemData: DeepPartial<any>, req?: any): Promise<any>;
|
|
9
|
+
findAll(entityId: string, query: CollectionQuery, extraCrudOptions: ExtraCrudOptions, req?: any): Promise<DataResponseFormat<T>>;
|
|
10
|
+
findOne(id: any, req?: any): Promise<T | undefined>;
|
|
11
|
+
update(id: string, itemData: any): Promise<T | undefined>;
|
|
12
|
+
softDelete(id: string, req?: any): Promise<void>;
|
|
13
|
+
restore(id: string, req?: any): Promise<void>;
|
|
14
|
+
findAllArchived(entityId: string, query: CollectionQuery, extraCrudOptions: ExtraCrudOptions, req?: any): Promise<DataResponseFormat<T>>;
|
|
15
|
+
private findOneOrFail;
|
|
16
|
+
private findOneOrFailWithDeleted;
|
|
17
|
+
giveQueryResponse<T>(query: CollectionQuery, dataQuery: SelectQueryBuilder<T>): Promise<DataResponseFormat<T>>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
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 _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ExtraCrudService = void 0;
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
const collection_query_1 = require("@zola_do/collection-query");
|
|
17
|
+
const core_1 = require("@zola_do/core");
|
|
18
|
+
let ExtraCrudService = class ExtraCrudService {
|
|
19
|
+
constructor(repository) {
|
|
20
|
+
this.repository = repository;
|
|
21
|
+
}
|
|
22
|
+
async create(itemData, req) {
|
|
23
|
+
var _a;
|
|
24
|
+
if ((_a = req === null || req === void 0 ? void 0 : req.user) === null || _a === void 0 ? void 0 : _a.organization) {
|
|
25
|
+
itemData.organizationId = req.user.organization.id;
|
|
26
|
+
itemData.organizationName = req.user.organization.name;
|
|
27
|
+
}
|
|
28
|
+
const item = this.repository.create(itemData);
|
|
29
|
+
await this.repository.insert(item);
|
|
30
|
+
return item;
|
|
31
|
+
}
|
|
32
|
+
async findAll(entityId, query, extraCrudOptions, req) {
|
|
33
|
+
const entityIdName = extraCrudOptions.entityIdName;
|
|
34
|
+
query.where.push([
|
|
35
|
+
{
|
|
36
|
+
column: entityIdName,
|
|
37
|
+
value: entityId,
|
|
38
|
+
operator: collection_query_1.FilterOperators.EqualTo,
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
const dataQuery = collection_query_1.QueryConstructor.constructQuery(this.repository, query);
|
|
42
|
+
const response = new core_1.DataResponseFormat();
|
|
43
|
+
if (query.count) {
|
|
44
|
+
response.total = await dataQuery.getCount();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
48
|
+
response.total = total;
|
|
49
|
+
response.items = result;
|
|
50
|
+
}
|
|
51
|
+
return response;
|
|
52
|
+
}
|
|
53
|
+
async findOne(id, req) {
|
|
54
|
+
return await this.repository.findOneBy({ id });
|
|
55
|
+
}
|
|
56
|
+
async update(id, itemData) {
|
|
57
|
+
const item = await this.findOneOrFail(id);
|
|
58
|
+
await this.repository.update(item.id, itemData);
|
|
59
|
+
return Object.assign(Object.assign({}, item), itemData);
|
|
60
|
+
}
|
|
61
|
+
async softDelete(id, req) {
|
|
62
|
+
const item = await this.findOneOrFail(id);
|
|
63
|
+
await this.repository.remove(item);
|
|
64
|
+
}
|
|
65
|
+
async restore(id, req) {
|
|
66
|
+
await this.findOneOrFailWithDeleted(id);
|
|
67
|
+
await this.repository.restore(id);
|
|
68
|
+
}
|
|
69
|
+
async findAllArchived(entityId, query, extraCrudOptions, req) {
|
|
70
|
+
const entityIdName = extraCrudOptions.entityIdName;
|
|
71
|
+
query.where.push([
|
|
72
|
+
{
|
|
73
|
+
column: entityIdName,
|
|
74
|
+
value: entityId,
|
|
75
|
+
operator: collection_query_1.FilterOperators.EqualTo,
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
const dataQuery = collection_query_1.QueryConstructor.constructQuery(this.repository, query);
|
|
79
|
+
dataQuery.withDeleted();
|
|
80
|
+
const response = new core_1.DataResponseFormat();
|
|
81
|
+
if (query.count) {
|
|
82
|
+
response.total = await dataQuery.getCount();
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
86
|
+
response.total = total;
|
|
87
|
+
response.items = result;
|
|
88
|
+
}
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
async findOneOrFail(id) {
|
|
92
|
+
const item = await this.repository.findOneBy({ id });
|
|
93
|
+
if (!item) {
|
|
94
|
+
throw new common_1.NotFoundException(`not_found`);
|
|
95
|
+
}
|
|
96
|
+
return item;
|
|
97
|
+
}
|
|
98
|
+
async findOneOrFailWithDeleted(id) {
|
|
99
|
+
const item = await this.repository.findOne({
|
|
100
|
+
where: {
|
|
101
|
+
id,
|
|
102
|
+
},
|
|
103
|
+
withDeleted: true,
|
|
104
|
+
});
|
|
105
|
+
if (!item) {
|
|
106
|
+
throw new common_1.NotFoundException(`not_found`);
|
|
107
|
+
}
|
|
108
|
+
return item;
|
|
109
|
+
}
|
|
110
|
+
async giveQueryResponse(query, dataQuery) {
|
|
111
|
+
const response = new core_1.DataResponseFormat();
|
|
112
|
+
if (query.count) {
|
|
113
|
+
response.total = await dataQuery.getCount();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
117
|
+
response.total = total;
|
|
118
|
+
response.items = result;
|
|
119
|
+
}
|
|
120
|
+
return response;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.ExtraCrudService = ExtraCrudService;
|
|
124
|
+
exports.ExtraCrudService = ExtraCrudService = __decorate([
|
|
125
|
+
(0, common_1.Injectable)(),
|
|
126
|
+
__metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.Repository !== "undefined" && typeorm_1.Repository) === "function" ? _a : Object])
|
|
127
|
+
], ExtraCrudService);
|
|
128
|
+
//# sourceMappingURL=extra-crud.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extra-crud.service.js","sourceRoot":"","sources":["../../src/service/extra-crud.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAKiB;AACjB,2CAA+D;AAC/D,gEAImC;AACnC,wCAAmD;AAI5C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAA6B,UAAyB;QAAzB,eAAU,GAAV,UAAU,CAAe;IAAG,CAAC;IAE1D,KAAK,CAAC,MAAM,CAAC,QAA0B,EAAE,GAAS;;QAChD,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,0CAAE,YAAY,EAAE,CAAC;YAC5B,QAAQ,CAAC,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACnD,QAAQ,CAAC,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;QACzD,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,IA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
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entity-crud.service"), exports);
|
|
18
|
+
__exportStar(require("./relation-crud.service"), exports);
|
|
19
|
+
__exportStar(require("./extra-crud.service"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ObjectLiteral, Repository } from 'typeorm';
|
|
2
|
+
import { CollectionQuery } from '@zola_do/collection-query';
|
|
3
|
+
import { DataResponseFormat } from '@zola_do/core';
|
|
4
|
+
import { RelationCrudOptions } from '@zola_do/core';
|
|
5
|
+
export declare class RelationCrudService<TEntity extends ObjectLiteral> {
|
|
6
|
+
private readonly repository;
|
|
7
|
+
constructor(repository: Repository<TEntity>);
|
|
8
|
+
bulkSaveFirst(payload: any, relationCrudOptions: RelationCrudOptions): Promise<any>;
|
|
9
|
+
bulkSaveSecond(payload: any, relationCrudOptions: RelationCrudOptions): Promise<any>;
|
|
10
|
+
findAllFirst(entityId: string, query: CollectionQuery, relationCrudOptions: RelationCrudOptions): Promise<DataResponseFormat<TEntity>>;
|
|
11
|
+
findAllSecond(entityId: string, query: CollectionQuery, relationCrudOptions: RelationCrudOptions): Promise<DataResponseFormat<TEntity>>;
|
|
12
|
+
getData(entityId: string, entityIdName: string, include: string, filterInclude: string, query: CollectionQuery): Promise<DataResponseFormat<TEntity>>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.RelationCrudService = void 0;
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
const collection_query_1 = require("@zola_do/collection-query");
|
|
17
|
+
const core_1 = require("@zola_do/core");
|
|
18
|
+
let RelationCrudService = class RelationCrudService {
|
|
19
|
+
constructor(repository) {
|
|
20
|
+
this.repository = repository;
|
|
21
|
+
}
|
|
22
|
+
async bulkSaveFirst(payload, relationCrudOptions) {
|
|
23
|
+
const firstEntityIdName = relationCrudOptions.firstEntityIdName;
|
|
24
|
+
const secondEntityIdName = relationCrudOptions.secondEntityIdName;
|
|
25
|
+
const include = relationCrudOptions.firstInclude;
|
|
26
|
+
const entityId = payload[firstEntityIdName];
|
|
27
|
+
const parsedPayload = [];
|
|
28
|
+
const childData = payload[include];
|
|
29
|
+
childData.forEach((data) => {
|
|
30
|
+
parsedPayload.push({
|
|
31
|
+
[firstEntityIdName]: entityId,
|
|
32
|
+
[secondEntityIdName]: data,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
const deleteCondition = {};
|
|
36
|
+
deleteCondition[firstEntityIdName] = entityId;
|
|
37
|
+
await this.repository.delete(deleteCondition);
|
|
38
|
+
const data = this.repository.create(parsedPayload);
|
|
39
|
+
await this.repository.insert(data);
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
async bulkSaveSecond(payload, relationCrudOptions) {
|
|
43
|
+
const firstEntityIdName = relationCrudOptions.firstEntityIdName;
|
|
44
|
+
const secondEntityIdName = relationCrudOptions.secondEntityIdName;
|
|
45
|
+
const include = relationCrudOptions.secondInclude;
|
|
46
|
+
const entityId = payload[secondEntityIdName];
|
|
47
|
+
const parsedPayload = [];
|
|
48
|
+
const childData = payload[include];
|
|
49
|
+
childData.forEach((data) => {
|
|
50
|
+
parsedPayload.push({
|
|
51
|
+
[secondEntityIdName]: entityId,
|
|
52
|
+
[firstEntityIdName]: data,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const deleteCondition = {};
|
|
56
|
+
deleteCondition[secondEntityIdName] = entityId;
|
|
57
|
+
await this.repository.delete(deleteCondition);
|
|
58
|
+
const data = this.repository.create(parsedPayload);
|
|
59
|
+
await this.repository.insert(data);
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
async findAllFirst(entityId, query, relationCrudOptions) {
|
|
63
|
+
const entityIdName = relationCrudOptions.firstEntityIdName;
|
|
64
|
+
const include = relationCrudOptions.firstInclude;
|
|
65
|
+
const filterInclude = relationCrudOptions.secondInclude;
|
|
66
|
+
return await this.getData(entityId, entityIdName, include, filterInclude, query);
|
|
67
|
+
}
|
|
68
|
+
async findAllSecond(entityId, query, relationCrudOptions) {
|
|
69
|
+
const entityIdName = relationCrudOptions.secondEntityIdName;
|
|
70
|
+
const include = relationCrudOptions.secondInclude;
|
|
71
|
+
const filterInclude = relationCrudOptions.firstInclude;
|
|
72
|
+
return await this.getData(entityId, entityIdName, include, filterInclude, query);
|
|
73
|
+
}
|
|
74
|
+
async getData(entityId, entityIdName, include, filterInclude, query) {
|
|
75
|
+
query.where.push([
|
|
76
|
+
{
|
|
77
|
+
column: entityIdName,
|
|
78
|
+
value: entityId,
|
|
79
|
+
operator: collection_query_1.FilterOperators.EqualTo,
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
query.includes.push(include);
|
|
83
|
+
query.includes.push(filterInclude);
|
|
84
|
+
const dataQuery = collection_query_1.QueryConstructor.constructQuery(this.repository, query, true);
|
|
85
|
+
const response = new core_1.DataResponseFormat();
|
|
86
|
+
if (query.count) {
|
|
87
|
+
response.total = await dataQuery.getCount();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const [result, total] = await dataQuery.getManyAndCount();
|
|
91
|
+
response.total = total;
|
|
92
|
+
response.items = result;
|
|
93
|
+
}
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.RelationCrudService = RelationCrudService;
|
|
98
|
+
exports.RelationCrudService = RelationCrudService = __decorate([
|
|
99
|
+
(0, common_1.Injectable)(),
|
|
100
|
+
__metadata("design:paramtypes", [typeof (_a = typeof typeorm_1.Repository !== "undefined" && typeorm_1.Repository) === "function" ? _a : Object])
|
|
101
|
+
], RelationCrudService);
|
|
102
|
+
//# sourceMappingURL=relation-crud.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-crud.service.js","sourceRoot":"","sources":["../../src/service/rel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/B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zola_do/crud",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Generic CRUD controllers and services for NestJS",
|
|
5
|
+
"author": "zolaDO",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": ["dist", "README.md"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf dist && tsc",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
25
|
+
"@nestjs/swagger": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
26
|
+
"@nestjs/typeorm": "^10.0.0 || ^11.0.0",
|
|
27
|
+
"reflect-metadata": "^0.1.0 || ^0.2.0",
|
|
28
|
+
"rxjs": "^7.0.0 || ^8.0.0",
|
|
29
|
+
"typeorm": "^0.3.0",
|
|
30
|
+
"typeorm-extension": "^3.7.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependenciesMeta": {
|
|
33
|
+
"@nestjs/swagger": { "optional": true }
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@zola_do/core": "file:../core",
|
|
37
|
+
"@zola_do/collection-query": "file:../collection-query",
|
|
38
|
+
"@zola_do/authorization": "file:../authorization"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"rimraf": "^6.1.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
}
|
|
44
|
+
}
|