@simitgroup/simpleapp-generator 2.0.0-e-alpha → 2.0.0-g-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 +13 -0
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -3
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/webhook.js +1 -1
- package/dist/generate.js +1 -1
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/index.ts +2 -2
- package/src/buildinschemas/{webhook.ts.backup → webhook.ts} +1 -1
- package/src/generate.ts +1 -1
- package/templates/basic/nest/module.ts.eta +2 -2
- package/templates/basic/nest/service.ts.eta +2 -2
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +15 -7
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +41 -42
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +11 -11
- package/templates/nest/src/simple-app/.core/features/log/log.controller.ts.eta +42 -0
- package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +11 -8
- package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +48 -13
- package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +23 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +13 -6
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +5 -2
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +6 -5
- package/templates/nest/src/simple-app/.core/features/profile/profile.service.ts.eta +3 -1
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +7 -5
- package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +3 -3
- package/templates/nest/src/simple-app/.core/features/user-context/user.context.ts.eta +11 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +36 -36
- package/templates/nest/src/simple-app/.core/framework/base/simple-app.service.ts.eta +188 -165
- package/templates/nest/src/simple-app/mini-apps/mini-apps.module.ts._eta +14 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +5 -1
- package/templates/nuxt/components/form/FormDocnoformat.vue._eta +78 -17
- package/templates/nuxt/components/renderer/RendererDocHistories.vue._eta +90 -50
- package/templates/nuxt/components/user/UserTenantPicker.vue._eta +6 -1
- package/templates/nuxt/composables/docformat.generate.ts.eta +2 -2
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +2 -2
- /package/src/buildinschemas/{documentnoformat.ts.backup → documentnoformat.ts} +0 -0
|
@@ -19,11 +19,12 @@ import { foreignkeys } from '../../features/foreign-key/foreignkeys.dict';
|
|
|
19
19
|
import { CustomException } from '../custom-exception';
|
|
20
20
|
|
|
21
21
|
import { camelToKebab } from 'src/simple-app/.core/utils/string-utils';
|
|
22
|
-
import {
|
|
22
|
+
import { SimpleAppDocumentNoFormatService } from '../../features/document-no-format/document-no-format.service';
|
|
23
23
|
import { UserContext } from '../../features/user-context/user.context';
|
|
24
24
|
import { RunWebhookService } from '../../features/webhook/run-webhook.service';
|
|
25
25
|
import { UniqueKeyExistResponse, DeleteResultType, IsolationType, MoreProjectionType, SchemaFields, TextSearchBody, PatchManyRequest } from '../schemas';
|
|
26
26
|
import { SimpleAppLogService } from '../../features/log/log.service';
|
|
27
|
+
import { ProcessErrorException } from 'src/simple-app/features/exception/process-error.exception';
|
|
27
28
|
|
|
28
29
|
@Injectable()
|
|
29
30
|
export class SimpleAppService<T extends SchemaFields> {
|
|
@@ -38,7 +39,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
38
39
|
// @Inject(AuditTrail)
|
|
39
40
|
// protected audittrail: AuditTrail;
|
|
40
41
|
// @Inject(DocNumberFormatGenerator)
|
|
41
|
-
protected docnogenerator:
|
|
42
|
+
protected docnogenerator: SimpleAppDocumentNoFormatService;
|
|
42
43
|
protected logger = new Logger();
|
|
43
44
|
protected strictIsolation = true;
|
|
44
45
|
protected jsonschema: any = {
|
|
@@ -62,10 +63,19 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
62
63
|
protected withDocNumberFormat = false;
|
|
63
64
|
protected foreignkeys = {};
|
|
64
65
|
private eventEmitter: EventEmitter2;
|
|
65
|
-
private logSvc:SimpleAppLogService;
|
|
66
|
+
private logSvc: SimpleAppLogService;
|
|
66
67
|
// protected userprovider = new UserContext() ;
|
|
67
68
|
|
|
68
|
-
constructor(
|
|
69
|
+
constructor(
|
|
70
|
+
doctype: string,
|
|
71
|
+
docname: string,
|
|
72
|
+
newdoc: Model<T>,
|
|
73
|
+
isolationtype: IsolationType = IsolationType.org,
|
|
74
|
+
eventEmitter: EventEmitter2,
|
|
75
|
+
docnogenerator: SimpleAppDocumentNoFormatService,
|
|
76
|
+
logSvc: SimpleAppLogService,
|
|
77
|
+
runWebHook: RunWebhookService,
|
|
78
|
+
) {
|
|
69
79
|
// console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
|
|
70
80
|
this.eventEmitter = eventEmitter;
|
|
71
81
|
this.documentType = doctype.toUpperCase();
|
|
@@ -73,8 +83,8 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
73
83
|
this.doc = newdoc;
|
|
74
84
|
this.docnogenerator = docnogenerator;
|
|
75
85
|
this.isolationtype = isolationtype;
|
|
76
|
-
this.logSvc = logSvc
|
|
77
|
-
this.runWebHook = runWebHook
|
|
86
|
+
this.logSvc = logSvc;
|
|
87
|
+
this.runWebHook = runWebHook;
|
|
78
88
|
// this.tenantdoc = tenantdoc
|
|
79
89
|
}
|
|
80
90
|
getDocumentType = () => this.documentType;
|
|
@@ -348,100 +358,105 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
348
358
|
}
|
|
349
359
|
}
|
|
350
360
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
361
|
+
// seems no use, and confusing
|
|
362
|
+
// async createManyWithId(appuser: UserContext, datas: T[]) {
|
|
363
|
+
// if (Array.isArray(datas)) {
|
|
364
|
+
// for (let i = 0; i < datas.length; i++) {
|
|
365
|
+
// const data = datas[i];
|
|
366
|
+
// let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
367
|
+
// isolationFilter = this.polishIsolationFilter(isolationFilter, data);
|
|
368
|
+
|
|
369
|
+
// Object.assign(data, isolationFilter);
|
|
370
|
+
// this.reCalculateValue(data);
|
|
371
|
+
// await this.validateData(appuser, data);
|
|
372
|
+
// this.applyNestedDateTime(appuser, data, 'create');
|
|
373
|
+
// }
|
|
374
|
+
|
|
375
|
+
// const dbsession = appuser.getDBSession();
|
|
376
|
+
// if (dbsession && !dbsession.inTransaction()) {
|
|
377
|
+
// dbsession.startTransaction({ readPreference: 'primary' });
|
|
378
|
+
// }
|
|
379
|
+
|
|
380
|
+
// const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
381
|
+
// await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
|
|
382
|
+
// for (let i = 0; i < datas.length; i++) {
|
|
383
|
+
// appuser.addInsertedRecordId(this.documentName, datas[i]._id);
|
|
384
|
+
// }
|
|
385
|
+
// return result;
|
|
386
|
+
// } else {
|
|
387
|
+
// throw new BadRequestException(this.getDocumentType() + ': create many only support array');
|
|
388
|
+
// }
|
|
389
|
+
// }
|
|
379
390
|
|
|
380
391
|
/**
|
|
381
392
|
* create many from array with hooks (temporary used for generate sample data only)
|
|
382
393
|
* @param appuser
|
|
383
394
|
* @param datas
|
|
384
395
|
*/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
396
|
+
//seems nobody use. also confusing
|
|
397
|
+
// async createManyWithHook(appuser: UserContext, datas: T[]) {
|
|
398
|
+
// if (Array.isArray(datas)) {
|
|
399
|
+
// for (let i = 0; i < datas.length; i++) {
|
|
400
|
+
// const data = datas[i];
|
|
401
|
+
|
|
402
|
+
// let result;
|
|
403
|
+
// const dbsession = appuser.getDBSession();
|
|
404
|
+
// if (dbsession && !dbsession.inTransaction()) {
|
|
405
|
+
// dbsession.startTransaction({ readPreference: 'primary' });
|
|
406
|
+
// }
|
|
407
|
+
|
|
408
|
+
// if (this.withDocNumberFormat && !data[this.documentIdentityCode]) {
|
|
409
|
+
// await this.genNewDocNo(appuser, data);
|
|
410
|
+
// }
|
|
411
|
+
|
|
412
|
+
// let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
413
|
+
// isolationFilter = this.polishIsolationFilter(isolationFilter, data);
|
|
414
|
+
|
|
415
|
+
// Object.assign(data, isolationFilter);
|
|
416
|
+
// this.reCalculateValue(data);
|
|
417
|
+
// await this.validateData(appuser, data);
|
|
418
|
+
// this.applyNestedDateTime(appuser, data, 'create');
|
|
419
|
+
|
|
420
|
+
// //new way of hook
|
|
421
|
+
// await this.runEvent(appuser, this.setHookName('beforeCreate'), { data: data }, false);
|
|
422
|
+
|
|
423
|
+
// const newdoc = new this.doc(data);
|
|
424
|
+
|
|
425
|
+
// try {
|
|
426
|
+
// result = await newdoc.save({ session: dbsession });
|
|
427
|
+
// await this.addAuditEvent(appuser, this.documentName, result._id, 'create', data);
|
|
428
|
+
// appuser.addInsertedRecordId(this.documentName, result._id);
|
|
429
|
+
// } catch (err) {
|
|
430
|
+
// this.logger.error(err);
|
|
431
|
+
// throw new ProcessErrorException('ERR_CREATE_MANY',err.message,{
|
|
432
|
+
// err:err
|
|
433
|
+
// })
|
|
434
|
+
// // const processdata = await this.runEvent(appuser, 'processdata.processError', {
|
|
435
|
+
// // err: err,
|
|
436
|
+
// // });
|
|
437
|
+
|
|
438
|
+
// // if (!processdata) {
|
|
439
|
+
// // throw new InternalServerErrorException(err);
|
|
440
|
+
// // } else {
|
|
441
|
+
// // throw new CustomException(processdata.code, processdata.msg);
|
|
442
|
+
// // }
|
|
443
|
+
// }
|
|
444
|
+
|
|
445
|
+
// try {
|
|
446
|
+
// //new way of hook
|
|
447
|
+
// await this.runEvent(appuser, this.setHookName('afterCreate'), { data: data }, false);
|
|
448
|
+
// await this.callWebhook(appuser, 'create', result);
|
|
449
|
+
|
|
450
|
+
// // return result as T;
|
|
451
|
+
// } catch (err) {
|
|
452
|
+
// throw new InternalServerErrorException(`createHook ${this.documentType} error: ${JSON.stringify(err)}`, `${this.documentType} createHook error`);
|
|
453
|
+
// }
|
|
454
|
+
// }
|
|
455
|
+
// } else {
|
|
456
|
+
// throw new BadRequestException(this.getDocumentType() + ': create many only support array');
|
|
457
|
+
// }
|
|
458
|
+
// return 'ok';
|
|
459
|
+
// }
|
|
445
460
|
|
|
446
461
|
/**
|
|
447
462
|
* create many from array, for performance reason it submit all item in 1 go, so it won't implement hooks
|
|
@@ -464,76 +479,85 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
464
479
|
if (dbsession && !dbsession.inTransaction()) {
|
|
465
480
|
dbsession.startTransaction({ readPreference: 'primary' });
|
|
466
481
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
482
|
+
|
|
483
|
+
try{
|
|
484
|
+
const result = await this.doc.insertMany(datas, { session: dbsession });
|
|
485
|
+
await this.addManyAuditEvents(appuser, this.documentName, 'createMany', datas);
|
|
486
|
+
return result;
|
|
487
|
+
}catch(e){
|
|
488
|
+
throw e
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
470
492
|
} else {
|
|
471
493
|
throw new BadRequestException(this.getDocumentType() + ': create many only support array');
|
|
472
494
|
}
|
|
473
495
|
}
|
|
474
|
-
async createWithId(appuser: UserContext, data: T) {
|
|
475
|
-
let result;
|
|
476
496
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
497
|
+
//seems nobody use, also confusing
|
|
498
|
+
// async createWithId(appuser: UserContext, data: T) {
|
|
499
|
+
// let result;
|
|
500
|
+
|
|
501
|
+
// if (!data._id) {
|
|
502
|
+
// data._id = crypto.randomUUID();
|
|
503
|
+
// }
|
|
504
|
+
// const dbsession = appuser.getDBSession();
|
|
505
|
+
// if (dbsession && !dbsession.inTransaction()) {
|
|
506
|
+
// dbsession.startTransaction({ readPreference: 'primary' });
|
|
507
|
+
// }
|
|
508
|
+
|
|
509
|
+
// this.logger.debug('this.withDocNumberFormat :' + this.withDocNumberFormat + ' && ' + '!data[this.documentIdentityCode] ==' + !data[this.documentIdentityCode]);
|
|
510
|
+
// if (this.withDocNumberFormat && !data[this.documentIdentityCode]) {
|
|
511
|
+
// await this.genNewDocNo(appuser, data);
|
|
512
|
+
// }
|
|
513
|
+
|
|
514
|
+
// let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
|
|
515
|
+
// isolationFilter = this.polishIsolationFilter(isolationFilter, data);
|
|
516
|
+
|
|
517
|
+
// this.logger.debug('isolationFilter', 'SimpleAppService');
|
|
518
|
+
// this.logger.debug(isolationFilter, 'SimpleAppService');
|
|
519
|
+
// this.logger.debug('Create data before isolation', 'SimpleAppService');
|
|
520
|
+
// this.logger.debug(data, 'SimpleAppService');
|
|
521
|
+
// Object.assign(data, isolationFilter);
|
|
522
|
+
// this.reCalculateValue(data);
|
|
523
|
+
// await this.validateData(appuser, data);
|
|
524
|
+
// this.logger.debug(data, `after create validation`);
|
|
525
|
+
// this.applyNestedDateTime(appuser, data, 'create');
|
|
526
|
+
|
|
527
|
+
// //new way of hook
|
|
528
|
+
|
|
529
|
+
// await this.runEvent(appuser, this.setHookName('beforeCreate'), { data: data }, false);
|
|
530
|
+
|
|
531
|
+
// this.logger.debug(data, `Create Record ${this.documentName}`);
|
|
532
|
+
// const newdoc = new this.doc(data);
|
|
533
|
+
// await this.identifyForeignKeys(appuser, data);
|
|
534
|
+
// try {
|
|
535
|
+
// result = await newdoc.save({ session: dbsession });
|
|
536
|
+
// await this.addAuditEvent(appuser, this.documentName, result._id, 'create', data);
|
|
537
|
+
// appuser.addInsertedRecordId(this.documentName, result._id);
|
|
538
|
+
// } catch (err) {
|
|
539
|
+
// this.logger.error(err);
|
|
540
|
+
// const processdata = await this.runEvent(appuser, 'processdata.processError', {
|
|
541
|
+
// err: err,
|
|
542
|
+
// });
|
|
543
|
+
|
|
544
|
+
// if (!processdata) {
|
|
545
|
+
// throw new InternalServerErrorException(err);
|
|
546
|
+
// } else {
|
|
547
|
+
// throw new CustomException(processdata.code, processdata.msg);
|
|
548
|
+
// }
|
|
549
|
+
// }
|
|
550
|
+
|
|
551
|
+
// try {
|
|
552
|
+
// //new way of hook
|
|
553
|
+
// await this.runEvent(appuser, this.setHookName('afterCreate'), { data: result }, false);
|
|
554
|
+
|
|
555
|
+
// await this.callWebhook(appuser, 'create', result);
|
|
556
|
+
// return result as T;
|
|
557
|
+
// } catch (err) {
|
|
558
|
+
// throw new InternalServerErrorException(`createHook ${this.documentType} error: ${JSON.stringify(err)}`, `${this.documentType} createHook error`);
|
|
559
|
+
// }
|
|
560
|
+
// }
|
|
537
561
|
|
|
538
562
|
async create(appuser: UserContext, data: T, noStartTransaction: boolean = false) {
|
|
539
563
|
let result;
|
|
@@ -1038,7 +1062,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
1038
1062
|
return createresult;
|
|
1039
1063
|
} else {
|
|
1040
1064
|
const updateresult = await this.findIdThenPatch(appuser, id, data);
|
|
1041
|
-
const finaldata = await this.findById(appuser, id);
|
|
1065
|
+
const finaldata = await this.findById(appuser, id);
|
|
1042
1066
|
await this.runEvent(appuser, this.setHookName('afterSetStatus'), { docStatus: docstatus, data: finaldata }, false);
|
|
1043
1067
|
await this.addAuditEvent(appuser, this.documentName, id, docstatus, data);
|
|
1044
1068
|
|
|
@@ -1078,10 +1102,9 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
1078
1102
|
*/
|
|
1079
1103
|
async runEvent(appuser: UserContext, eventName: string, payloads: any, enforce: boolean = true) {
|
|
1080
1104
|
try {
|
|
1081
|
-
|
|
1082
1105
|
if (enforce && !this.eventEmitter.hasListeners(eventName)) {
|
|
1083
1106
|
throw new InternalServerErrorException(`${eventName} seems no listener`);
|
|
1084
|
-
} else if (this.eventEmitter.hasListeners(eventName)) {
|
|
1107
|
+
} else if (this.eventEmitter.hasListeners(eventName)) {
|
|
1085
1108
|
const res = await this.eventEmitter.emitAsync(eventName, appuser, payloads);
|
|
1086
1109
|
|
|
1087
1110
|
if (!res) {
|
|
@@ -1276,16 +1299,16 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
1276
1299
|
//only realtime webhook supported at this moment
|
|
1277
1300
|
async callWebhook(appuser: UserContext, actionName: string, data: any) {
|
|
1278
1301
|
try {
|
|
1279
|
-
await this.runWebHook.run(appuser, this.documentName, actionName, data);
|
|
1302
|
+
await this.runWebHook.run(appuser, this.documentName, actionName, data);
|
|
1280
1303
|
} catch (e) {
|
|
1281
1304
|
throw new InternalServerErrorException(e);
|
|
1282
1305
|
}
|
|
1283
1306
|
}
|
|
1284
1307
|
|
|
1285
1308
|
async addAuditEvent(appUser: UserContext, documentName: string, id: string, eventType: string, data: any) {
|
|
1286
|
-
await this.logSvc.addEvent(appUser,documentName,id,eventType,data)
|
|
1309
|
+
await this.logSvc.addEvent(appUser, documentName, id, eventType, data);
|
|
1287
1310
|
}
|
|
1288
1311
|
async addManyAuditEvents(appUser: UserContext, documentName: string, eventType: string, datas: any) {
|
|
1289
|
-
await this.logSvc.addManyEvents(appUser,documentName,eventType,datas)
|
|
1312
|
+
await this.logSvc.addManyEvents(appUser, documentName, eventType, datas);
|
|
1290
1313
|
}
|
|
1291
1314
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator.
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2025-09-01
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
import { Module } from '@nestjs/common';
|
|
8
|
+
@Module({
|
|
9
|
+
// QueueTuitionClassModule
|
|
10
|
+
imports: [],
|
|
11
|
+
providers: [],
|
|
12
|
+
exports: [],
|
|
13
|
+
})
|
|
14
|
+
export class SimpleAppMiniAppsModule {}
|
|
@@ -11,7 +11,7 @@ import {SimpleAppEventsModule} from './events/events.module'
|
|
|
11
11
|
import {SimpleAppFeaturesModule} from './features/features.module'
|
|
12
12
|
|
|
13
13
|
import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
14
|
-
|
|
14
|
+
import { SimpleAppMiniAppsModule } from './mini-apps/mini-apps.module';
|
|
15
15
|
|
|
16
16
|
@Module({
|
|
17
17
|
imports: [
|
|
@@ -19,6 +19,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
19
19
|
SimpleAppResourcesModule,
|
|
20
20
|
SimpleAppEventsModule,
|
|
21
21
|
SimpleAppResourceApiModule,
|
|
22
|
+
SimpleAppFeaturesModule,
|
|
23
|
+
SimpleAppMiniAppsModule
|
|
22
24
|
],
|
|
23
25
|
controllers: [],
|
|
24
26
|
providers: [],
|
|
@@ -27,6 +29,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
27
29
|
SimpleAppResourcesModule,
|
|
28
30
|
SimpleAppEventsModule,
|
|
29
31
|
SimpleAppResourceApiModule,
|
|
32
|
+
SimpleAppFeaturesModule,
|
|
33
|
+
SimpleAppMiniAppsModule
|
|
30
34
|
]
|
|
31
35
|
})
|
|
32
36
|
export class SimpleAppModule {}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
:document="doc"
|
|
8
8
|
@on="actionListener"
|
|
9
9
|
></SimpleAppFormToolBar>
|
|
10
|
-
<div
|
|
11
|
-
class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2"
|
|
12
|
-
>
|
|
10
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
13
11
|
<SimpleAppInput
|
|
14
12
|
:input-type="SimpleAppInputType.autocomplete"
|
|
15
13
|
:setting="o.getField('#/properties/branch')"
|
|
@@ -19,11 +17,15 @@
|
|
|
19
17
|
:readonly="!doc.isNew()"
|
|
20
18
|
:input-type="SimpleAppInputType.select"
|
|
21
19
|
:setting="o.getField('#/properties/docNoType')"
|
|
22
|
-
:options="
|
|
20
|
+
:options="
|
|
21
|
+
getAllDocFormats().map((item) => ({
|
|
22
|
+
label: docNoTypeMapping[item.docType] || item.docType,
|
|
23
|
+
value: item.docType,
|
|
24
|
+
}))
|
|
25
|
+
"
|
|
23
26
|
v-model="data.docNoType"
|
|
24
27
|
/>
|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
<SimpleAppInput
|
|
28
30
|
:input-type="SimpleAppInputType.text"
|
|
29
31
|
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
v-model="data.default"
|
|
48
50
|
/>
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
<SimpleAppInput
|
|
52
53
|
:input-type="SimpleAppInputType.text"
|
|
53
54
|
:setting="o.getField('#/properties/docNoPattern')"
|
|
@@ -65,27 +66,43 @@
|
|
|
65
66
|
</div>
|
|
66
67
|
</SimpleAppForm>
|
|
67
68
|
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
69
|
+
<DataTable
|
|
70
|
+
:value="formatParams"
|
|
71
|
+
class="p-datatable-sm mt-6"
|
|
72
|
+
stripedRows
|
|
73
|
+
responsiveLayout="scroll"
|
|
74
|
+
>
|
|
75
|
+
<template #header>
|
|
76
|
+
<div class="text-sm font-semibold">Format Parameters</div>
|
|
77
|
+
</template>
|
|
78
|
+
<Column
|
|
79
|
+
field="placeholder"
|
|
80
|
+
header="Placeholder"
|
|
81
|
+
style="width: 30%"
|
|
82
|
+
class="text-xs"
|
|
83
|
+
/>
|
|
84
|
+
<Column field="description" header="Description" class="text-xs" />
|
|
85
|
+
</DataTable>
|
|
68
86
|
</div>
|
|
69
87
|
</template>
|
|
70
88
|
|
|
71
89
|
<script setup lang="ts">
|
|
72
90
|
/**
|
|
73
|
-
* This file was automatically generated by simpleapp generator
|
|
74
|
-
* --remove-this-line-to-prevent-override--
|
|
91
|
+
* This file was automatically generated by simpleapp generator.
|
|
75
92
|
* last change 2024-02-16
|
|
76
93
|
* Author: Ks Tan
|
|
77
94
|
*/
|
|
78
95
|
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
96
|
+
import { DocumentNoFormat } from "~/simpleapp/generate/openapi";
|
|
97
|
+
import { DocumentnoformatDoc } from "~/simpleapp/docs/DocumentnoformatDoc";
|
|
81
98
|
|
|
82
99
|
const props = defineProps<{
|
|
83
100
|
_id?: string;
|
|
84
|
-
doc?:
|
|
85
|
-
paras?:
|
|
101
|
+
doc?: DocumentnoformatDoc;
|
|
102
|
+
paras?: Partial<DocumentNoFormat>;
|
|
86
103
|
}>();
|
|
87
104
|
|
|
88
|
-
const doc = props.doc ?? useNuxtApp().$
|
|
105
|
+
const doc = props.doc ?? useNuxtApp().$DocumentnoformatDoc()
|
|
89
106
|
const data = doc.getReactiveData();
|
|
90
107
|
const sample = ref("");
|
|
91
108
|
const emits = defineEmits(["after"]);
|
|
@@ -94,9 +111,41 @@ const id = computed(() => props._id ?? "");
|
|
|
94
111
|
/************ start default methods ****************/
|
|
95
112
|
|
|
96
113
|
const newData = () => {
|
|
97
|
-
doc.setNew()
|
|
98
|
-
delete data.value.branch
|
|
99
|
-
}
|
|
114
|
+
doc.setNew();
|
|
115
|
+
delete data.value.branch;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const formatParams = [
|
|
119
|
+
{
|
|
120
|
+
placeholder: "[0000]",
|
|
121
|
+
description: "0001 displays the transaction numbering.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
placeholder: "{YYYY}",
|
|
125
|
+
description: "Displays 4-digit current year (e.g., 2025-9999).",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
placeholder: "{YY}",
|
|
129
|
+
description: "Displays 2-digit current year (e.g., 25).",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
placeholder: "{MM}",
|
|
133
|
+
description: "Displays 2-digit current month (e.g., 01-12).",
|
|
134
|
+
},
|
|
135
|
+
{ placeholder: "{ddd}", description: "Displays current day (e.g., Tue)." },
|
|
136
|
+
{
|
|
137
|
+
placeholder: "{DD}",
|
|
138
|
+
description: "Displays 2-digit day of the month (e.g., 01-31).",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
placeholder: "{YYMM}",
|
|
142
|
+
description: "Displays 2-digit year and 2-digit month (e.g., 2504).",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
placeholder: "{YYYYMM}",
|
|
146
|
+
description: "Displays 4-digit year and 2-digit month (e.g., 202504).",
|
|
147
|
+
},
|
|
148
|
+
];
|
|
100
149
|
|
|
101
150
|
const getRecord = async () => {
|
|
102
151
|
if (id.value && id.value != "new") {
|
|
@@ -106,6 +155,18 @@ const getRecord = async () => {
|
|
|
106
155
|
}
|
|
107
156
|
};
|
|
108
157
|
|
|
158
|
+
const docNoTypeMapping: Record<string, string> = {
|
|
159
|
+
CN: "Credit Note",
|
|
160
|
+
ANNOUNCEMENT: "Announcement",
|
|
161
|
+
ENROLL: "Enrolment",
|
|
162
|
+
INV: "Invoice",
|
|
163
|
+
PAY: "Payment",
|
|
164
|
+
REFUND: "Refund",
|
|
165
|
+
STU: "Student",
|
|
166
|
+
TEACHER: "Teacher",
|
|
167
|
+
TUITION: "Tuition Class",
|
|
168
|
+
};
|
|
169
|
+
|
|
109
170
|
getRecord();
|
|
110
171
|
watch(id, async () => await getRecord());
|
|
111
172
|
/************ end default methods ****************/
|
|
@@ -134,7 +195,7 @@ onMounted(async () => {
|
|
|
134
195
|
// };
|
|
135
196
|
/************ end api methods ****************/
|
|
136
197
|
const updateSample = () => {
|
|
137
|
-
sample.value = "
|
|
198
|
+
sample.value = "Format Sample: " + previewDocNo();
|
|
138
199
|
};
|
|
139
200
|
|
|
140
201
|
const previewDocNo = (): string => {
|