@simitgroup/simpleapp-generator 1.6.7-j-alpha → 1.6.7-l-alpha
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/ReleaseNote.md +8 -0
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/webhookhistory.d.ts +3 -0
- package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
- package/dist/buildinschemas/webhookhistory.js +44 -0
- package/dist/buildinschemas/webhookhistory.js.map +1 -0
- package/dist/createproject.js +138 -0
- package/dist/createproject.js.map +1 -0
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +9 -4
- package/dist/generate.js.map +1 -1
- package/dist/index2.js +118 -0
- package/dist/index2.js.map +1 -0
- package/dist/installdependency.js +20 -0
- package/dist/installdependency.js.map +1 -0
- package/dist/installnest.js +2 -0
- package/dist/installnest.js.map +1 -0
- package/dist/installnuxt.js +2 -0
- package/dist/installnuxt.js.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/package.json +1 -1
- package/src/generate.ts +10 -3
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +26 -6
|
@@ -96,7 +96,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
96
96
|
public isReadOnly(): boolean {
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
|
-
reCalculateValue(data: T) {
|
|
99
|
+
reCalculateValue(data: T) {}
|
|
100
100
|
getIsolationFilter = (appuser: UserContext) => {
|
|
101
101
|
let isolationFilter = {};
|
|
102
102
|
switch (this.isolationtype) {
|
|
@@ -338,6 +338,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
338
338
|
|
|
339
339
|
async createManyWithId(appuser: UserContext, datas: T[]) {
|
|
340
340
|
if (Array.isArray(datas)) {
|
|
341
|
+
const dbsession = appuser.getDBSession();
|
|
342
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
343
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
344
|
+
}
|
|
345
|
+
|
|
341
346
|
for (let i = 0; i < datas.length; i++) {
|
|
342
347
|
const data = datas[i];
|
|
343
348
|
let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
@@ -348,9 +353,18 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
348
353
|
await this.validateData(appuser, data);
|
|
349
354
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
350
355
|
}
|
|
356
|
+
|
|
357
|
+
const dbsession = appuser.getDBSession();
|
|
358
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
359
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
360
|
+
}
|
|
361
|
+
const result = await this.doc.insertMany(datas,{session:dbsession});
|
|
351
362
|
|
|
352
|
-
const result = await this.doc.insertMany(datas);
|
|
363
|
+
const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
353
364
|
await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
|
|
365
|
+
for (let i = 0; i < datas.length; i++) {
|
|
366
|
+
appuser.addInsertedRecordId(this.documentName, datas[i]._id);
|
|
367
|
+
}
|
|
354
368
|
return result;
|
|
355
369
|
} else {
|
|
356
370
|
throw new BadRequestException(this.getDocumentType() + ': create many only support array');
|
|
@@ -436,8 +450,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
436
450
|
await this.validateData(appuser, data);
|
|
437
451
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
438
452
|
}
|
|
439
|
-
|
|
440
|
-
|
|
453
|
+
const dbsession = appuser.getDBSession();
|
|
454
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
455
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
456
|
+
}
|
|
457
|
+
const result = await this.doc.insertMany(datas,{session:dbsession});
|
|
441
458
|
await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
|
|
442
459
|
return result;
|
|
443
460
|
} else {
|
|
@@ -823,7 +840,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
823
840
|
}
|
|
824
841
|
};
|
|
825
842
|
|
|
826
|
-
findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined) => {
|
|
843
|
+
findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined,skipLog:boolean=false) => {
|
|
827
844
|
const existingdata = await this.findById(appuser, id);
|
|
828
845
|
if (!existingdata) {
|
|
829
846
|
throw new NotFoundException(`${id} not found`, 'not found');
|
|
@@ -865,7 +882,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
865
882
|
session: dbsession,
|
|
866
883
|
new: true,
|
|
867
884
|
});
|
|
868
|
-
|
|
885
|
+
//skip audit trail, useful when want to patch x-foreignkey code,label
|
|
886
|
+
if(!skipLog) {
|
|
887
|
+
await this.audittrail.addEvent(appuser, this.documentName, id, 'patch', data);
|
|
888
|
+
}
|
|
869
889
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
870
890
|
|
|
871
891
|
if (this.hooks.afterUpdate) await this.hooks.afterUpdate(appuser, id, existingdata, result);
|