@simitgroup/simpleapp-generator 1.0.47 → 1.0.48
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.md +35 -1
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -20
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/autoincreament.js.map +1 -1
- package/dist/buildinschemas/branch.js +1 -1
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
- package/dist/buildinschemas/docnoformat.js +12 -25
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +1 -0
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +10 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +24 -13
- package/dist/generate.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/type.d.ts +1 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +1 -1
- package/src/buildinschemas/branch.ts +1 -1
- package/src/buildinschemas/docnoformat.ts +13 -27
- package/src/buildinschemas/user.ts +1 -0
- package/src/framework.ts +10 -2
- package/src/generate.ts +26 -13
- package/src/index.ts +1 -1
- package/src/type.ts +1 -0
- package/templates/basic/nest/processor.ts.eta +2 -2
- package/templates/basic/nest/service.ts.eta +2 -4
- package/templates/basic/nuxt/pages.crud.vue.eta +1 -1
- package/templates/nest/src/app.controller.ts.eta +6 -0
- package/templates/nest/src/app.module.ts.eta +9 -1
- package/templates/nest/src/app.service.ts.eta +6 -0
- package/templates/nest/src/main.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +42 -11
- package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +5 -7
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
- package/templates/nuxt/app.vue.eta +6 -1
- package/templates/nuxt/assets/css/style.css._eta +12 -0
- package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
- package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
- package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
- package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
- package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
- package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
- package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +11 -7
- package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
- package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
- package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
- package/templates/nuxt/components/Invitation.vue.eta +2 -2
- package/templates/nuxt/components/Menus.vue.eta +6 -6
- package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +1 -1
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
- package/templates/nuxt/components/Spinner.vue.eta +9 -0
- package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
- package/templates/nuxt/layouts/default.vue.eta +3 -12
- package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
- package/templates/nuxt/nuxt.config.ts.eta +55 -12
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +83 -113
- package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -65
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
- package/templates/nuxt/pages/index.vue.eta +10 -85
- package/templates/nuxt/pages/login.vue.eta +9 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
- package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
- package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
- package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
- package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
- package/templates/nuxt/tailwind.config.ts._eta +66 -0
- package/templates/nuxt/types/index.ts.eta +22 -1
- package/templates/project/build.sh.eta +4 -4
- package/templates/project/schemas/invoice.ts.eta +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
- package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
- package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
- package/templates/nuxt/tailwind.config.ts.eta +0 -9
- /package/templates/nest/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +0 -0
- /package/templates/project/{config.json.eta → config.json._eta} +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* last change 2023-09-09
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
6
5
|
* Author: Ks Tan
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
7
|
import { Schema } from 'mongoose';
|
|
10
8
|
import { TenantOwner, Tenant } from '../types/tenant.type';
|
|
11
9
|
const schemasetting = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* last change 2023-09-09
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
6
5
|
* Author: Ks Tan
|
|
7
6
|
*/
|
|
8
7
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
1
7
|
import { Injectable, Logger,Inject } from '@nestjs/common';
|
|
2
8
|
import { InjectModel } from '@nestjs/mongoose';
|
|
3
9
|
import * as jsonpath from 'jsonpath'
|
|
4
10
|
import { uniq } from 'lodash';
|
|
5
|
-
|
|
11
|
+
import { AuditTrail } from '../commons/audittrail.service';
|
|
6
12
|
import {foreignkeys} from '../commons/dicts/foreignkeys'
|
|
7
13
|
import { Model,Types,PipelineStage,mongo, FilterQuery, ProjectionType} from 'mongoose';
|
|
8
14
|
import Ajv from 'ajv';
|
|
@@ -60,14 +66,21 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
60
66
|
protected errorlist = [];
|
|
61
67
|
protected withDocNumberFormat=false
|
|
62
68
|
protected foreignkeys = {}
|
|
69
|
+
|
|
70
|
+
@Inject(AuditTrail)
|
|
71
|
+
protected audittrail: AuditTrail
|
|
72
|
+
|
|
73
|
+
@Inject(DocNumberFormatGenerator)
|
|
74
|
+
protected docnogenerator: DocNumberFormatGenerator
|
|
75
|
+
|
|
76
|
+
|
|
63
77
|
// protected userprovider = new UserContext() ;
|
|
64
78
|
|
|
65
79
|
constructor(
|
|
66
80
|
doctype: string,
|
|
67
81
|
docname: string,
|
|
68
82
|
newdoc: Model<T>,
|
|
69
|
-
isolationtype: IsolationType = IsolationType.org
|
|
70
|
-
private docnogenerator:DocNumberFormatGenerator
|
|
83
|
+
isolationtype: IsolationType = IsolationType.org
|
|
71
84
|
) {
|
|
72
85
|
// console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
|
|
73
86
|
this.documentType = doctype.toUpperCase();
|
|
@@ -251,10 +264,16 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
251
264
|
|
|
252
265
|
|
|
253
266
|
async create(appuser:UserContext, data:T) {
|
|
267
|
+
this.audittrail.addEvent(data)
|
|
254
268
|
let result;
|
|
255
269
|
if(!data._id){
|
|
256
270
|
data._id = crypto.randomUUID()
|
|
257
271
|
}
|
|
272
|
+
const dbsession = appuser.getDBSession()
|
|
273
|
+
if(!dbsession.inTransaction()){
|
|
274
|
+
dbsession.startTransaction()
|
|
275
|
+
}
|
|
276
|
+
|
|
258
277
|
|
|
259
278
|
this.logger.debug('this.withDocNumberFormat :' + this.withDocNumberFormat + ' && ' + '!data[this.documentIdentityCode] ==' + !data[this.documentIdentityCode])
|
|
260
279
|
if(this.withDocNumberFormat && !data[this.documentIdentityCode]){
|
|
@@ -280,7 +299,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
280
299
|
const newdoc = new this.doc(data);
|
|
281
300
|
|
|
282
301
|
try{
|
|
283
|
-
result = await newdoc.save({session:
|
|
302
|
+
result = await newdoc.save({session:dbsession})
|
|
284
303
|
}catch(err){
|
|
285
304
|
this.logger.error(err)
|
|
286
305
|
throw new InternalServerErrorException(err)
|
|
@@ -392,6 +411,11 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
392
411
|
}
|
|
393
412
|
async findIdThenDelete(appuser:UserContext,id: string): Promise<any> {
|
|
394
413
|
const deletedata = await this.findById(appuser,id);
|
|
414
|
+
const dbsession = appuser.getDBSession()
|
|
415
|
+
if(!dbsession.inTransaction()){
|
|
416
|
+
dbsession.startTransaction()
|
|
417
|
+
}
|
|
418
|
+
|
|
395
419
|
let dependency
|
|
396
420
|
try {
|
|
397
421
|
await this.hook(appuser,HookType.beforeDelete, id);
|
|
@@ -404,7 +428,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
404
428
|
|
|
405
429
|
filterIsolation['_id'] = id;
|
|
406
430
|
this.logger.debug('delete filter', filterIsolation);
|
|
407
|
-
const result = await this.doc.deleteOne(filterIsolation).session(
|
|
431
|
+
const result = await this.doc.deleteOne(filterIsolation).session(dbsession);
|
|
408
432
|
const deleteresult = {result:result, data: deletedata}
|
|
409
433
|
this.logger.debug(deleteresult, " delete result" +this.doc.collection.name,)
|
|
410
434
|
// this.doc.findByIdAndDelete(id)
|
|
@@ -431,6 +455,12 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
431
455
|
findIdThenUpdate = async (appuser:UserContext,id: string, data: T,session:mongo.ClientSession=undefined) => {
|
|
432
456
|
const existingdata = await this.findById(appuser,id);
|
|
433
457
|
await this.hook(appuser,HookType.beforeUpdate, data);
|
|
458
|
+
|
|
459
|
+
const dbsession = appuser.getDBSession()
|
|
460
|
+
if(!dbsession.inTransaction()){
|
|
461
|
+
dbsession.startTransaction()
|
|
462
|
+
}
|
|
463
|
+
|
|
434
464
|
// try {
|
|
435
465
|
Object.assign(data, appuser.getUpdateFilter());
|
|
436
466
|
Object.assign(existingdata, data);
|
|
@@ -444,12 +474,13 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
444
474
|
|
|
445
475
|
isolationFilter['_id'] = id;
|
|
446
476
|
this.applyNestedDateTime(appuser,data,'update')
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
477
|
+
try{
|
|
478
|
+
const result = await this.doc.findOneAndUpdate(isolationFilter, data).session(dbsession);
|
|
479
|
+
await this.hook(appuser,HookType.afterUpdate, data);
|
|
480
|
+
return result;
|
|
481
|
+
} catch (err) {
|
|
482
|
+
throw new InternalServerErrorException(err.message);
|
|
483
|
+
}
|
|
453
484
|
};
|
|
454
485
|
|
|
455
486
|
//find what foreign key constraint
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
export type ApiEvent = {
|
|
8
|
+
_id: string
|
|
9
|
+
created: string
|
|
10
|
+
updated?:string
|
|
11
|
+
duration: number
|
|
12
|
+
createdby: string
|
|
13
|
+
path: string
|
|
14
|
+
ip: string
|
|
15
|
+
method: string
|
|
16
|
+
headers: any
|
|
17
|
+
data?: any
|
|
18
|
+
statusCode:number
|
|
19
|
+
status:string
|
|
20
|
+
errMsg?:string
|
|
21
|
+
errData?: any
|
|
22
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
1
7
|
import { ApiProperty } from '@nestjs/swagger';
|
|
2
8
|
import {ProfileUserInvites,ProfileUserBranch} from './profile.types'
|
|
3
9
|
export class RegTenantApiSchema {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
8
8
|
import { Model } from 'mongoose';
|
|
9
9
|
import { Injectable } from '@nestjs/common';
|
|
10
10
|
import { AutoincreamentProcessor } from '../generate/processors/autoinc.processor';
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
import { Autoincreament } from '../generate/types/autoinc.type';
|
|
13
13
|
import { UserContext } from '../generate/commons/user.context';
|
|
14
14
|
export { Autoincreament } from '../generate/types/autoinc.type';
|
|
@@ -17,9 +17,8 @@ export { Autoincreament } from '../generate/types/autoinc.type';
|
|
|
17
17
|
export class AutoincreamentService extends AutoincreamentProcessor {
|
|
18
18
|
constructor(
|
|
19
19
|
@InjectModel('Autoincreament') mydoc: Model<Autoincreament>,
|
|
20
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
21
20
|
) {
|
|
22
|
-
super(mydoc
|
|
21
|
+
super(mydoc);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
// hook = async (appuser:UserContext,type: string, data?: any) => {
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
8
8
|
import { Model } from 'mongoose';
|
|
9
|
-
import { Injectable } from '@nestjs/common';
|
|
9
|
+
import { Injectable, InternalServerErrorException } from '@nestjs/common';
|
|
10
10
|
import { BranchProcessor } from '../generate/processors/branch.processor';
|
|
11
11
|
import { Branch } from '../generate/types/branch.type';
|
|
12
|
+
import {alldocuments} from '../generate/commons/dicts/documents'
|
|
12
13
|
export { Branch } from '../generate/types/branch.type';
|
|
13
14
|
import { AutoincreamentService } from './autoinc.service';
|
|
14
15
|
import { UserContext } from '../generate/commons/user.context';
|
|
15
|
-
import {
|
|
16
|
+
import { Docnoformat,DocnoformatService } from './docno.service';
|
|
17
|
+
// import { Docnoformat } from '../generate/types/docno.type';
|
|
16
18
|
@Injectable()
|
|
17
19
|
export class BranchService extends BranchProcessor {
|
|
18
20
|
protected strictIsolation = false;
|
|
19
21
|
constructor(
|
|
20
22
|
@InjectModel('Branch') mydoc: Model<Branch>,
|
|
21
|
-
private increament: AutoincreamentService,
|
|
22
|
-
|
|
23
|
+
private increament: AutoincreamentService,
|
|
24
|
+
private docnoservice:DocnoformatService
|
|
23
25
|
) {
|
|
24
|
-
super(mydoc
|
|
26
|
+
super(mydoc);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -44,8 +46,9 @@ export class BranchService extends BranchProcessor {
|
|
|
44
46
|
);
|
|
45
47
|
data.branchId = searchresult.nextno;
|
|
46
48
|
break;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
case 'afterCreate':
|
|
50
|
+
await this.generateDefaultDocNumbers(appuser,data);
|
|
51
|
+
break;
|
|
49
52
|
// case 'beforeUpdate':
|
|
50
53
|
// break;
|
|
51
54
|
// case 'afterUpdate':
|
|
@@ -63,4 +66,41 @@ export class BranchService extends BranchProcessor {
|
|
|
63
66
|
}
|
|
64
67
|
return true;
|
|
65
68
|
};
|
|
69
|
+
|
|
70
|
+
generateDefaultDocNumbers =async (appuser,data) => {
|
|
71
|
+
const branchName = data.branchName
|
|
72
|
+
const branchCode = data.branchCode
|
|
73
|
+
const recordId = data._id
|
|
74
|
+
const branchId= data.branchId
|
|
75
|
+
const orgId = data.orgId
|
|
76
|
+
const tenantId = data.tenantId
|
|
77
|
+
const docformats = alldocuments.filter((item)=>item.docNumber)
|
|
78
|
+
for(let i=0; i< docformats.length; i++){
|
|
79
|
+
const doc = docformats[i]
|
|
80
|
+
const pattern = `${doc.docType}-${branchCode}-[00000]`
|
|
81
|
+
const formatdata:Docnoformat = {
|
|
82
|
+
_id:crypto.randomUUID(),
|
|
83
|
+
docNoFormatNo:'Default',
|
|
84
|
+
docNoFormatName:'Default',
|
|
85
|
+
docNoType: doc.docType,
|
|
86
|
+
docNoPattern: pattern,
|
|
87
|
+
branch:{_id:recordId,branchId:branchId,label:branchName},
|
|
88
|
+
branchId:branchId,
|
|
89
|
+
orgId:orgId,
|
|
90
|
+
tenantId:tenantId,
|
|
91
|
+
nextNumber:1,
|
|
92
|
+
} as Docnoformat
|
|
93
|
+
try{
|
|
94
|
+
const result = await this.docnoservice.create(appuser,formatdata)
|
|
95
|
+
if(!result){
|
|
96
|
+
throw new InternalServerErrorException(`Generate default document number for "${branchCode}" failed. Pattern: ${pattern}`,'generateDefaultDocNumbers')
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}catch(err){
|
|
100
|
+
this.logger.error(err)
|
|
101
|
+
throw new InternalServerErrorException(err)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
}
|
|
66
106
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BadRequestException } from '@nestjs/common';
|
|
2
1
|
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator.
|
|
4
|
-
*
|
|
5
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
6
5
|
* Author: Ks Tan
|
|
7
6
|
*/
|
|
8
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -17,11 +16,11 @@ export { Docnoformat } from '../generate/types/docno.type';
|
|
|
17
16
|
|
|
18
17
|
@Injectable()
|
|
19
18
|
export class DocnoformatService extends DocnoformatProcessor {
|
|
19
|
+
protected strictIsolation = false;
|
|
20
20
|
constructor(
|
|
21
21
|
@InjectModel('Docnoformat') mydoc: Model<Docnoformat>,
|
|
22
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
23
22
|
) {
|
|
24
|
-
super(mydoc
|
|
23
|
+
super(mydoc);
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
// hook = async (type: string, data?: any) => {
|
|
@@ -82,7 +81,6 @@ export class DocnoformatService extends DocnoformatProcessor {
|
|
|
82
81
|
docNoFormatNo: s.docNoFormatNo,
|
|
83
82
|
docNoFormatName: s.docNoFormatName,
|
|
84
83
|
docNoPattern: s.docNoPattern,
|
|
85
|
-
isMonthly: s.isMonthly,
|
|
86
84
|
nextNumber: s.nextNumber,
|
|
87
85
|
default: s.default,
|
|
88
86
|
sample: DocNumberFormatGenerator.previewDocNo(s),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -11,7 +11,6 @@ import { OrganizationProcessor } from '../generate/processors/org.processor';
|
|
|
11
11
|
import { Organization } from '../generate/types/org.type';
|
|
12
12
|
export { Organization } from '../generate/types/org.type';
|
|
13
13
|
import { AutoincreamentService } from './autoinc.service';
|
|
14
|
-
import { DocNumberFormatGenerator } from '../generate/commons/docnogenerator.service';
|
|
15
14
|
import { UserContext } from '../generate/commons/user.context';
|
|
16
15
|
|
|
17
16
|
@Injectable()
|
|
@@ -20,9 +19,8 @@ export class OrganizationService extends OrganizationProcessor {
|
|
|
20
19
|
constructor(
|
|
21
20
|
@InjectModel('Organization') mydoc: Model<Organization>,
|
|
22
21
|
private increament: AutoincreamentService,
|
|
23
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
24
22
|
) {
|
|
25
|
-
super(mydoc
|
|
23
|
+
super(mydoc);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -10,17 +10,16 @@ import { Injectable } from '@nestjs/common';
|
|
|
10
10
|
import { PermissionProcessor } from '../generate/processors/perm.processor';
|
|
11
11
|
import { Permission } from '../generate/types/perm.type';
|
|
12
12
|
import { UserContext } from '../generate/commons/user.context';
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
export { Permission } from '../generate/types/perm.type';
|
|
15
15
|
|
|
16
16
|
@Injectable()
|
|
17
17
|
export class PermissionService extends PermissionProcessor {
|
|
18
18
|
protected strictIsolation = false;
|
|
19
19
|
constructor(
|
|
20
|
-
@InjectModel('Permission') mydoc: Model<Permission>,
|
|
21
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
20
|
+
@InjectModel('Permission') mydoc: Model<Permission>,
|
|
22
21
|
) {
|
|
23
|
-
super(mydoc
|
|
22
|
+
super(mydoc);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -12,7 +12,6 @@ import { TenantProcessor } from '../generate/processors/tenant.processor';
|
|
|
12
12
|
import { Tenant } from '../generate/types/tenant.type';
|
|
13
13
|
import { AutoincreamentService } from './autoinc.service';
|
|
14
14
|
import { UserContext } from '../generate/commons/user.context';
|
|
15
|
-
import { DocNumberFormatGenerator } from '../generate/commons/docnogenerator.service';
|
|
16
15
|
export { Tenant } from '../generate/types/tenant.type';
|
|
17
16
|
|
|
18
17
|
@Injectable()
|
|
@@ -20,9 +19,9 @@ export class TenantService extends TenantProcessor {
|
|
|
20
19
|
constructor(
|
|
21
20
|
@InjectModel('Tenant') mydoc: Model<Tenant>,
|
|
22
21
|
private increament: AutoincreamentService,
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
) {
|
|
25
|
-
super(mydoc
|
|
24
|
+
super(mydoc);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -11,7 +11,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
11
11
|
import { UserProcessor } from '../generate/processors/user.processor';
|
|
12
12
|
import { Permission } from '../generate/types/perm.type';
|
|
13
13
|
import { User } from '../generate/types/user.type';
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
export { User } from '../generate/types/user.type';
|
|
16
16
|
|
|
17
17
|
|
|
@@ -21,9 +21,8 @@ export class UserService extends UserProcessor {
|
|
|
21
21
|
constructor(
|
|
22
22
|
@InjectModel('User') mydoc: Model<User>,
|
|
23
23
|
@InjectModel('Permission') private permdoc: Model<Permission>,
|
|
24
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
25
24
|
) {
|
|
26
|
-
super(mydoc
|
|
25
|
+
super(mydoc);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* last change 2023-09-09
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
7
5
|
* Author: Ks Tan
|
|
8
6
|
*/
|
|
9
7
|
import { Module } from '@nestjs/common';
|
|
10
8
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
11
9
|
import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
|
|
12
|
-
|
|
10
|
+
import { AuditTrail } from './generate/commons/audittrail.service';
|
|
13
11
|
// auto import modules
|
|
14
12
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
15
13
|
<% let obj = it.modules[i]%>
|
|
@@ -37,7 +35,7 @@ import { ProfileService } from './profile/profile.service';
|
|
|
37
35
|
]),
|
|
38
36
|
],
|
|
39
37
|
controllers: [<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Controller,<%}%> ProfileController],
|
|
40
|
-
providers: [DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,],
|
|
41
|
-
exports:[DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,]
|
|
38
|
+
providers: [AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,],
|
|
39
|
+
exports:[AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,]
|
|
42
40
|
})
|
|
43
41
|
export class GenerateModule {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { usePassThrough } from "primevue/passthrough";
|
|
2
|
+
import Tailwind from "primevue/passthrough/tailwind";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const CustomTailwind = usePassThrough(
|
|
6
|
+
Tailwind,
|
|
7
|
+
{
|
|
8
|
+
button:{
|
|
9
|
+
root:{
|
|
10
|
+
class:['p-2 m-2 border']
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
dialog:{
|
|
14
|
+
root:{
|
|
15
|
+
class:['bg-white border p-2' ]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
panel: {
|
|
19
|
+
root:{
|
|
20
|
+
class:['border']
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
class: ['leading-none font-light text-2xl']
|
|
24
|
+
},
|
|
25
|
+
header:{
|
|
26
|
+
class:['bg bg-gray-200 h-10 content-middle']
|
|
27
|
+
},
|
|
28
|
+
content:{
|
|
29
|
+
class:['']
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default CustomTailwind;
|