@simitgroup/simpleapp-generator 2.0.0-c-alpha → 2.0.0-e-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 +3 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +3 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/processors/jsonschemabuilder.ts +4 -2
- package/templates/basic/nest/jsonschema.ts.eta +3 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/profile/profile.controller.ts.eta +29 -16
- package/templates/nest/src/simple-app/.core/features/profile/profile.module.ts.eta +7 -6
- package/templates/nest/src/simple-app/.core/features/profile/profile.schema.ts.eta +13 -5
- package/templates/nest/src/simple-app/.core/features/profile/profile.service.ts.eta +9 -1
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/user-context/user.context.ts.eta +107 -22
- package/templates/nest/src/simple-app/.core/framework/json-schemas.dict.ts.eta +11 -0
- package/templates/nuxt/components/image/ImageAvatar.vue._eta +40 -32
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta +1 -2
- package/templates/nuxt/pages/profile.vue._eta +2 -7
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +4 -1
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/others.ts.eta +8 -0
package/ReleaseNote.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonschemabuilder.d.ts","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAKZ,MAAM,aAAa,CAAC;AAUrB,OAAO,EAGL,WAAW,EAIZ,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,qBAAqB,YACvB,MAAM,eACF,WAAW,
|
|
1
|
+
{"version":3,"file":"jsonschemabuilder.d.ts","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAKZ,MAAM,aAAa,CAAC;AAUrB,OAAO,EAGL,WAAW,EAIZ,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,qBAAqB,YACvB,MAAM,eACF,WAAW,yBAwHzB,CAAC"}
|
|
@@ -84,6 +84,9 @@ const readJsonSchemaBuilder = async (docname, orijsondata) => {
|
|
|
84
84
|
}
|
|
85
85
|
//enforce format uuid for _id
|
|
86
86
|
orijsondata.properties['_id']['format'] = 'uuid';
|
|
87
|
+
if (schemaconfigs.uploadPhoto) {
|
|
88
|
+
orijsondata.properties['imageUrl'] = { type: 'string' };
|
|
89
|
+
}
|
|
87
90
|
// let newschema:JSONSchema7 & SchemaType = {
|
|
88
91
|
// type: 'object',
|
|
89
92
|
// "x-simpleapp-config":schemaconfigs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonschemabuilder.js","sourceRoot":"","sources":["../../src/processors/jsonschemabuilder.ts"],"names":[],"mappings":";;;;;;AASA,oDAAuB;AAGvB,mDAAmD;AACnD,iCAAwC;AACxC,iGAA6D;AAC7D,wCAAuD;AACvD,sDAAsD;AACtD,kCAOiB;AACjB,MAAM,GAAG,GAAoB,IAAI,cAAM,EAAE,CAAC;AAC1C,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AACpC,MAAM,qBAAqB,GAAG,KAAK,EACxC,OAAe,EACf,WAAwB,EACxB,EAAE;;IACF,mEAAmE;IACnE,4CAA4C;IAC5C,YAAY;IACZ,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,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C;IACtC,IAAI,GAAG,CAAC,QAAQ;QAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC3C,IAAI,GAAG,CAAC,OAAO,EAAE;QACf,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;KACzB;SAAM;QACL,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ;YAAE,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;aAClC,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,SAAS;YAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;aAC7D,IAAI,CAAC,CAAC,IAAI,IAAI,SAAS;YAAE,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;aAC3C,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO;YAAE,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;;YACtC,CAAC,CAAC,OAAO,GAAG,EAAE,CAAC;KACrB;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -40,7 +40,6 @@ export const readJsonSchemaBuilder = async (
|
|
|
40
40
|
|
|
41
41
|
let schemaconfigs: SchemaConfig = orijsondata[configname];
|
|
42
42
|
const doctype = schemaconfigs.documentType;
|
|
43
|
-
|
|
44
43
|
if (!schemaconfigs.collectionName) {
|
|
45
44
|
schemaconfigs.documentName;
|
|
46
45
|
}
|
|
@@ -114,7 +113,10 @@ export const readJsonSchemaBuilder = async (
|
|
|
114
113
|
|
|
115
114
|
//enforce format uuid for _id
|
|
116
115
|
orijsondata.properties['_id']['format'] = 'uuid';
|
|
117
|
-
|
|
116
|
+
if(schemaconfigs.uploadPhoto){
|
|
117
|
+
orijsondata.properties['imageUrl']={type:'string'}
|
|
118
|
+
}
|
|
119
|
+
|
|
118
120
|
// let newschema:JSONSchema7 & SchemaType = {
|
|
119
121
|
// type: 'object',
|
|
120
122
|
// "x-simpleapp-config":schemaconfigs,
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
* last change 2024-02-23
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
|
-
export const <%= it.typename%>JsonSchema = <%~ JSON.stringify(it.jsonschema) %>
|
|
7
|
+
export const <%= it.typename%>JsonSchema = <%~ JSON.stringify(it.jsonschema) %>
|
|
8
|
+
|
|
9
|
+
export const <%= it.name%>JsonSchema = <%= it.typename%>JsonSchema
|
|
@@ -29,7 +29,7 @@ export class MiniAppManagerPolicyService {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
hasRequiredPlan(appUser: UserContext, miniApp: MiniApp) {
|
|
32
|
-
const currentPlan = appUser.
|
|
32
|
+
const currentPlan = appUser.tenantInfo.package;
|
|
33
33
|
const requiredPlans = miniApp.access.requiredPlans ?? [];
|
|
34
34
|
|
|
35
35
|
if (_.isEmpty(requiredPlans)) return true;
|
|
@@ -28,7 +28,7 @@ export class PolicyService {
|
|
|
28
28
|
* - plans/enterprise.ts
|
|
29
29
|
*/
|
|
30
30
|
hasFeature(appUser: UserContext, feature: keyof typeof this._FEATURES): boolean {
|
|
31
|
-
const appPackage = appUser.
|
|
31
|
+
const appPackage = appUser.tenantInfo.package
|
|
32
32
|
const allowedPlans = this._FEATURES[feature];
|
|
33
33
|
|
|
34
34
|
return allowedPlans.includes(appPackage);
|
|
@@ -9,8 +9,8 @@ import { Role } from '../auth/role-guard/roles.enum';
|
|
|
9
9
|
import { ApiTags, ApiBody, ApiResponse, ApiOperation } from '@nestjs/swagger';
|
|
10
10
|
import { UserContext } from '../user-context/user.context';
|
|
11
11
|
import { ProfileService } from './profile.service';
|
|
12
|
-
import { AppUser } from '../user-context/
|
|
13
|
-
import { UserContextInfo, TenantPermission, RegTenant } from './profile.schema';
|
|
12
|
+
import { AppUser } from '../user-context/appUser.decorator';
|
|
13
|
+
import { UserContextInfo, TenantPermission, RegTenant, KeyValue } from './profile.schema';
|
|
14
14
|
@ApiTags('PROFILE')
|
|
15
15
|
@Controller('/profile')
|
|
16
16
|
export class ProfileController {
|
|
@@ -31,9 +31,9 @@ export class ProfileController {
|
|
|
31
31
|
description: 'Success',
|
|
32
32
|
})
|
|
33
33
|
@ApiResponse({ status: 401, type: Object, description: 'Undefine profile' })
|
|
34
|
-
async getProfile(@AppUser()
|
|
35
|
-
this.logger.debug(`access getProfile API by ${
|
|
36
|
-
const result = await this.profileservice.getProfile(
|
|
34
|
+
async getProfile(@AppUser() appUser: UserContext) {
|
|
35
|
+
this.logger.debug(`access getProfile API by ${appUser.getUid()},(${appUser.getId()})`);
|
|
36
|
+
const result = await this.profileservice.getProfile(appUser);
|
|
37
37
|
this.logger.debug('getProfile result is:');
|
|
38
38
|
this.logger.debug(result);
|
|
39
39
|
if (result) {
|
|
@@ -55,8 +55,8 @@ export class ProfileController {
|
|
|
55
55
|
description: 'Success',
|
|
56
56
|
})
|
|
57
57
|
@ApiResponse({ status: 401, type: Object, description: 'Expired' })
|
|
58
|
-
async getSession(@AppUser()
|
|
59
|
-
const result = await this.profileservice.getSession(
|
|
58
|
+
async getSession(@AppUser() appUser: UserContext) {
|
|
59
|
+
const result = await this.profileservice.getSession(appUser);
|
|
60
60
|
if (result) {
|
|
61
61
|
return result;
|
|
62
62
|
} else {
|
|
@@ -76,9 +76,9 @@ export class ProfileController {
|
|
|
76
76
|
description: 'Success',
|
|
77
77
|
})
|
|
78
78
|
@ApiResponse({ status: 401, type: Object, description: 'Undefine profile' })
|
|
79
|
-
async getAllTenants(@AppUser()
|
|
80
|
-
this.logger.debug(`access getAllTenants API by ${
|
|
81
|
-
const result = await this.profileservice.getAllTenants(
|
|
79
|
+
async getAllTenants(@AppUser() appUser: UserContext) {
|
|
80
|
+
this.logger.debug(`access getAllTenants API by ${appUser.getUid()},(${appUser.getId()})`);
|
|
81
|
+
const result = await this.profileservice.getAllTenants(appUser);
|
|
82
82
|
this.logger.debug('getProfile result is:');
|
|
83
83
|
this.logger.debug(result);
|
|
84
84
|
if (result) {
|
|
@@ -88,6 +88,19 @@ export class ProfileController {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
@Post('photo')
|
|
92
|
+
@Roles(Role.Everyone)
|
|
93
|
+
@ApiBody({ description: 'base64 photo', type: KeyValue })
|
|
94
|
+
@ApiOperation({
|
|
95
|
+
operationId: 'uploadPhoto',
|
|
96
|
+
description: 'Upload avatar image with base64',
|
|
97
|
+
})
|
|
98
|
+
@ApiResponse({ status: 201, type: String, description: 'Success' })
|
|
99
|
+
async uploadImage(@AppUser() appUser: UserContext, @Body() data: KeyValue) {
|
|
100
|
+
const result = await this.profileservice.uploadPhoto(appUser, data);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
@Post('/tenant')
|
|
92
105
|
@Roles(Role.Everyone)
|
|
93
106
|
@ApiBody({ description: 'create tenant name', type: RegTenant })
|
|
@@ -97,13 +110,13 @@ export class ProfileController {
|
|
|
97
110
|
})
|
|
98
111
|
@ApiResponse({ status: 201, type: Object, description: 'Success' })
|
|
99
112
|
async createTenant(
|
|
100
|
-
@AppUser()
|
|
113
|
+
@AppUser() appUser: UserContext,
|
|
101
114
|
@Body('tenantName') tenantName: string,
|
|
102
115
|
@Body('timeZone') timeZone: string,
|
|
103
116
|
@Body('utcOffset') utcOffset: number,
|
|
104
117
|
@Body('businessType') businessType: string,
|
|
105
118
|
) {
|
|
106
|
-
const result = await this.profileservice.createTenant(
|
|
119
|
+
const result = await this.profileservice.createTenant(appUser, tenantName, timeZone, utcOffset, businessType);
|
|
107
120
|
if (result) {
|
|
108
121
|
return result;
|
|
109
122
|
} else {
|
|
@@ -118,8 +131,8 @@ export class ProfileController {
|
|
|
118
131
|
description: 'accept or reject invitation to tenant',
|
|
119
132
|
})
|
|
120
133
|
@ApiResponse({ status: 201, type: Object, description: 'Success' })
|
|
121
|
-
async decideInvitation(@AppUser()
|
|
122
|
-
const result = await this.profileservice.decideInvitation(
|
|
134
|
+
async decideInvitation(@AppUser() appUser: UserContext, @Param('id') id: string, @Param('decision') decision: string) {
|
|
135
|
+
const result = await this.profileservice.decideInvitation(appUser, id, decision);
|
|
123
136
|
if (result) {
|
|
124
137
|
return result;
|
|
125
138
|
} else {
|
|
@@ -133,8 +146,8 @@ export class ProfileController {
|
|
|
133
146
|
description: 'complete specific tour guide',
|
|
134
147
|
})
|
|
135
148
|
@ApiResponse({ status: 201, type: Object, description: 'Success' })
|
|
136
|
-
async runTourComplete(@AppUser()
|
|
137
|
-
const result = await this.profileservice.runTourComplete(
|
|
149
|
+
async runTourComplete(@AppUser() appUser: UserContext, @Param('guidename') guidename: string) {
|
|
150
|
+
const result = await this.profileservice.runTourComplete(appUser, guidename);
|
|
138
151
|
if (result) {
|
|
139
152
|
return result;
|
|
140
153
|
} else {
|
|
@@ -8,13 +8,14 @@ import { Module } from '@nestjs/common';
|
|
|
8
8
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
9
9
|
import { ProfileService } from './profile.service';
|
|
10
10
|
import { ProfileController } from './profile.controller';
|
|
11
|
-
import {UserModule} from '../../resources/user/user.module'
|
|
12
|
-
import {PermissionModule} from '../../resources/permission/permission.module'
|
|
13
|
-
import {TenantModule} from '../../resources/tenant/tenant.module'
|
|
14
|
-
import {BranchModule} from '../../resources/branch/branch.module'
|
|
15
|
-
import {OrganizationModule} from '../../resources/organization/organization.module'
|
|
11
|
+
import { UserModule } from '../../resources/user/user.module';
|
|
12
|
+
import { PermissionModule } from '../../resources/permission/permission.module';
|
|
13
|
+
import { TenantModule } from '../../resources/tenant/tenant.module';
|
|
14
|
+
import { BranchModule } from '../../resources/branch/branch.module';
|
|
15
|
+
import { OrganizationModule } from '../../resources/organization/organization.module';
|
|
16
|
+
import { PhotoModule } from 'src/simple-app/features/upload-file/photo/photo.module';
|
|
16
17
|
@Module({
|
|
17
|
-
imports: [UserModule,PermissionModule,TenantModule,OrganizationModule,BranchModule],
|
|
18
|
+
imports: [UserModule, PermissionModule, TenantModule, OrganizationModule, BranchModule, PhotoModule],
|
|
18
19
|
controllers: [ProfileController],
|
|
19
20
|
providers: [ProfileService],
|
|
20
21
|
exports: [ProfileService],
|
|
@@ -3,7 +3,9 @@ import { ForeignKey } from '../../framework/schemas';
|
|
|
3
3
|
import { Branch } from 'src/simple-app/.core/resources/branch/branch.schema';
|
|
4
4
|
import { Permission } from 'src/simple-app/.core/resources/permission/permission.schema';
|
|
5
5
|
import { Role } from '../auth/role-guard/roles.enum';
|
|
6
|
-
|
|
6
|
+
import { Organization } from '../../resources/organization/organization.schema';
|
|
7
|
+
import { Tenant } from '../../resources/tenant/tenant.schema';
|
|
8
|
+
export {KeyValue} from '../../framework/schemas';
|
|
7
9
|
export class UserContextInfo {
|
|
8
10
|
@ApiProperty({ type: String })
|
|
9
11
|
_id: string;
|
|
@@ -13,7 +15,6 @@ export class UserContextInfo {
|
|
|
13
15
|
sessionId: string;
|
|
14
16
|
@ApiProperty({ type: String })
|
|
15
17
|
xOrg: string;
|
|
16
|
-
|
|
17
18
|
@ApiProperty({ type: Number })
|
|
18
19
|
tenantId: number;
|
|
19
20
|
@ApiProperty({ type: Number })
|
|
@@ -58,6 +59,13 @@ export class UserContextInfo {
|
|
|
58
59
|
@ApiProperty({ type: () => [ProfileUserBranch], description: 'List of branch the user can access in current tenant' })
|
|
59
60
|
branches: ProfileUserBranch[];
|
|
60
61
|
|
|
62
|
+
@ApiProperty({ type: () => Tenant, description: 'List of task, or authority of the user can do' })
|
|
63
|
+
tenantInfo: Tenant;
|
|
64
|
+
@ApiProperty({ type: () => Organization, description: 'List of task, or authority of the user can do' })
|
|
65
|
+
orgInfo: Organization;
|
|
66
|
+
@ApiProperty({ type: () => Branch, description: 'List of task, or authority of the user can do' })
|
|
67
|
+
branchInfo: Branch;
|
|
68
|
+
|
|
61
69
|
@ApiProperty({ type: () => Object, description: 'Store all the rest of useful fields regarding user or branch' })
|
|
62
70
|
moreProps?: Record<string, any>;
|
|
63
71
|
}
|
|
@@ -75,11 +83,11 @@ export class ProfileUserInvites {
|
|
|
75
83
|
|
|
76
84
|
export class BranchMinInfo {
|
|
77
85
|
@ApiProperty({ type: String })
|
|
78
|
-
branchId:string
|
|
86
|
+
branchId: string;
|
|
79
87
|
@ApiProperty({ type: String })
|
|
80
|
-
branchCode:string
|
|
88
|
+
branchCode: string;
|
|
81
89
|
@ApiProperty({ type: String })
|
|
82
|
-
branchName:string
|
|
90
|
+
branchName: string;
|
|
83
91
|
}
|
|
84
92
|
export class ProfileUserBranch {
|
|
85
93
|
@ApiProperty({ type: String })
|
|
@@ -21,9 +21,10 @@ import { Tenant } from '../../resources/tenant/tenant.schema';
|
|
|
21
21
|
import { Organization } from '../../resources/organization/organization.schema';
|
|
22
22
|
import { Branch } from '../../resources/branch/branch.schema';
|
|
23
23
|
import { User } from '../../resources/user/user.schema';
|
|
24
|
-
import { Permission } from '../../resources/permission/permission.schema'
|
|
24
|
+
import { KeyValue, Permission } from '../../resources/permission/permission.schema';
|
|
25
25
|
|
|
26
26
|
import { UserContextInfo } from './profile.schema';
|
|
27
|
+
import { PhotoService } from 'src/simple-app/features/upload-file/photo/photo.service';
|
|
27
28
|
const Base64URL = require('@darkwolf/base64url');
|
|
28
29
|
@Injectable()
|
|
29
30
|
export class ProfileService {
|
|
@@ -34,6 +35,7 @@ export class ProfileService {
|
|
|
34
35
|
private orgsvc: OrganizationService,
|
|
35
36
|
private branchsvc: BranchService,
|
|
36
37
|
private permsvc: PermissionService,
|
|
38
|
+
private uploadImageSvc: PhotoService,
|
|
37
39
|
) {}
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -265,4 +267,10 @@ export class ProfileService {
|
|
|
265
267
|
|
|
266
268
|
return 'ok';
|
|
267
269
|
}
|
|
270
|
+
|
|
271
|
+
async uploadPhoto(appuser, data: KeyValue) {
|
|
272
|
+
const fileName = `user/${appuser.getUid()}`;
|
|
273
|
+
await this.uploadImageSvc.sendBase64Image(data.value, fileName, 0);
|
|
274
|
+
return 'ok';
|
|
275
|
+
}
|
|
268
276
|
}
|
package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta
CHANGED
|
@@ -35,7 +35,7 @@ export abstract class BaseQueueConsumer extends WorkerHost {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async process(job: Job) {
|
|
38
|
-
console.log("process job", job.data)
|
|
38
|
+
// console.log("process job", job.data)
|
|
39
39
|
const { userContext, payload } = job.data
|
|
40
40
|
|
|
41
41
|
const appUser = this.createUserContext(userContext.user);
|
|
@@ -106,7 +106,7 @@ export class UserContext extends UserContextInfo {
|
|
|
106
106
|
|
|
107
107
|
// protected moreProps: Record<string, any> = {};
|
|
108
108
|
|
|
109
|
-
protected package: string = '';
|
|
109
|
+
// protected package: string = '';
|
|
110
110
|
|
|
111
111
|
protected webhooks: Webhook[] = []; //systemWebHooks;
|
|
112
112
|
protected clientSetting: TenantClientSetting = {
|
|
@@ -186,7 +186,7 @@ export class UserContext extends UserContextInfo {
|
|
|
186
186
|
|
|
187
187
|
getMoreProps = () => this.moreProps;
|
|
188
188
|
|
|
189
|
-
getPackage = () => this.package;
|
|
189
|
+
// getPackage = () => this.package;
|
|
190
190
|
|
|
191
191
|
getRoles = () => this.roles;
|
|
192
192
|
|
|
@@ -220,9 +220,9 @@ export class UserContext extends UserContextInfo {
|
|
|
220
220
|
// if (Array.isArray(wh) && wh.length > 0) this.webhooks = this.webhooks.concat(wh);
|
|
221
221
|
};
|
|
222
222
|
|
|
223
|
-
setPackage = (packageName: string) => {
|
|
224
|
-
|
|
225
|
-
};
|
|
223
|
+
// setPackage = (packageName: string) => {
|
|
224
|
+
// this.package = packageName;
|
|
225
|
+
// };
|
|
226
226
|
|
|
227
227
|
setTimeZone = (timeZone: string) => {
|
|
228
228
|
this.timeZone = timeZone;
|
|
@@ -270,6 +270,16 @@ export class UserContext extends UserContextInfo {
|
|
|
270
270
|
const pipelines: PipelineStage[] = [
|
|
271
271
|
//get profile
|
|
272
272
|
{ $match: { uid: this.uid, tenantId: this.tenantId } },
|
|
273
|
+
{
|
|
274
|
+
$lookup: {
|
|
275
|
+
from: 'tenant',
|
|
276
|
+
as: 'tenantInfo',
|
|
277
|
+
localField: 'tenantId',
|
|
278
|
+
foreignField: 'tenantId',
|
|
279
|
+
pipeline: [{ $project:{ created:0,updated:0,createdBy:0,updatedBy:0,__v:0} }],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
{$unwind:{path:'$tenantInfo',preserveNullAndEmptyArrays:true}},
|
|
273
283
|
{
|
|
274
284
|
$lookup: {
|
|
275
285
|
from: 'permission',
|
|
@@ -286,13 +296,13 @@ export class UserContext extends UserContextInfo {
|
|
|
286
296
|
},
|
|
287
297
|
},
|
|
288
298
|
{
|
|
289
|
-
$
|
|
290
|
-
uid: 1,
|
|
291
|
-
fullName: 1,
|
|
292
|
-
email: 1,
|
|
293
|
-
tenantId: 1,
|
|
294
|
-
orgId: 1,
|
|
295
|
-
branchId: 1,
|
|
299
|
+
$addFields: {
|
|
300
|
+
// uid: 1,
|
|
301
|
+
// fullName: 1,
|
|
302
|
+
// email: 1,
|
|
303
|
+
// tenantId: 1,
|
|
304
|
+
// orgId: 1,
|
|
305
|
+
// branchId: 1,
|
|
296
306
|
groups: '$perm.groups',
|
|
297
307
|
},
|
|
298
308
|
},
|
|
@@ -327,6 +337,36 @@ export class UserContext extends UserContextInfo {
|
|
|
327
337
|
preserveNullAndEmptyArrays: true,
|
|
328
338
|
},
|
|
329
339
|
},
|
|
340
|
+
{
|
|
341
|
+
$lookup: {
|
|
342
|
+
from: 'tenant',
|
|
343
|
+
as: 'tenantInfo',
|
|
344
|
+
localField: 'tenantId',
|
|
345
|
+
foreignField: 'tenantId',
|
|
346
|
+
pipeline: [{ $project:{ created:0,updated:0,createdBy:0,updatedBy:0,__v:0} }],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{$unwind:{path:'$tenantInfo',preserveNullAndEmptyArrays:true}},
|
|
350
|
+
{
|
|
351
|
+
$lookup: {
|
|
352
|
+
from: 'organization',
|
|
353
|
+
as: 'orgInfo',
|
|
354
|
+
localField: 'orgId',
|
|
355
|
+
foreignField: 'orgId',
|
|
356
|
+
pipeline: [{ $project:{ created:0,updated:0,createdBy:0,updatedBy:0,__v:0} }],
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
{$unwind:{path:'$orgInfo',preserveNullAndEmptyArrays:true}},
|
|
360
|
+
{
|
|
361
|
+
$lookup: {
|
|
362
|
+
from: 'branch',
|
|
363
|
+
as: 'branchInfo',
|
|
364
|
+
localField: 'branchId',
|
|
365
|
+
foreignField: 'branchId',
|
|
366
|
+
pipeline: [{ $project:{ created:0,updated:0,createdBy:0,updatedBy:0,__v:0} }],
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
{$unwind:{path:'$branchInfo',preserveNullAndEmptyArrays:true}},
|
|
330
370
|
{
|
|
331
371
|
$project: {
|
|
332
372
|
uid: 1,
|
|
@@ -346,6 +386,9 @@ export class UserContext extends UserContextInfo {
|
|
|
346
386
|
timeZone: '$b.o.timeZone',
|
|
347
387
|
currency: '$b.o.currency',
|
|
348
388
|
country: '$b.o.country',
|
|
389
|
+
tenantInfo:1,
|
|
390
|
+
orgInfo:1,
|
|
391
|
+
branchInfo:1,
|
|
349
392
|
},
|
|
350
393
|
},
|
|
351
394
|
|
|
@@ -400,8 +443,40 @@ export class UserContext extends UserContextInfo {
|
|
|
400
443
|
],
|
|
401
444
|
},
|
|
402
445
|
},
|
|
403
|
-
|
|
446
|
+
|
|
447
|
+
//get invites
|
|
448
|
+
{
|
|
449
|
+
$lookup: {
|
|
450
|
+
from: 'user',
|
|
451
|
+
localField: 'email',
|
|
452
|
+
foreignField: 'email',
|
|
453
|
+
as: 'invites',
|
|
454
|
+
pipeline: [
|
|
455
|
+
{ $match: { uid: '' } },
|
|
456
|
+
{
|
|
457
|
+
$lookup: {
|
|
458
|
+
from: 'tenant',
|
|
459
|
+
localField: 'tenantId',
|
|
460
|
+
foreignField: 'tenantId',
|
|
461
|
+
as: 'tenant',
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{$unwind:'$tenant'},
|
|
465
|
+
{
|
|
466
|
+
$project:{
|
|
467
|
+
_id:1,
|
|
468
|
+
created:1,
|
|
469
|
+
tenantId: 1,
|
|
470
|
+
tenantName:'$tenant.tenantName'
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
},
|
|
475
|
+
}
|
|
476
|
+
];
|
|
477
|
+
|
|
404
478
|
const userProfiles: UserContextInfo[] = await this.userModel.aggregate(pipelines).exec();
|
|
479
|
+
// console.log("userProfiles",userProfiles)
|
|
405
480
|
return userProfiles[0];
|
|
406
481
|
}
|
|
407
482
|
|
|
@@ -418,13 +493,16 @@ export class UserContext extends UserContextInfo {
|
|
|
418
493
|
this.logger.debug(`User found ${this.uid}`);
|
|
419
494
|
|
|
420
495
|
const userProfile = await this.obtainProfileFromDB();
|
|
421
|
-
// console.log('userProfile', userProfile);
|
|
496
|
+
// console.log('userProfile', JSON.stringify(userProfile,null,2));
|
|
422
497
|
if (userProfile) {
|
|
423
498
|
this.logger.debug(`User ${this.uid} exists in tenant (${this.tenantId})`);
|
|
424
499
|
|
|
425
500
|
this._id = userProfile._id;
|
|
426
501
|
this.branchCode = userProfile['branchCode'] ?? '';
|
|
427
502
|
this.branchName = userProfile['branchName'] ?? '';
|
|
503
|
+
this.tenantInfo = userProfile.tenantInfo;
|
|
504
|
+
this.orgInfo = userProfile.orgInfo;
|
|
505
|
+
this.branchInfo = userProfile.branchInfo;
|
|
428
506
|
this.orgCode = userProfile['orgCode'] ?? '';
|
|
429
507
|
this.orgName = userProfile['orgName'] ?? '';
|
|
430
508
|
this.timeZone = userProfile['timeZone'] ?? '';
|
|
@@ -433,6 +511,7 @@ export class UserContext extends UserContextInfo {
|
|
|
433
511
|
this.offsetMinute = userProfile['offsetMinute'] ?? 0;
|
|
434
512
|
this.orgRecordId = userProfile['orgRecordId'] ?? '';
|
|
435
513
|
this.branchRecordId = userProfile['branchRecordId'] ?? '';
|
|
514
|
+
this.invites = userProfile.invites;
|
|
436
515
|
userProfile['branches'].forEach((b) => {
|
|
437
516
|
b.xOrg = this.generateXOrg(b.tenantId, b.orgId, b.branchId);
|
|
438
517
|
});
|
|
@@ -445,8 +524,8 @@ export class UserContext extends UserContextInfo {
|
|
|
445
524
|
support: false,
|
|
446
525
|
};
|
|
447
526
|
this.roles = userProfile['roles'] ?? [Role.Everyone, Role.User];
|
|
448
|
-
|
|
449
|
-
this.package = userProfile['package'];
|
|
527
|
+
this.moreProps = this.setMoreProps(userProfile);
|
|
528
|
+
// this.package = userProfile['package'];
|
|
450
529
|
// this.appintegration = await this.setAppIntegration();
|
|
451
530
|
} else {
|
|
452
531
|
this.logger.debug(`User ${this.uid} not exists in tenant (${this.tenantId})`);
|
|
@@ -600,6 +679,9 @@ export class UserContext extends UserContextInfo {
|
|
|
600
679
|
branchId: this.branchId,
|
|
601
680
|
//branch id in string (branch._id)
|
|
602
681
|
branchRecordId: this.branchRecordId,
|
|
682
|
+
tenantInfo: this.tenantInfo,
|
|
683
|
+
orgInfo: this.orgInfo,
|
|
684
|
+
branchInfo: this.branchInfo,
|
|
603
685
|
|
|
604
686
|
branchCode: this.branchCode,
|
|
605
687
|
branchName: this.branchName,
|
|
@@ -980,7 +1062,7 @@ export class UserContext extends UserContextInfo {
|
|
|
980
1062
|
/**
|
|
981
1063
|
* Define additional properties from user into moreProps
|
|
982
1064
|
*/
|
|
983
|
-
setMoreProps(userProfile:
|
|
1065
|
+
setMoreProps(userProfile: UserContextInfo): Record<string, any> {
|
|
984
1066
|
const allprops = Object.keys(userProfile);
|
|
985
1067
|
const excludekeys = [
|
|
986
1068
|
'created',
|
|
@@ -1003,6 +1085,9 @@ export class UserContext extends UserContextInfo {
|
|
|
1003
1085
|
'country',
|
|
1004
1086
|
'offsetMinute',
|
|
1005
1087
|
'tenantId',
|
|
1088
|
+
'tenantInfo',
|
|
1089
|
+
'orgInfo',
|
|
1090
|
+
'branchInfo',
|
|
1006
1091
|
// 'lastActivity',
|
|
1007
1092
|
'group',
|
|
1008
1093
|
'__v',
|
|
@@ -1017,9 +1102,9 @@ export class UserContext extends UserContextInfo {
|
|
|
1017
1102
|
}
|
|
1018
1103
|
}
|
|
1019
1104
|
|
|
1020
|
-
if (!data['package']) {
|
|
1021
|
-
|
|
1022
|
-
}
|
|
1105
|
+
// if (!data['package']) {
|
|
1106
|
+
// data['package'] = 'free';
|
|
1107
|
+
// }
|
|
1023
1108
|
return data;
|
|
1024
1109
|
}
|
|
1025
1110
|
|
|
@@ -1054,7 +1139,7 @@ type UserProfile = {
|
|
|
1054
1139
|
groups: string[];
|
|
1055
1140
|
roles: Role[];
|
|
1056
1141
|
tenantRecordId?: string;
|
|
1057
|
-
package?: string;
|
|
1142
|
+
// package?: string;
|
|
1058
1143
|
branchRecordId?: string;
|
|
1059
1144
|
branchCode?: string;
|
|
1060
1145
|
branchName?: string;
|
|
@@ -1092,7 +1177,7 @@ type UserProfile = {
|
|
|
1092
1177
|
currentTenant: {
|
|
1093
1178
|
_id: string;
|
|
1094
1179
|
tenantName: string;
|
|
1095
|
-
package: string;
|
|
1180
|
+
// package: string;
|
|
1096
1181
|
clientSetting: TenantClientSetting;
|
|
1097
1182
|
owner: {
|
|
1098
1183
|
uid: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%
|
|
2
|
+
for(let i=0; i<it.modules.length;i++){
|
|
3
|
+
const m= it.modules[i]
|
|
4
|
+
if(getSystemResources().includes(m.docname.toLowerCase())){
|
|
5
|
+
%>
|
|
6
|
+
export * from 'src/simple-app/.core/resources/<%=camelToKebab(m.typename)%>/<%=camelToKebab(m.typename)%>.jsonschema'
|
|
7
|
+
<%}else{%>
|
|
8
|
+
export * from 'src/simple-app/.resources/<%=camelToKebab(m.typename)%>/<%=camelToKebab(m.typename)%>.jsonschema'
|
|
9
|
+
<%}%>
|
|
10
|
+
<%}%>
|
|
11
|
+
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="flex flex-row">
|
|
3
3
|
<ImageToBase64Uploader
|
|
4
4
|
v-if="changable"
|
|
5
|
+
@image-uploaded="handleBase64"
|
|
5
6
|
#default
|
|
6
|
-
:style="`width:${size}px; height:${size} px`"
|
|
7
7
|
:class="`place-content-center `"
|
|
8
|
-
@image-uploaded="handleBase64"
|
|
9
|
-
:imagePath="imagepath"
|
|
10
8
|
>
|
|
9
|
+
<div v-if="uploading" class="w-full h-full rounded-lg">
|
|
10
|
+
<ProgressSpinner class="w-full h-full rounded-lg min-w-32" />
|
|
11
|
+
</div>
|
|
11
12
|
<NuxtImg
|
|
12
|
-
v-
|
|
13
|
-
class="
|
|
14
|
-
:src="
|
|
13
|
+
v-else
|
|
14
|
+
class="h-full rounded-lg"
|
|
15
|
+
:src="`${server}/users/${uid}/${size}`"
|
|
16
|
+
placeholder="/images/student.png"
|
|
15
17
|
:key="imageKey"
|
|
16
|
-
|
|
17
|
-
/>
|
|
18
|
+
/>
|
|
18
19
|
</ImageToBase64Uploader>
|
|
19
|
-
<div
|
|
20
|
-
v-else
|
|
21
|
-
class="inline-block text-black"
|
|
22
|
-
:style="`width:${size}px; height:${size} px`"
|
|
23
|
-
>
|
|
20
|
+
<div v-else class="inline-block text-black">
|
|
24
21
|
<NuxtImg
|
|
25
22
|
v-if="uid"
|
|
26
|
-
class="
|
|
27
|
-
:
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
class="h-full border rounded-full"
|
|
24
|
+
:src="`${server}/users/${uid}/${size}`"
|
|
25
|
+
placeholder="/images/student.png"
|
|
26
|
+
:key="imageKey"
|
|
30
27
|
/>
|
|
31
28
|
</div>
|
|
32
29
|
</div>
|
|
@@ -34,30 +31,41 @@
|
|
|
34
31
|
<script lang="ts" setup>
|
|
35
32
|
import { updateAvatarVersion } from "~/composables/stringHelper.generate";
|
|
36
33
|
import { PHOTOSIZE } from "~/types";
|
|
37
|
-
|
|
34
|
+
const server = useRuntimeConfig().public.avatarUrl;
|
|
35
|
+
const emits = defineEmits(["upload"]);
|
|
36
|
+
const imageUrl = defineModel<string>();
|
|
37
|
+
const uploading = ref(false);
|
|
38
|
+
const imageKey = ref(0);
|
|
38
39
|
// import {KeyValue} from ''
|
|
39
40
|
const props = defineProps<{
|
|
40
41
|
changable?: boolean;
|
|
41
42
|
size?: PHOTOSIZE;
|
|
42
|
-
uid
|
|
43
|
+
uid: string;
|
|
43
44
|
refreshkey?: number;
|
|
44
45
|
}>();
|
|
45
46
|
const size = computed(() => props.size ?? PHOTOSIZE.S64);
|
|
46
|
-
const imageKey = ref(0);
|
|
47
|
-
const uid = computed(() => props.uid ?? getUserProfile()?.uid);
|
|
48
47
|
// const xorgpath = getCurrentXorg() ? `${getCurrentXorg()}/` : "MC0wLTA/";
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
useNuxtApp().$listen("RefreshPhoto", (resource: string[]) => {
|
|
50
|
+
if (resource[0] == "user" && resource[1] == props.uid) {
|
|
51
|
+
imageKey.value = new Date().getTime();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
51
54
|
|
|
52
55
|
const handleBase64 = async (data: string) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
uploading.value = true;
|
|
57
|
+
const keyvalue = {
|
|
58
|
+
key: `--`,
|
|
59
|
+
value: data,
|
|
60
|
+
};
|
|
61
|
+
const uploadok = await getProfileApi().uploadPhoto(keyvalue);
|
|
62
|
+
if (uploadok) {
|
|
63
|
+
imageKey.value = new Date().getTime();
|
|
64
|
+
uploading.value = false;
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
useNuxtApp().$event("RefreshPhoto", ["user", props.uid]);
|
|
67
|
+
}, 1500);
|
|
68
|
+
}
|
|
69
|
+
uploading.value = false;
|
|
62
70
|
};
|
|
63
71
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<title>{{ t("profile") }}</title>
|
|
3
3
|
<div class="p-4 place-items-center text-center justify-center flex flex-row">
|
|
4
|
-
<ImageAvatar :size="
|
|
4
|
+
<ImageAvatar :size="PHOTOSIZE.S200" changable class="cursor-pointer w w-36 h h-36" :uid="getUserProfile().uid"/>
|
|
5
5
|
</div>
|
|
6
6
|
<div class="p-4">
|
|
7
7
|
<div class="px-4 sm:px-0">
|
|
@@ -110,12 +110,7 @@
|
|
|
110
110
|
</div>
|
|
111
111
|
</template>
|
|
112
112
|
<script setup lang="ts">
|
|
113
|
-
|
|
114
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
115
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
116
|
-
* last change 2023-10-28
|
|
117
|
-
* Author: Ks Tan
|
|
118
|
-
*/
|
|
113
|
+
import { PHOTOSIZE } from "~/types";
|
|
119
114
|
const capitalizeGroups = (groups: string[] | undefined): string[] => {
|
|
120
115
|
if (!groups) return [];
|
|
121
116
|
return groups.map((group) => group.charAt(0).toUpperCase() + group.slice(1));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { defineNuxtPlugin } from "#app";
|
|
8
|
-
import { PROFILEApi,ProfileUserBranch,UserContextInfo } from "../simpleapp/generate/openapi";
|
|
8
|
+
import { PROFILEApi,ProfileUserBranch,UserContextInfo , Branch, Tenant,Organization} from "../simpleapp/generate/openapi";
|
|
9
9
|
import { UserProfile } from "~/types";
|
|
10
10
|
import axios, { Axios, AxiosError, AxiosResponse } from "axios";
|
|
11
11
|
import _ from "lodash";
|
|
@@ -30,6 +30,9 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
30
30
|
currency: ref(""),
|
|
31
31
|
country: ref(""),
|
|
32
32
|
offsetMinute: ref(0),
|
|
33
|
+
tenantInfo: ref<Tenant>(),
|
|
34
|
+
orgInfo: ref<Organization>(),
|
|
35
|
+
branchInfo: ref<Branch>(),
|
|
33
36
|
uid: ref(""),
|
|
34
37
|
email: ref(""),
|
|
35
38
|
fullName: ref(""),
|