@simitgroup/simpleapp-generator 1.2.2 → 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/dist/framework.d.ts.map +1 -1
- package/dist/framework.js.map +1 -1
- package/package.json +1 -1
- package/src/framework.ts +1 -0
- package/templates/basic/nuxt/pages.form.vue.eta +4 -0
- package/templates/basic/nuxt/pages.landing.vue.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +5 -9
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +69 -26
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +18 -16
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +41 -30
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +34 -29
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +17 -11
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +9 -6
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +22 -77
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue.eta +1 -1
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +3 -3
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +3 -2
- package/templates/nuxt/error.vue._eta +9 -4
- package/templates/nuxt/lang/df.ts.eta +2 -3
- package/templates/nuxt/nuxt.config.ts._eta +1 -2
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +10 -9
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -22
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +7 -20
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +20 -29
- package/templates/nuxt/server/api/profile/[...].ts.eta +18 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/defaults/index.ts.eta +4 -0
- package/templates/nuxt/types/events.ts.eta +2 -0
- package/templates/project/lang/default._json +10 -4
- package/tsconfig.tsbuildinfo +1 -1
package/dist/framework.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,gBAAgB,2BAE5B,CAAA;AAED,eAAO,MAAM,aAAa,aAAY,QAAQ,SAc7C,CAAA;AAED,eAAO,MAAM,aAAa,aAAa,QAAQ,SAU9C,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,gBAAgB,2BAE5B,CAAA;AAED,eAAO,MAAM,aAAa,aAAY,QAAQ,SAc7C,CAAA;AAED,eAAO,MAAM,aAAa,aAAa,QAAQ,SAU9C,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAsC5C,CAAA;AAED,eAAO,MAAM,cAAc,kCAiD1B,CAAA;AAED,eAAO,MAAM,WAAW,aAAa,QAAQ,SAgE5C,CAAA;AAED,eAAO,MAAM,UAAU,YAKtB,CAAA;AACD,eAAO,MAAM,UAAU,YAEtB,CAAA;AAED,eAAO,MAAM,oBAAoB,YAOhC,CAAA"}
|
package/dist/framework.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.js","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA0E;AAC1E,iDAAwC;AACxC,oDAAsB;AACtB,iCAAwC;AACxC,sDAAuC;AACvC,6BAA0B;AAC1B,MAAM,GAAG,GAAoB,IAAI,cAAM,EAAE,CAAC;AAE1C,IAAI,MAAM,GAAG;IACT,kBAAkB,EAAC,eAAe;IAClC,YAAY,EAAC,EAAE;IACf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GAAG,GAAG,EAAE;IACrC,MAAM,UAAU,GAAG,sCAAsC,MAAM,CAAC,aAAa,oBAAoB,MAAM,CAAC,cAAc,4DAA4D,CAAA;IAClL,GAAG,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;IACrC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAEpB,MAAM,MAAM,GAAG,IAAA,qBAAK,EAAC,uBAAuB,EAAC,CAAC,UAAU,EAAC,IAAI,EAAC,GAAG,MAAM,CAAC,aAAa,eAAe,EAAC,IAAI,EAAC,GAAG,MAAM,CAAC,cAAc,6BAA6B,EAAC,IAAI,EAAC,kBAAkB,EAAC,sBAAsB,CAAC,EAAC,EAAG,KAAK,EAAE,SAAS,GAAE,CAAC,CAAA;IACtO,mBAAmB;AACvB,CAAC,CAAA;AAPY,QAAA,oBAAoB,wBAOhC"}
|
package/package.json
CHANGED
package/src/framework.ts
CHANGED
|
@@ -69,6 +69,7 @@ export const prepareNest = (callback:Function)=>{
|
|
|
69
69
|
const targetfolder =config.backendFolder
|
|
70
70
|
log.info(`creating backend project ${targetfolder}`)
|
|
71
71
|
if(!fs.existsSync(`${targetfolder}/.env`)){
|
|
72
|
+
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
exec(`cd ${targetfolder};pnpm install --save @nestjs/event-emitter dayjs bpmn-server@2.0.8-alpha2 moment @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
|
|
@@ -190,10 +190,14 @@ const actionListener = async (actionName: string) => {
|
|
|
190
190
|
case "new":
|
|
191
191
|
result =await newData();
|
|
192
192
|
break;
|
|
193
|
+
case "mount":
|
|
194
|
+
break;
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
emits('after',actionName,data.value,doc,result)
|
|
196
198
|
};
|
|
199
|
+
onMounted(async ()=> await actionListener('mount'))
|
|
200
|
+
|
|
197
201
|
/************ start api methods ****************/
|
|
198
202
|
|
|
199
203
|
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
13
|
/**
|
|
14
14
|
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
15
|
-
* delete file "delete-me
|
|
15
|
+
* delete file "delete-me.txt" if you want to modify this file and
|
|
16
16
|
* prevent regenerate code override it.
|
|
17
17
|
* last change 2023-09-09
|
|
18
18
|
* author: Ks Tan
|
package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta
CHANGED
|
@@ -17,7 +17,7 @@ import { catchError, tap } from 'rxjs/operators';
|
|
|
17
17
|
import { Model, Connection, ClientSession } from 'mongoose';
|
|
18
18
|
import { InjectConnection, InjectModel } from '@nestjs/mongoose';
|
|
19
19
|
import { UserContext } from '../user.context';
|
|
20
|
-
import { ApiEvent } from '../../types
|
|
20
|
+
import { ApiEvent } from '../../types';
|
|
21
21
|
@Injectable()
|
|
22
22
|
export class ResponseInterceptor implements NestInterceptor {
|
|
23
23
|
constructor(
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Logger,
|
|
11
11
|
Scope,
|
|
12
12
|
Inject,
|
|
13
|
+
BadRequestException,
|
|
13
14
|
} from '@nestjs/common';
|
|
14
15
|
import { Request, Response, NextFunction } from 'express';
|
|
15
16
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -27,13 +28,12 @@ import { UserContext } from '../user.context';
|
|
|
27
28
|
@Injectable()
|
|
28
29
|
export class TenantMiddleware implements NestMiddleware {
|
|
29
30
|
protected defaultxorg = Base64URL.encodeText('0-0-0');
|
|
30
|
-
protected excludeXorgs = ['/profile', '/profile/tenant','/profile/session'];
|
|
31
|
+
protected excludeXorgs = ['/profile', '/profile/tenant', '/profile/session'];
|
|
31
32
|
protected logger = new Logger();
|
|
32
33
|
protected transController;
|
|
33
34
|
constructor(
|
|
34
35
|
@InjectModel('User') private readonly usermodel: Model<User>,
|
|
35
36
|
@InjectModel('Permission') private readonly permmodel: Model<Permission>,
|
|
36
|
-
|
|
37
37
|
) {}
|
|
38
38
|
|
|
39
39
|
requireXorg(baseurl: string): boolean {
|
|
@@ -62,7 +62,8 @@ export class TenantMiddleware implements NestMiddleware {
|
|
|
62
62
|
'undefine x-org and require that at ' + req.baseUrl,
|
|
63
63
|
'TenantMiddleware',
|
|
64
64
|
);
|
|
65
|
-
|
|
65
|
+
throw new BadRequestException('undefine header string x-org')
|
|
66
|
+
// return res.status(401).send('undefine header string x-org');
|
|
66
67
|
}
|
|
67
68
|
// const session = await this.connection.startSession();
|
|
68
69
|
const u = new UserContext(this.usermodel, this.permmodel);
|
|
@@ -93,13 +94,8 @@ export class TenantMiddleware implements NestMiddleware {
|
|
|
93
94
|
next();
|
|
94
95
|
}
|
|
95
96
|
} catch (err) {
|
|
96
|
-
this.logger.warn(err, 'invalid xorg or user info');
|
|
97
97
|
this.logger.error(err);
|
|
98
|
-
|
|
99
|
-
return res.status(401).send(err);
|
|
100
|
-
} else {
|
|
101
|
-
return res.status(401).send(err);
|
|
102
|
-
}
|
|
98
|
+
throw new BadRequestException(err,)
|
|
103
99
|
}
|
|
104
100
|
}
|
|
105
101
|
}
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
Inject,
|
|
11
11
|
Logger,
|
|
12
12
|
BadRequestException,
|
|
13
|
+
ForbiddenException,
|
|
13
14
|
} from '@nestjs/common';
|
|
14
15
|
import { Model, model, connect, PipelineStage } from 'mongoose';
|
|
15
16
|
import { ModifiedCollection, ModifiedRecords } from '../types';
|
|
16
|
-
import _ from 'lodash';
|
|
17
|
+
import _, { isNumber } from 'lodash';
|
|
17
18
|
import { Module } from '@nestjs/common';
|
|
18
19
|
import * as jwt from 'jsonwebtoken';
|
|
19
20
|
import { Role } from './roles/roles.enum';
|
|
@@ -54,11 +55,12 @@ export class UserContext {
|
|
|
54
55
|
protected branchName: string = '';
|
|
55
56
|
protected orgCode: string = '';
|
|
56
57
|
protected orgName: string = '';
|
|
58
|
+
protected timeZone:string=''
|
|
57
59
|
protected branches: any[] = [];
|
|
58
60
|
protected lastActivity: string = new Date().toISOString();
|
|
59
61
|
protected invites: any[] = []; //User + field tenant:Tenant[]
|
|
60
62
|
protected roles: string[] = [];
|
|
61
|
-
protected moreProps: any[] =[]
|
|
63
|
+
protected moreProps: any[] = [];
|
|
62
64
|
private dbsession: ClientSession;
|
|
63
65
|
protected modifiedRecords: ModifiedRecords = {
|
|
64
66
|
createds: {},
|
|
@@ -84,6 +86,7 @@ export class UserContext {
|
|
|
84
86
|
getOrgId = () => this.orgId;
|
|
85
87
|
getBranchId = () => this.branchId;
|
|
86
88
|
getEmail = () => this.email;
|
|
89
|
+
getTimeZone = () => this.timeZone;
|
|
87
90
|
getGroup = () => this.group;
|
|
88
91
|
getMoreProps = () => this.moreProps;
|
|
89
92
|
getRoles = () => this.roles;
|
|
@@ -205,6 +208,7 @@ export class UserContext {
|
|
|
205
208
|
userinfo.orgRecordId = myperm.currentorg[0]._id;
|
|
206
209
|
userinfo.orgCode = myperm.currentorg[0].orgCode;
|
|
207
210
|
userinfo.orgName = myperm.currentorg[0].orgName;
|
|
211
|
+
userinfo.timeZone = myperm.currentorg[0].timeZone;
|
|
208
212
|
}
|
|
209
213
|
} else {
|
|
210
214
|
userinfo.group = '';
|
|
@@ -254,11 +258,12 @@ export class UserContext {
|
|
|
254
258
|
this.branchName = userinfo['branchName'] ?? '';
|
|
255
259
|
this.orgCode = userinfo['orgCode'] ?? '';
|
|
256
260
|
this.orgName = userinfo['orgName'] ?? '';
|
|
261
|
+
this.timeZone = userinfo['timeZone']?? '';
|
|
257
262
|
this.orgRecordId = userinfo['orgRecordId'] ?? '';
|
|
258
263
|
this.branchRecordId = userinfo['branchRecordId'] ?? '';
|
|
259
264
|
this.group = userinfo['group'] ?? '';
|
|
260
265
|
this.roles = userinfo['roles'] ?? [Role.Everyone, Role.User];
|
|
261
|
-
this.moreProps = this.setMoreProps(userinfo)
|
|
266
|
+
this.moreProps = this.setMoreProps(userinfo);
|
|
262
267
|
} else {
|
|
263
268
|
this.logger.debug(`Set unknown id of current user`, 'setUserToken');
|
|
264
269
|
// this.group = ''
|
|
@@ -339,18 +344,23 @@ export class UserContext {
|
|
|
339
344
|
setXorg = (xorg) => {
|
|
340
345
|
try {
|
|
341
346
|
const decodedText: string = Base64URL.decodeText(xorg);
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
347
|
+
const x = decodedText.includes('/')
|
|
348
|
+
? decodedText.split('/')
|
|
349
|
+
: decodedText.split('-');
|
|
350
|
+
|
|
351
|
+
const x1 = Number(x[0]);
|
|
352
|
+
const x2 = Number(x[1]);
|
|
353
|
+
const x3 = Number(x[2]);
|
|
354
|
+
if (x.length == 3 && !isNaN(x1) && !isNaN(x2) && !isNaN(x3)) {
|
|
345
355
|
const u = this;
|
|
346
|
-
u.tenantId =
|
|
347
|
-
u.orgId =
|
|
348
|
-
u.branchId =
|
|
356
|
+
u.tenantId = x1;
|
|
357
|
+
u.orgId = x2;
|
|
358
|
+
u.branchId = x3;
|
|
349
359
|
} else {
|
|
350
|
-
throw
|
|
360
|
+
throw new BadRequestException('invalidXorg');
|
|
351
361
|
}
|
|
352
362
|
} catch (err) {
|
|
353
|
-
throw err;
|
|
363
|
+
throw new BadRequestException(err);
|
|
354
364
|
}
|
|
355
365
|
};
|
|
356
366
|
|
|
@@ -368,6 +378,7 @@ export class UserContext {
|
|
|
368
378
|
branchName: this.branchName,
|
|
369
379
|
orgCode: this.orgCode,
|
|
370
380
|
orgName: this.orgName,
|
|
381
|
+
timeZone: this.getTimeZone(),
|
|
371
382
|
email: this.getEmail(),
|
|
372
383
|
uid: this.getUid(),
|
|
373
384
|
fullName: this.getFullname(),
|
|
@@ -375,7 +386,7 @@ export class UserContext {
|
|
|
375
386
|
roles: this.getRoles(),
|
|
376
387
|
branches: this.getBranches(),
|
|
377
388
|
invites: await this.getInvites(),
|
|
378
|
-
|
|
389
|
+
moreProps: this.getMoreProps(),
|
|
379
390
|
};
|
|
380
391
|
this.logger.debug(userinfo, 'init getUserInfo()');
|
|
381
392
|
|
|
@@ -438,10 +449,8 @@ export class UserContext {
|
|
|
438
449
|
userinfo.branches = this.getBranches();
|
|
439
450
|
userinfo.invites = this.getInvites();
|
|
440
451
|
// this.logger.debug(`getUserInfo result ${userinfo}`)
|
|
441
|
-
} else {
|
|
442
|
-
|
|
443
|
-
`${this.getUid()} does not exists in current tenant (${this.tenantId})`,
|
|
444
|
-
);
|
|
452
|
+
} else if (this.getTenantId() > 0) {
|
|
453
|
+
throw new ForbiddenException(`userNotExistInTenant`, 'access deny');
|
|
445
454
|
}
|
|
446
455
|
|
|
447
456
|
return userinfo;
|
|
@@ -501,6 +510,18 @@ export class UserContext {
|
|
|
501
510
|
(item) => item === _id,
|
|
502
511
|
);
|
|
503
512
|
}
|
|
513
|
+
searchDeletedRecordId(collection: string, _id: string) {
|
|
514
|
+
console.log('check is deleted: ', collection, _id);
|
|
515
|
+
const deletedlist = this.modifiedRecords.deleteds[collection];
|
|
516
|
+
|
|
517
|
+
if (deletedlist) {
|
|
518
|
+
return this.modifiedRecords.deleteds[collection].find(
|
|
519
|
+
(item) => item === _id,
|
|
520
|
+
);
|
|
521
|
+
} else {
|
|
522
|
+
return undefined;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
504
525
|
addInsertedRecordId(collection: string, _id: string) {
|
|
505
526
|
if (this.modifiedRecords.createds[collection]) {
|
|
506
527
|
this.modifiedRecords.createds[collection].push(_id);
|
|
@@ -635,17 +656,39 @@ export class UserContext {
|
|
|
635
656
|
/**
|
|
636
657
|
* define additional properties from user into moreProps
|
|
637
658
|
*/
|
|
638
|
-
setMoreProps(userinfo:any){
|
|
639
|
-
const allprops = Object.keys(userinfo)
|
|
640
|
-
const excludekeys=[
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
659
|
+
setMoreProps(userinfo: any) {
|
|
660
|
+
const allprops = Object.keys(userinfo);
|
|
661
|
+
const excludekeys = [
|
|
662
|
+
'created',
|
|
663
|
+
'createdBy',
|
|
664
|
+
'updated',
|
|
665
|
+
'updatedBy',
|
|
666
|
+
'_id',
|
|
667
|
+
'email',
|
|
668
|
+
'fullName',
|
|
669
|
+
'permissions',
|
|
670
|
+
'roles',
|
|
671
|
+
'branchCode',
|
|
672
|
+
'branchId',
|
|
673
|
+
'branchName',
|
|
674
|
+
'orgCode',
|
|
675
|
+
'orgId',
|
|
676
|
+
'orgName',
|
|
677
|
+
'timeZone',
|
|
678
|
+
'tenantId',
|
|
679
|
+
'lastActivity',
|
|
680
|
+
'group',
|
|
681
|
+
'__v',
|
|
682
|
+
'uid',
|
|
683
|
+
'orgRecordId',
|
|
684
|
+
];
|
|
685
|
+
let data: any = {};
|
|
686
|
+
for (let i = 0; i < allprops.length; i++) {
|
|
687
|
+
const key = allprops[i];
|
|
688
|
+
if (!excludekeys.includes(key)) {
|
|
689
|
+
data[key] = userinfo[key];
|
|
646
690
|
}
|
|
647
|
-
|
|
648
691
|
}
|
|
649
|
-
return data
|
|
692
|
+
return data;
|
|
650
693
|
}
|
|
651
694
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change
|
|
4
|
+
* last change 2024-01-27
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { Injectable, Logger, Inject } from '@nestjs/common';
|
|
8
8
|
import { InjectModel } from '@nestjs/mongoose';
|
|
9
9
|
import jsonpath from 'jsonpath';
|
|
10
|
-
import
|
|
10
|
+
import _ from 'lodash';
|
|
11
|
+
|
|
11
12
|
import { AuditTrail } from '../commons/audittrail.service';
|
|
12
13
|
import { foreignkeys } from '../commons/dicts/foreignkeys';
|
|
13
14
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
} from '@nestjs/common/exceptions';
|
|
32
33
|
import { UserContext } from '../commons/user.context';
|
|
33
34
|
import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
|
|
34
|
-
import { IsolationType, DefaultHooks, MoreProjectionType } from '../types';
|
|
35
|
+
import { IsolationType, DefaultHooks, MoreProjectionType,DeleteResultType } from '../types';
|
|
35
36
|
@Injectable()
|
|
36
37
|
export class SimpleAppService<T extends { _id?: string }> {
|
|
37
38
|
@Inject(EventEmitter2)
|
|
@@ -77,7 +78,8 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
77
78
|
// this.tenantdoc = tenantdoc
|
|
78
79
|
}
|
|
79
80
|
getDocumentType = () => this.documentType;
|
|
80
|
-
getDocumentName = () =>
|
|
81
|
+
getDocumentName = (capFirst: boolean = false) =>
|
|
82
|
+
capFirst ? _.upperFirst(this.documentName) : this.documentName;
|
|
81
83
|
getRecordId = (): string => this.data._id;
|
|
82
84
|
setSchema = (newschema) => (this.jsonschema = newschema);
|
|
83
85
|
getSchema = () => this.doc.schema.obj;
|
|
@@ -297,7 +299,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
297
299
|
this.logger.debug(data, 'SimpleAppService');
|
|
298
300
|
Object.assign(data, isolationFilter);
|
|
299
301
|
this.reCalculateValue(data);
|
|
300
|
-
await this.validateData(appuser, data);
|
|
302
|
+
await this.validateData(appuser, data);
|
|
301
303
|
this.logger.debug(data, `after create validation`);
|
|
302
304
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
303
305
|
this.logger.debug(data, `Create Record ${this.documentName}`);
|
|
@@ -378,7 +380,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
378
380
|
for (let i = 0; i < this.errorlist.length; i++) {
|
|
379
381
|
errormsg.push(this.errorlist[i].message);
|
|
380
382
|
}
|
|
381
|
-
|
|
383
|
+
|
|
382
384
|
throw new BadRequestException(
|
|
383
385
|
'Before validation hook failed',
|
|
384
386
|
errormsg as HttpExceptionOptions,
|
|
@@ -445,7 +447,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
445
447
|
try {
|
|
446
448
|
if (this.hooks.beforeDelete) await this.hooks.beforeDelete(appuser, id);
|
|
447
449
|
this.logger.debug('delete record', this.documentName, id);
|
|
448
|
-
dependency = await this.getRelatedRecords(id);
|
|
450
|
+
dependency = await this.getRelatedRecords(appuser,id);
|
|
449
451
|
//console.log('dependency', dependency);
|
|
450
452
|
if (!dependency) {
|
|
451
453
|
let filterIsolation = this.getIsolationFilter(appuser);
|
|
@@ -457,8 +459,8 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
457
459
|
.deleteOne(filterIsolation)
|
|
458
460
|
.session(dbsession);
|
|
459
461
|
|
|
460
|
-
appuser.
|
|
461
|
-
const deleteresult = { result: result, data: deletedata };
|
|
462
|
+
appuser.addDeletedRecordId(this.documentName, id);
|
|
463
|
+
const deleteresult:DeleteResultType<T> = { result: result, data: deletedata };
|
|
462
464
|
this.logger.debug(
|
|
463
465
|
deleteresult,
|
|
464
466
|
' delete result' + this.doc.collection.name,
|
|
@@ -470,9 +472,9 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
470
472
|
//this.doc.findByIdAndDelete(id);
|
|
471
473
|
return deleteresult;
|
|
472
474
|
} else {
|
|
473
|
-
|
|
475
|
+
console.log("reject query",dependency)
|
|
474
476
|
|
|
475
|
-
throw new ForbiddenException('Foreignkey constraint'
|
|
477
|
+
throw new ForbiddenException(dependency,'Foreignkey constraint');
|
|
476
478
|
}
|
|
477
479
|
} catch (err) {
|
|
478
480
|
throw new InternalServerErrorException(err);
|
|
@@ -533,9 +535,9 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
533
535
|
};
|
|
534
536
|
|
|
535
537
|
//find what foreign key constraint
|
|
536
|
-
async getRelatedRecords(id: string) {
|
|
538
|
+
async getRelatedRecords(appuser:UserContext,id: string) {
|
|
537
539
|
this.logger.debug('get foreignkey for delete:', id);
|
|
538
|
-
|
|
540
|
+
console.log("session modifeds",appuser.getModifieds())
|
|
539
541
|
if (foreignkeys === undefined) {
|
|
540
542
|
this.logger.error('foreignkeys object undetected');
|
|
541
543
|
throw new InternalServerErrorException('foreignkeys object undetected');
|
|
@@ -557,10 +559,10 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
557
559
|
//single schema may have multiple foreign key link here, loop all
|
|
558
560
|
for (let j = 0; j < fobjs.length; j++) {
|
|
559
561
|
const fkey = fobjs[j];
|
|
562
|
+
//not deleted in current session, check from database
|
|
560
563
|
let filter = {};
|
|
561
564
|
filter[fkey] = id;
|
|
562
|
-
|
|
563
|
-
const result = await collection.findOne(filter);
|
|
565
|
+
const result = await collection.findOne(filter,{session:appuser.getDBSession()});
|
|
564
566
|
if (result) {
|
|
565
567
|
this.logger.error(result, 'related result found');
|
|
566
568
|
return result;
|
|
@@ -678,7 +680,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
678
680
|
|
|
679
681
|
if (results.length > 0) {
|
|
680
682
|
if (results.length > 1) {
|
|
681
|
-
results = uniq<string>(results);
|
|
683
|
+
results = _.uniq<string>(results);
|
|
682
684
|
}
|
|
683
685
|
|
|
684
686
|
keystore[collectionname] = results;
|
|
@@ -31,7 +31,6 @@ export type SearchBody = {
|
|
|
31
31
|
sorts?: any[];
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
export enum IsolationType {
|
|
36
35
|
'none' = 'none',
|
|
37
36
|
'org' = 'org',
|
|
@@ -39,38 +38,50 @@ export enum IsolationType {
|
|
|
39
38
|
'branch' = 'branch',
|
|
40
39
|
}
|
|
41
40
|
export type DefaultHooks<T> = {
|
|
42
|
-
init?: () => Promise<void
|
|
43
|
-
beforeSearch?: (appuser:UserContext,filter:any) => Promise<void
|
|
44
|
-
afterSearch?: (appuser:UserContext,data:T[]) => Promise<void
|
|
45
|
-
beforeValidation?: (appuser:UserContext,data:T) => Promise<boolean
|
|
46
|
-
afterValidation?: (appuser:UserContext,data:T) => Promise<void
|
|
47
|
-
beforeCreate?: (appuser:UserContext,data:T) => Promise<void
|
|
48
|
-
afterCreate?: (appuser:UserContext,data:T) => Promise<void
|
|
49
|
-
beforeUpdate?: (appuser:UserContext,id:string,data:T) => Promise<void
|
|
50
|
-
afterUpdate?: (appuser:UserContext,id:string,data:T) => Promise<void
|
|
51
|
-
beforeDelete?: (appuser:UserContext,id:string) => Promise<void
|
|
52
|
-
afterDelete?: (appuser:UserContext,
|
|
53
|
-
beforeFetchRecord?: (appuser:UserContext,id:string) => Promise<void
|
|
54
|
-
afterFetchRecord?: (appuser:UserContext,data:T) => Promise<void
|
|
55
|
-
beforeSetStatus?: (
|
|
56
|
-
|
|
41
|
+
init?: () => Promise<void>;
|
|
42
|
+
beforeSearch?: (appuser: UserContext, filter: any) => Promise<void>;
|
|
43
|
+
afterSearch?: (appuser: UserContext, data: T[]) => Promise<void>;
|
|
44
|
+
beforeValidation?: (appuser: UserContext, data: T) => Promise<boolean>;
|
|
45
|
+
afterValidation?: (appuser: UserContext, data: T) => Promise<void>;
|
|
46
|
+
beforeCreate?: (appuser: UserContext, data: T) => Promise<void>;
|
|
47
|
+
afterCreate?: (appuser: UserContext, data: T) => Promise<void>;
|
|
48
|
+
beforeUpdate?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
49
|
+
afterUpdate?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
50
|
+
beforeDelete?: (appuser: UserContext, id: string) => Promise<void>;
|
|
51
|
+
afterDelete?: (appuser: UserContext, result: DeleteResultType<T>, id: string) => Promise<void>;
|
|
52
|
+
beforeFetchRecord?: (appuser: UserContext, id: string) => Promise<void>;
|
|
53
|
+
afterFetchRecord?: (appuser: UserContext, data: T) => Promise<void>;
|
|
54
|
+
beforeSetStatus?: (
|
|
55
|
+
appuser: UserContext,
|
|
56
|
+
id: string,
|
|
57
|
+
data: T,
|
|
58
|
+
) => Promise<void>;
|
|
59
|
+
afterSetStatus?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
57
60
|
};
|
|
58
61
|
export type MoreProjectionType = {
|
|
59
62
|
[key: string]: string;
|
|
60
63
|
};
|
|
61
64
|
export type ApiEvent = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
_id: string;
|
|
66
|
+
created: string;
|
|
67
|
+
updated?: string;
|
|
68
|
+
duration: number;
|
|
69
|
+
createdBy: string;
|
|
70
|
+
path: string;
|
|
71
|
+
ip: string;
|
|
72
|
+
method: string;
|
|
73
|
+
headers: any;
|
|
74
|
+
data?: any;
|
|
75
|
+
statusCode: number;
|
|
76
|
+
status: string;
|
|
77
|
+
errMsg?: string;
|
|
78
|
+
errData?: any;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type DeleteResultType <T> = {
|
|
82
|
+
data:T
|
|
83
|
+
result: {
|
|
84
|
+
acknowledged: boolean
|
|
85
|
+
deletedCount:number
|
|
86
|
+
}
|
|
76
87
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Dialog v-model:visible="visible"
|
|
3
|
-
@update:visible="closeDialog"
|
|
2
|
+
<Dialog v-model:visible="visible"
|
|
4
3
|
:pt="{root:{class:'w-5/6 h-5/6'}}"
|
|
5
4
|
:modal="true"
|
|
6
5
|
:close-on-escape="false" >
|
|
6
|
+
|
|
7
|
+
|
|
7
8
|
<template #header>
|
|
8
|
-
<div class="flex flex-row">
|
|
9
|
-
<Chip v-for="(v,
|
|
9
|
+
<div class="flex flex-row gap-4">
|
|
10
|
+
<Chip v-for="(v,k) in allview" :label="v.label" @remove="deleteTab" :removable="true"
|
|
11
|
+
/>
|
|
10
12
|
</div>
|
|
11
13
|
</template>
|
|
12
|
-
<template #default>
|
|
13
|
-
<div v-for="(v,
|
|
14
|
-
|
|
14
|
+
<template #default>
|
|
15
|
+
<div v-for="(v,k) in allview" v-memo="[k]" class="viewer-item flex flex-col">
|
|
16
|
+
<component
|
|
17
|
+
:is="defineAsyncComponent(v.viewer)"
|
|
18
|
+
:_id="v._id"
|
|
19
|
+
:readonly="v.readonly"
|
|
20
|
+
@after-create="callback(v,$event)"
|
|
21
|
+
/>
|
|
15
22
|
</div>
|
|
16
23
|
</template>
|
|
17
24
|
</Dialog>
|
|
@@ -20,27 +27,20 @@
|
|
|
20
27
|
/**
|
|
21
28
|
* This file was automatically generated by simpleapp generator during initialization.
|
|
22
29
|
* IT WONT OVERRIDE AND YOU CAN MODIFY IT.
|
|
23
|
-
* last change
|
|
30
|
+
* last change 2024-01-27
|
|
24
31
|
* author: Ks Tan
|
|
25
32
|
*/
|
|
26
33
|
import { onKeyStroke } from '@vueuse/core'
|
|
27
|
-
|
|
28
34
|
import { useDialog } from 'primevue/usedialog';
|
|
29
35
|
import {defineAsyncComponent} from 'vue'
|
|
30
36
|
import { ViewRecord } from '~/types';
|
|
31
37
|
// import TabView from 'primevue/tabview';
|
|
32
38
|
import Chip from 'primevue/chip';
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
const activetabindex=ref(0)
|
|
36
|
-
const findindex = ref(0)
|
|
37
|
-
const dialog = useDialog()
|
|
40
|
+
|
|
38
41
|
const {$listen,} = useNuxtApp()
|
|
39
42
|
const visible = ref(false)
|
|
40
|
-
const
|
|
41
|
-
const ViewRecordComponent = ref()
|
|
42
|
-
const readonly = ref<boolean>()
|
|
43
|
-
const allview = ref<ViewRecord[]>([])
|
|
43
|
+
const allview = ref<{[key:string]:ViewRecord}>({})
|
|
44
44
|
|
|
45
45
|
const callback = (v:ViewRecord,data:any)=>{
|
|
46
46
|
if(v.afterCreate){
|
|
@@ -55,24 +55,29 @@ onKeyStroke('Escape', (e) => {
|
|
|
55
55
|
|
|
56
56
|
const deleteTab=()=>{
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const keys = Object.keys(allview.value)
|
|
59
|
+
const lastkey = keys[keys.length-1]
|
|
60
|
+
delete allview.value[lastkey]
|
|
61
|
+
// updateprops.value++
|
|
62
|
+
if(Object.keys(allview.value).length==0){
|
|
62
63
|
visible.value=false
|
|
63
64
|
return
|
|
64
|
-
}else{
|
|
65
|
-
activetabindex.value = activetabindex.value >0 ? activetabindex.value - 1 : 0
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
allview.value=[]
|
|
70
|
-
}
|
|
67
|
+
|
|
71
68
|
$listen('ViewRecord',(setting)=>{
|
|
72
69
|
visible.value=true
|
|
73
|
-
allview.value.
|
|
74
|
-
activetabindex.value = allview.value.length-1
|
|
70
|
+
allview.value[setting.eventId]=setting
|
|
75
71
|
|
|
76
72
|
})
|
|
77
73
|
|
|
78
|
-
</script>
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<style scoped>
|
|
77
|
+
.viewer-item{
|
|
78
|
+
display: none;
|
|
79
|
+
}
|
|
80
|
+
.viewer-item:last-child{
|
|
81
|
+
display: flex;
|
|
82
|
+
}
|
|
83
|
+
</style>
|