@simitgroup/simpleapp-generator 1.6.7-k-alpha → 1.6.7-m-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 +7 -1
- 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/processors/simpleapp.processor.ts.eta +17 -9
|
@@ -337,12 +337,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
async createManyWithId(appuser: UserContext, datas: T[]) {
|
|
340
|
-
if (Array.isArray(datas)) {
|
|
341
|
-
const dbsession = appuser.getDBSession();
|
|
342
|
-
if (dbsession && !dbsession.inTransaction()) {
|
|
343
|
-
dbsession.startTransaction({ readPreference: 'primary' });
|
|
344
|
-
}
|
|
345
340
|
|
|
341
|
+
if (Array.isArray(datas)) {
|
|
342
|
+
|
|
346
343
|
for (let i = 0; i < datas.length; i++) {
|
|
347
344
|
const data = datas[i];
|
|
348
345
|
let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
@@ -354,6 +351,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
354
351
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
355
352
|
}
|
|
356
353
|
|
|
354
|
+
const dbsession = appuser.getDBSession();
|
|
355
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
356
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
357
|
+
}
|
|
358
|
+
|
|
357
359
|
const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
358
360
|
await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
|
|
359
361
|
for (let i = 0; i < datas.length; i++) {
|
|
@@ -444,8 +446,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
444
446
|
await this.validateData(appuser, data);
|
|
445
447
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
446
448
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
+
const dbsession = appuser.getDBSession();
|
|
450
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
451
|
+
dbsession.startTransaction({ readPreference: 'primary' });
|
|
452
|
+
}
|
|
453
|
+
const result = await this.doc.insertMany(datas,{session:dbsession});
|
|
449
454
|
await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
|
|
450
455
|
return result;
|
|
451
456
|
} else {
|
|
@@ -831,7 +836,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
831
836
|
}
|
|
832
837
|
};
|
|
833
838
|
|
|
834
|
-
findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined) => {
|
|
839
|
+
findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined,skipLog:boolean=false) => {
|
|
835
840
|
const existingdata = await this.findById(appuser, id);
|
|
836
841
|
if (!existingdata) {
|
|
837
842
|
throw new NotFoundException(`${id} not found`, 'not found');
|
|
@@ -873,7 +878,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
|
|
|
873
878
|
session: dbsession,
|
|
874
879
|
new: true,
|
|
875
880
|
});
|
|
876
|
-
|
|
881
|
+
//skip audit trail, useful when want to patch x-foreignkey code,label
|
|
882
|
+
if(!skipLog) {
|
|
883
|
+
await this.audittrail.addEvent(appuser, this.documentName, id, 'patch', data);
|
|
884
|
+
}
|
|
877
885
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
878
886
|
|
|
879
887
|
if (this.hooks.afterUpdate) await this.hooks.afterUpdate(appuser, id, existingdata, result);
|