nicot 1.2.4 → 1.2.5
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-CN.md +234 -0
- package/README.md +258 -0
- package/dist/index.cjs +294 -22
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +291 -22
- package/dist/index.mjs.map +3 -3
- package/dist/src/crud-base.d.ts +31 -0
- package/dist/src/decorators/binding.d.ts +7 -0
- package/dist/src/decorators/index.d.ts +1 -0
- package/dist/src/restful.d.ts +30 -1
- package/dist/src/utility/metadata.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -783,6 +783,18 @@ var QueryOr = (...decs) => {
|
|
|
783
783
|
});
|
|
784
784
|
};
|
|
785
785
|
|
|
786
|
+
// src/decorators/binding.ts
|
|
787
|
+
var DefaultBindingKey = "default";
|
|
788
|
+
var BindingColumn = (bindingKey = DefaultBindingKey) => Metadata.set("bindingColumn", bindingKey, "bindingColumnFields");
|
|
789
|
+
var BindingValue = (bindingKey = DefaultBindingKey) => (obj, key, des) => {
|
|
790
|
+
const isMethod = !!des && typeof des.value === "function";
|
|
791
|
+
Metadata.set(
|
|
792
|
+
"bindingValue",
|
|
793
|
+
{ bindingKey, isMethod },
|
|
794
|
+
"bindingValueFields"
|
|
795
|
+
)(obj, key);
|
|
796
|
+
};
|
|
797
|
+
|
|
786
798
|
// src/dto/cursor-pagination.ts
|
|
787
799
|
var CursorPaginationDto = class {
|
|
788
800
|
};
|
|
@@ -1414,7 +1426,11 @@ var CrudBase = class {
|
|
|
1414
1426
|
});
|
|
1415
1427
|
this.log = new ConsoleLogger(`${this.entityClass.name}Service`);
|
|
1416
1428
|
this._typeormRelations = getTypeormRelations(this.entityClass);
|
|
1429
|
+
// binding things
|
|
1430
|
+
this._tmpBindingMap = /* @__PURE__ */ new Map();
|
|
1431
|
+
this._bindingCache = /* @__PURE__ */ new Map();
|
|
1417
1432
|
}
|
|
1433
|
+
// cleaning entities
|
|
1418
1434
|
_cleanEntityNotInResultFields(ent) {
|
|
1419
1435
|
const visited = /* @__PURE__ */ new Set();
|
|
1420
1436
|
const runSingleObject = (o, cl) => {
|
|
@@ -1458,6 +1474,105 @@ var CrudBase = class {
|
|
|
1458
1474
|
return this._cleanEntityNotInResultFields(ents);
|
|
1459
1475
|
}
|
|
1460
1476
|
}
|
|
1477
|
+
_lookForBindingValueField(bindingKey) {
|
|
1478
|
+
if (this._bindingCache.has(bindingKey)) {
|
|
1479
|
+
return this._bindingCache.get(bindingKey);
|
|
1480
|
+
}
|
|
1481
|
+
const bindingServiceFields = getSpecificFields(this, "bindingValue");
|
|
1482
|
+
const useField = bindingServiceFields.find((f) => {
|
|
1483
|
+
const meta = reflector.get("bindingValue", this, f);
|
|
1484
|
+
return meta?.bindingKey === bindingKey;
|
|
1485
|
+
});
|
|
1486
|
+
if (useField) {
|
|
1487
|
+
const meta = reflector.get("bindingValue", this, useField);
|
|
1488
|
+
const res = {
|
|
1489
|
+
...meta,
|
|
1490
|
+
field: useField
|
|
1491
|
+
};
|
|
1492
|
+
this._bindingCache.set(bindingKey, res);
|
|
1493
|
+
return res;
|
|
1494
|
+
}
|
|
1495
|
+
return void 0;
|
|
1496
|
+
}
|
|
1497
|
+
_resolveBindingValue(entityField) {
|
|
1498
|
+
const bindingKey = reflector.get(
|
|
1499
|
+
"bindingColumn",
|
|
1500
|
+
this.entityClass,
|
|
1501
|
+
entityField
|
|
1502
|
+
);
|
|
1503
|
+
if (!bindingKey) {
|
|
1504
|
+
return void 0;
|
|
1505
|
+
}
|
|
1506
|
+
if (this._tmpBindingMap.has(bindingKey)) {
|
|
1507
|
+
return this._tmpBindingMap.get(bindingKey);
|
|
1508
|
+
}
|
|
1509
|
+
const bindingValueField = this._lookForBindingValueField(bindingKey);
|
|
1510
|
+
if (!bindingValueField) {
|
|
1511
|
+
return void 0;
|
|
1512
|
+
}
|
|
1513
|
+
if (bindingValueField.isMethod) {
|
|
1514
|
+
return this[bindingValueField.field]();
|
|
1515
|
+
} else {
|
|
1516
|
+
return this[bindingValueField.field];
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
// MUST be called 1st on every CRUD operation
|
|
1520
|
+
async getBindingPartialEntity() {
|
|
1521
|
+
const bindingFields = getSpecificFields(this.entityClass, "bindingColumn");
|
|
1522
|
+
if (!bindingFields.length) {
|
|
1523
|
+
return {};
|
|
1524
|
+
}
|
|
1525
|
+
const values = bindingFields.map((field, i) => {
|
|
1526
|
+
return {
|
|
1527
|
+
field,
|
|
1528
|
+
value: this._resolveBindingValue(field),
|
|
1529
|
+
i
|
|
1530
|
+
};
|
|
1531
|
+
});
|
|
1532
|
+
this._tmpBindingMap.clear();
|
|
1533
|
+
const containingPromiseValues = values.filter(
|
|
1534
|
+
(v) => v.value instanceof Promise
|
|
1535
|
+
);
|
|
1536
|
+
if (containingPromiseValues.length) {
|
|
1537
|
+
await Promise.all(
|
|
1538
|
+
containingPromiseValues.map(async (v) => {
|
|
1539
|
+
v.value = await v.value;
|
|
1540
|
+
})
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1543
|
+
const res = {};
|
|
1544
|
+
for (const v of values) {
|
|
1545
|
+
if (v.value != null) {
|
|
1546
|
+
res[v.field] = v.value;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return res;
|
|
1550
|
+
}
|
|
1551
|
+
useBinding(value, bindngKey = DefaultBindingKey) {
|
|
1552
|
+
this._tmpBindingMap.set(bindngKey, value);
|
|
1553
|
+
return this;
|
|
1554
|
+
}
|
|
1555
|
+
_freezeBindings() {
|
|
1556
|
+
const res = {};
|
|
1557
|
+
for (const [key, value] of this._tmpBindingMap.entries()) {
|
|
1558
|
+
res[key] = value;
|
|
1559
|
+
}
|
|
1560
|
+
this._tmpBindingMap.clear();
|
|
1561
|
+
return res;
|
|
1562
|
+
}
|
|
1563
|
+
_restoreBindings(frozen) {
|
|
1564
|
+
this._tmpBindingMap.clear();
|
|
1565
|
+
for (const key of Object.keys(frozen)) {
|
|
1566
|
+
this._tmpBindingMap.set(key, frozen[key]);
|
|
1567
|
+
}
|
|
1568
|
+
return this;
|
|
1569
|
+
}
|
|
1570
|
+
async beforeSuper(fn) {
|
|
1571
|
+
const snap = this._freezeBindings();
|
|
1572
|
+
const res = await fn();
|
|
1573
|
+
this._restoreBindings(snap);
|
|
1574
|
+
return res;
|
|
1575
|
+
}
|
|
1461
1576
|
async _batchCreate(ents, beforeCreate, skipErrors = false) {
|
|
1462
1577
|
const entsWithId = ents.filter((ent) => ent.id != null);
|
|
1463
1578
|
return this.repo.manager.transaction(async (mdb) => {
|
|
@@ -1563,6 +1678,7 @@ var CrudBase = class {
|
|
|
1563
1678
|
});
|
|
1564
1679
|
}
|
|
1565
1680
|
async create(_ent, beforeCreate) {
|
|
1681
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1566
1682
|
if (!_ent) {
|
|
1567
1683
|
throw new BlankReturnMessageDto2(400, "Invalid entity").toException();
|
|
1568
1684
|
}
|
|
@@ -1597,6 +1713,7 @@ var CrudBase = class {
|
|
|
1597
1713
|
}
|
|
1598
1714
|
}
|
|
1599
1715
|
}
|
|
1716
|
+
Object.assign(ent, bindingEnt);
|
|
1600
1717
|
if (beforeCreate) {
|
|
1601
1718
|
await beforeCreate(repo);
|
|
1602
1719
|
}
|
|
@@ -1662,10 +1779,20 @@ var CrudBase = class {
|
|
|
1662
1779
|
queryBuilder() {
|
|
1663
1780
|
return this.repo.createQueryBuilder(this.entityAliasName);
|
|
1664
1781
|
}
|
|
1782
|
+
_applyQueryFromBinding(bindingEnt, qb) {
|
|
1783
|
+
for (const [key, value] of Object.entries(bindingEnt)) {
|
|
1784
|
+
const typeormKey = `_binding_${key}`;
|
|
1785
|
+
qb.andWhere(`${this.entityAliasName}.${key} = :${typeormKey}`, {
|
|
1786
|
+
[typeormKey]: value
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1665
1790
|
async findOne(id, extraQuery = () => {
|
|
1666
1791
|
}) {
|
|
1792
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1667
1793
|
const query = this.queryBuilder().where(`${this.entityAliasName}.id = :id`, { id }).take(1);
|
|
1668
1794
|
this._applyQueryRelations(query);
|
|
1795
|
+
this._applyQueryFromBinding(bindingEnt, query);
|
|
1669
1796
|
this.extraGetQuery(query);
|
|
1670
1797
|
extraQuery(query);
|
|
1671
1798
|
query.take(1);
|
|
@@ -1696,6 +1823,7 @@ var CrudBase = class {
|
|
|
1696
1823
|
}
|
|
1697
1824
|
async _preFindAll(ent, extraQuery = () => {
|
|
1698
1825
|
}) {
|
|
1826
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1699
1827
|
const query = this.queryBuilder().where("1 = 1");
|
|
1700
1828
|
const newEnt = new this.entityClass();
|
|
1701
1829
|
if (ent) {
|
|
@@ -1705,6 +1833,7 @@ var CrudBase = class {
|
|
|
1705
1833
|
}
|
|
1706
1834
|
this._applyQueryRelations(query);
|
|
1707
1835
|
this._applyQueryFilters(query, newEnt);
|
|
1836
|
+
this._applyQueryFromBinding(bindingEnt, query);
|
|
1708
1837
|
const pageSettings = newEnt instanceof PageSettingsDto ? newEnt : Object.assign(new PageSettingsDto(), newEnt);
|
|
1709
1838
|
this.extraGetQuery(query);
|
|
1710
1839
|
extraQuery(query);
|
|
@@ -1763,6 +1892,7 @@ var CrudBase = class {
|
|
|
1763
1892
|
}
|
|
1764
1893
|
}
|
|
1765
1894
|
async update(id, entPart, cond = {}) {
|
|
1895
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1766
1896
|
let result;
|
|
1767
1897
|
const ent = new this.entityClass();
|
|
1768
1898
|
Object.assign(ent, entPart);
|
|
@@ -1775,6 +1905,7 @@ var CrudBase = class {
|
|
|
1775
1905
|
result = await this.repo.update(
|
|
1776
1906
|
{
|
|
1777
1907
|
id,
|
|
1908
|
+
...bindingEnt,
|
|
1778
1909
|
...cond
|
|
1779
1910
|
},
|
|
1780
1911
|
ent
|
|
@@ -1796,9 +1927,11 @@ var CrudBase = class {
|
|
|
1796
1927
|
return new BlankReturnMessageDto2(200, "success");
|
|
1797
1928
|
}
|
|
1798
1929
|
async delete(id, cond = {}) {
|
|
1930
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1799
1931
|
let result;
|
|
1800
1932
|
const searchCond = {
|
|
1801
1933
|
id,
|
|
1934
|
+
...bindingEnt,
|
|
1802
1935
|
...cond
|
|
1803
1936
|
};
|
|
1804
1937
|
try {
|
|
@@ -1816,6 +1949,7 @@ var CrudBase = class {
|
|
|
1816
1949
|
return new BlankReturnMessageDto2(200, "success");
|
|
1817
1950
|
}
|
|
1818
1951
|
async importEntities(_ents, extraChecking) {
|
|
1952
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
1819
1953
|
const ents = _ents.map((ent) => {
|
|
1820
1954
|
const newEnt = new this.entityClass();
|
|
1821
1955
|
Object.assign(
|
|
@@ -1843,6 +1977,9 @@ var CrudBase = class {
|
|
|
1843
1977
|
const remainingEnts = ents.filter(
|
|
1844
1978
|
(ent) => !invalidResults.find((result) => result.entry === ent)
|
|
1845
1979
|
);
|
|
1980
|
+
for (const ent of remainingEnts) {
|
|
1981
|
+
Object.assign(ent, bindingEnt);
|
|
1982
|
+
}
|
|
1846
1983
|
await Promise.all(remainingEnts.map((ent) => ent.beforeCreate?.()));
|
|
1847
1984
|
const data = await this._batchCreate(remainingEnts, void 0, true);
|
|
1848
1985
|
await Promise.all(data.results.map((e) => e.afterCreate?.()));
|
|
@@ -1863,7 +2000,11 @@ var CrudBase = class {
|
|
|
1863
2000
|
);
|
|
1864
2001
|
}
|
|
1865
2002
|
async exists(id) {
|
|
1866
|
-
const
|
|
2003
|
+
const bindingEnt = await this.getBindingPartialEntity();
|
|
2004
|
+
const ent = await this.repo.findOne({
|
|
2005
|
+
where: { id, ...bindingEnt },
|
|
2006
|
+
select: ["id"]
|
|
2007
|
+
});
|
|
1867
2008
|
return !!ent;
|
|
1868
2009
|
}
|
|
1869
2010
|
async _loadFullTextIndex() {
|
|
@@ -2115,7 +2256,132 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2115
2256
|
filterRelations(entityClass, options.relations);
|
|
2116
2257
|
}
|
|
2117
2258
|
}
|
|
2118
|
-
|
|
2259
|
+
omitInput(...fields) {
|
|
2260
|
+
return new _RestfulFactory(
|
|
2261
|
+
this.entityClass,
|
|
2262
|
+
{
|
|
2263
|
+
...this.options,
|
|
2264
|
+
fieldsToOmit: _5.uniq([...this.options.fieldsToOmit || [], ...fields])
|
|
2265
|
+
},
|
|
2266
|
+
this.__resolveVisited
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
omitWrite(...fields) {
|
|
2270
|
+
return new _RestfulFactory(
|
|
2271
|
+
this.entityClass,
|
|
2272
|
+
{
|
|
2273
|
+
...this.options,
|
|
2274
|
+
writeFieldsToOmit: _5.uniq([
|
|
2275
|
+
...this.options.writeFieldsToOmit || [],
|
|
2276
|
+
...fields
|
|
2277
|
+
])
|
|
2278
|
+
},
|
|
2279
|
+
this.__resolveVisited
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
omitCreate(...fields) {
|
|
2283
|
+
return new _RestfulFactory(
|
|
2284
|
+
this.entityClass,
|
|
2285
|
+
{
|
|
2286
|
+
...this.options,
|
|
2287
|
+
createFieldsToOmit: _5.uniq([
|
|
2288
|
+
...this.options.createFieldsToOmit || [],
|
|
2289
|
+
...fields
|
|
2290
|
+
])
|
|
2291
|
+
},
|
|
2292
|
+
this.__resolveVisited
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
omitUpdate(...fields) {
|
|
2296
|
+
return new _RestfulFactory(
|
|
2297
|
+
this.entityClass,
|
|
2298
|
+
{
|
|
2299
|
+
...this.options,
|
|
2300
|
+
updateFieldsToOmit: _5.uniq([
|
|
2301
|
+
...this.options.updateFieldsToOmit || [],
|
|
2302
|
+
...fields
|
|
2303
|
+
])
|
|
2304
|
+
},
|
|
2305
|
+
this.__resolveVisited
|
|
2306
|
+
);
|
|
2307
|
+
}
|
|
2308
|
+
omitFindAll(...fields) {
|
|
2309
|
+
return new _RestfulFactory(
|
|
2310
|
+
this.entityClass,
|
|
2311
|
+
{
|
|
2312
|
+
...this.options,
|
|
2313
|
+
findAllFieldsToOmit: _5.uniq([
|
|
2314
|
+
...this.options.findAllFieldsToOmit || [],
|
|
2315
|
+
...fields
|
|
2316
|
+
])
|
|
2317
|
+
},
|
|
2318
|
+
this.__resolveVisited
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2321
|
+
omitOutput(...fields) {
|
|
2322
|
+
return new _RestfulFactory(
|
|
2323
|
+
this.entityClass,
|
|
2324
|
+
{
|
|
2325
|
+
...this.options,
|
|
2326
|
+
outputFieldsToOmit: _5.uniq([
|
|
2327
|
+
...this.options.outputFieldsToOmit || [],
|
|
2328
|
+
...fields
|
|
2329
|
+
])
|
|
2330
|
+
},
|
|
2331
|
+
this.__resolveVisited
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
pathPrefix(prefix) {
|
|
2335
|
+
return new _RestfulFactory(
|
|
2336
|
+
this.entityClass,
|
|
2337
|
+
{
|
|
2338
|
+
...this.options,
|
|
2339
|
+
prefix
|
|
2340
|
+
},
|
|
2341
|
+
this.__resolveVisited
|
|
2342
|
+
);
|
|
2343
|
+
}
|
|
2344
|
+
keepEntityVersioningDates(enable = true) {
|
|
2345
|
+
return new _RestfulFactory(
|
|
2346
|
+
this.entityClass,
|
|
2347
|
+
{
|
|
2348
|
+
...this.options,
|
|
2349
|
+
keepEntityVersioningDates: enable
|
|
2350
|
+
},
|
|
2351
|
+
this.__resolveVisited
|
|
2352
|
+
);
|
|
2353
|
+
}
|
|
2354
|
+
skipNonQueryableFields(enable = true) {
|
|
2355
|
+
return new _RestfulFactory(
|
|
2356
|
+
this.entityClass,
|
|
2357
|
+
{
|
|
2358
|
+
...this.options,
|
|
2359
|
+
skipNonQueryableFields: enable
|
|
2360
|
+
},
|
|
2361
|
+
this.__resolveVisited
|
|
2362
|
+
);
|
|
2363
|
+
}
|
|
2364
|
+
renameEntityClass(name) {
|
|
2365
|
+
return new _RestfulFactory(
|
|
2366
|
+
this.entityClass,
|
|
2367
|
+
{
|
|
2368
|
+
...this.options,
|
|
2369
|
+
entityClassName: name
|
|
2370
|
+
},
|
|
2371
|
+
this.__resolveVisited
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
useRelations(...relations) {
|
|
2375
|
+
return new _RestfulFactory(
|
|
2376
|
+
this.entityClass,
|
|
2377
|
+
{
|
|
2378
|
+
...this.options,
|
|
2379
|
+
relations: [...this.options.relations || [], ...relations]
|
|
2380
|
+
},
|
|
2381
|
+
this.__resolveVisited
|
|
2382
|
+
);
|
|
2383
|
+
}
|
|
2384
|
+
get entityClassName() {
|
|
2119
2385
|
return this.options.entityClassName || this.entityClass.name;
|
|
2120
2386
|
}
|
|
2121
2387
|
get fieldsToOmit() {
|
|
@@ -2139,7 +2405,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2139
2405
|
get createDto() {
|
|
2140
2406
|
return RenameClass(
|
|
2141
2407
|
OmitTypeExclude(this.entityClass, this.fieldsInCreateToOmit),
|
|
2142
|
-
`Create${this.
|
|
2408
|
+
`Create${this.entityClassName}Dto`
|
|
2143
2409
|
);
|
|
2144
2410
|
}
|
|
2145
2411
|
get fieldsInUpdateToOmit() {
|
|
@@ -2154,7 +2420,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2154
2420
|
get updateDto() {
|
|
2155
2421
|
return RenameClass(
|
|
2156
2422
|
PartialType(OmitTypeExclude(this.entityClass, this.fieldsInUpdateToOmit)),
|
|
2157
|
-
`Update${this.
|
|
2423
|
+
`Update${this.entityClassName}Dto`
|
|
2158
2424
|
);
|
|
2159
2425
|
}
|
|
2160
2426
|
get importDto() {
|
|
@@ -2198,7 +2464,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2198
2464
|
if (this.options.skipNonQueryableFields) {
|
|
2199
2465
|
cl = PickTypeExpose(cl, this.queryableFields);
|
|
2200
2466
|
}
|
|
2201
|
-
return RenameClass(cl, `Find${this.
|
|
2467
|
+
return RenameClass(cl, `Find${this.entityClassName}Dto`);
|
|
2202
2468
|
}
|
|
2203
2469
|
get findAllCursorPaginatedDto() {
|
|
2204
2470
|
return RenameClass(
|
|
@@ -2206,7 +2472,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2206
2472
|
OmitTypeExclude(this.findAllDto, ["pageCount"]),
|
|
2207
2473
|
CursorPaginationDto
|
|
2208
2474
|
),
|
|
2209
|
-
`Find${this.
|
|
2475
|
+
`Find${this.entityClassName}CursorPaginatedDto`
|
|
2210
2476
|
);
|
|
2211
2477
|
}
|
|
2212
2478
|
get entityResultDto() {
|
|
@@ -2249,7 +2515,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2249
2515
|
const relationFactory = new _RestfulFactory(
|
|
2250
2516
|
relation.propertyClass,
|
|
2251
2517
|
{
|
|
2252
|
-
entityClassName: `${this.
|
|
2518
|
+
entityClassName: `${this.entityClassName}${this.options.relations ? upperFirst(relation.propertyName) : relation.propertyClass.name}`,
|
|
2253
2519
|
relations: this.options.relations && getNextLevelRelations(
|
|
2254
2520
|
this.options.relations.map(extractRelationName),
|
|
2255
2521
|
relation.propertyName
|
|
@@ -2280,7 +2546,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2280
2546
|
}
|
|
2281
2547
|
const res = RenameClass(
|
|
2282
2548
|
resultDto,
|
|
2283
|
-
`${this.
|
|
2549
|
+
`${this.entityClassName}ResultDto`
|
|
2284
2550
|
);
|
|
2285
2551
|
const currentContainer = this.__resolveVisited.get(this.entityClass);
|
|
2286
2552
|
if (currentContainer) {
|
|
@@ -2300,7 +2566,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2300
2566
|
(m) => !m.keepInCreate
|
|
2301
2567
|
)
|
|
2302
2568
|
]),
|
|
2303
|
-
`${this.
|
|
2569
|
+
`${this.entityClassName}CreateResultDto`
|
|
2304
2570
|
);
|
|
2305
2571
|
}
|
|
2306
2572
|
get entityReturnMessageDto() {
|
|
@@ -2342,14 +2608,14 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2342
2608
|
this.usePrefix(Post),
|
|
2343
2609
|
HttpCode(200),
|
|
2344
2610
|
ApiOperation({
|
|
2345
|
-
summary: `Create a new ${this.
|
|
2611
|
+
summary: `Create a new ${this.entityClassName}`,
|
|
2346
2612
|
...extras
|
|
2347
2613
|
}),
|
|
2348
2614
|
ApiBody({ type: this.createDto }),
|
|
2349
2615
|
ApiOkResponse({ type: this.entityCreateReturnMessageDto }),
|
|
2350
2616
|
ApiBadRequestResponse({
|
|
2351
2617
|
type: BlankReturnMessageDto3,
|
|
2352
|
-
description: `The ${this.
|
|
2618
|
+
description: `The ${this.entityClassName} is not valid`
|
|
2353
2619
|
})
|
|
2354
2620
|
]);
|
|
2355
2621
|
}
|
|
@@ -2360,14 +2626,14 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2360
2626
|
return MergeMethodDecorators([
|
|
2361
2627
|
this.usePrefix(Get, ":id"),
|
|
2362
2628
|
ApiOperation({
|
|
2363
|
-
summary: `Find a ${this.
|
|
2629
|
+
summary: `Find a ${this.entityClassName} by id`,
|
|
2364
2630
|
...extras
|
|
2365
2631
|
}),
|
|
2366
2632
|
ApiParam({ name: "id", type: this.idType, required: true }),
|
|
2367
2633
|
ApiOkResponse({ type: this.entityReturnMessageDto }),
|
|
2368
2634
|
ApiNotFoundResponse({
|
|
2369
2635
|
type: BlankReturnMessageDto3,
|
|
2370
|
-
description: `The ${this.
|
|
2636
|
+
description: `The ${this.entityClassName} with the given id was not found`
|
|
2371
2637
|
})
|
|
2372
2638
|
]);
|
|
2373
2639
|
}
|
|
@@ -2382,7 +2648,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2382
2648
|
return MergeMethodDecorators([
|
|
2383
2649
|
this.usePrefix(Get),
|
|
2384
2650
|
ApiOperation({
|
|
2385
|
-
summary: `Find all ${this.
|
|
2651
|
+
summary: `Find all ${this.entityClassName}`,
|
|
2386
2652
|
...extras
|
|
2387
2653
|
}),
|
|
2388
2654
|
ApiOkResponse({ type: this.entityArrayReturnMessageDto })
|
|
@@ -2392,7 +2658,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2392
2658
|
return MergeMethodDecorators([
|
|
2393
2659
|
this.usePrefix(Get),
|
|
2394
2660
|
ApiOperation({
|
|
2395
|
-
summary: `Find all ${this.
|
|
2661
|
+
summary: `Find all ${this.entityClassName}`,
|
|
2396
2662
|
...extras
|
|
2397
2663
|
}),
|
|
2398
2664
|
ApiOkResponse({ type: this.entityCursorPaginationReturnMessageDto })
|
|
@@ -2419,7 +2685,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2419
2685
|
this.usePrefix(Patch, ":id"),
|
|
2420
2686
|
HttpCode(200),
|
|
2421
2687
|
ApiOperation({
|
|
2422
|
-
summary: `Update a ${this.
|
|
2688
|
+
summary: `Update a ${this.entityClassName} by id`,
|
|
2423
2689
|
...extras
|
|
2424
2690
|
}),
|
|
2425
2691
|
ApiParam({ name: "id", type: this.idType, required: true }),
|
|
@@ -2427,11 +2693,11 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2427
2693
|
ApiOkResponse({ type: BlankReturnMessageDto3 }),
|
|
2428
2694
|
ApiNotFoundResponse({
|
|
2429
2695
|
type: BlankReturnMessageDto3,
|
|
2430
|
-
description: `The ${this.
|
|
2696
|
+
description: `The ${this.entityClassName} with the given id was not found`
|
|
2431
2697
|
}),
|
|
2432
2698
|
ApiBadRequestResponse({
|
|
2433
2699
|
type: BlankReturnMessageDto3,
|
|
2434
|
-
description: `The ${this.
|
|
2700
|
+
description: `The ${this.entityClassName} is not valid`
|
|
2435
2701
|
}),
|
|
2436
2702
|
ApiInternalServerErrorResponse({
|
|
2437
2703
|
type: BlankReturnMessageDto3,
|
|
@@ -2447,14 +2713,14 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2447
2713
|
this.usePrefix(Delete, ":id"),
|
|
2448
2714
|
HttpCode(200),
|
|
2449
2715
|
ApiOperation({
|
|
2450
|
-
summary: `Delete a ${this.
|
|
2716
|
+
summary: `Delete a ${this.entityClassName} by id`,
|
|
2451
2717
|
...extras
|
|
2452
2718
|
}),
|
|
2453
2719
|
ApiParam({ name: "id", type: this.idType, required: true }),
|
|
2454
2720
|
ApiOkResponse({ type: BlankReturnMessageDto3 }),
|
|
2455
2721
|
ApiNotFoundResponse({
|
|
2456
2722
|
type: BlankReturnMessageDto3,
|
|
2457
|
-
description: `The ${this.
|
|
2723
|
+
description: `The ${this.entityClassName} with the given id was not found`
|
|
2458
2724
|
}),
|
|
2459
2725
|
ApiInternalServerErrorResponse({
|
|
2460
2726
|
type: BlankReturnMessageDto3,
|
|
@@ -2467,7 +2733,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2467
2733
|
Post("import"),
|
|
2468
2734
|
HttpCode(200),
|
|
2469
2735
|
ApiOperation({
|
|
2470
|
-
summary: `Import ${this.
|
|
2736
|
+
summary: `Import ${this.entityClassName}`,
|
|
2471
2737
|
...extras
|
|
2472
2738
|
}),
|
|
2473
2739
|
ApiBody({ type: this.importDto }),
|
|
@@ -2589,7 +2855,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
2589
2855
|
Object.defineProperty(cl.prototype, method, descriptor);
|
|
2590
2856
|
});
|
|
2591
2857
|
}
|
|
2592
|
-
return RenameClass(cl, `${this.
|
|
2858
|
+
return RenameClass(cl, `${this.entityClassName}Controller`);
|
|
2593
2859
|
}
|
|
2594
2860
|
crudService(options = {}) {
|
|
2595
2861
|
return CrudService(this.entityClass, {
|
|
@@ -2720,6 +2986,8 @@ var applyQueryMatchBooleanMySQL = createQueryCondition(
|
|
|
2720
2986
|
}
|
|
2721
2987
|
);
|
|
2722
2988
|
export {
|
|
2989
|
+
BindingColumn,
|
|
2990
|
+
BindingValue,
|
|
2723
2991
|
BlankCursorPaginationReturnMessageDto,
|
|
2724
2992
|
BoolColumn,
|
|
2725
2993
|
CrudBase,
|
|
@@ -2727,6 +2995,7 @@ export {
|
|
|
2727
2995
|
CursorPaginationDto,
|
|
2728
2996
|
CursorPaginationReturnMessageDto,
|
|
2729
2997
|
DateColumn,
|
|
2998
|
+
DefaultBindingKey,
|
|
2730
2999
|
EnumColumn,
|
|
2731
3000
|
FloatColumn,
|
|
2732
3001
|
GenericCursorPaginationReturnMessageDto,
|