@simitgroup/simpleapp-generator 2.0.0-d-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.
@@ -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,yBAsHzB,CAAC"}
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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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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "2.0.0d-alpha",
3
+ "version": "2.0.0e-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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
@@ -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/appuser.decorator';
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() appuser: UserContext) {
35
- this.logger.debug(`access getProfile API by ${appuser.getUid()},(${appuser.getId()})`);
36
- const result = await this.profileservice.getProfile(appuser);
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() appuser: UserContext) {
59
- const result = await this.profileservice.getSession(appuser);
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() appuser: UserContext) {
80
- this.logger.debug(`access getAllTenants API by ${appuser.getUid()},(${appuser.getId()})`);
81
- const result = await this.profileservice.getAllTenants(appuser);
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() appuser: UserContext,
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(appuser, tenantName, timeZone, utcOffset, businessType);
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() appuser: UserContext, @Param('id') id: string, @Param('decision') decision: string) {
122
- const result = await this.profileservice.decideInvitation(appuser, id, decision);
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() appuser: UserContext, @Param('guidename') guidename: string) {
137
- const result = await this.profileservice.runTourComplete(appuser, guidename);
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],
@@ -5,7 +5,7 @@ import { Permission } from 'src/simple-app/.core/resources/permission/permission
5
5
  import { Role } from '../auth/role-guard/roles.enum';
6
6
  import { Organization } from '../../resources/organization/organization.schema';
7
7
  import { Tenant } from '../../resources/tenant/tenant.schema';
8
-
8
+ export {KeyValue} from '../../framework/schemas';
9
9
  export class UserContextInfo {
10
10
  @ApiProperty({ type: String })
11
11
  _id: string;
@@ -59,13 +59,13 @@ export class UserContextInfo {
59
59
  @ApiProperty({ type: () => [ProfileUserBranch], description: 'List of branch the user can access in current tenant' })
60
60
  branches: ProfileUserBranch[];
61
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
-
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
+
69
69
  @ApiProperty({ type: () => Object, description: 'Store all the rest of useful fields regarding user or branch' })
70
70
  moreProps?: Record<string, any>;
71
71
  }
@@ -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
  }
@@ -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);
@@ -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-if="uid"
13
- class="w-full h-full border-4 rounded-full"
14
- :src="imagepath"
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
- provider="cloudflare"
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="w-full h-full border rounded-full"
27
- :key="refreshkey"
28
- :src="imagepath"
29
- provider="cloudflare"
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?: string;
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
- const imagepath = computed(() => useUserInfo().getAvatarByUid(uid.value,size.value)); //`${xorgpath}images/organization/${orgRecordId.value}`;
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
- await fetch(`/api/profile/avatar`, {
54
- method: "POST",
55
- body: data.split("base64,")[1],
56
- }).then(async (res) => {
57
- await fetch(imagepath.value, { cache: "reload", credentials: "include" });
58
- imageKey.value++;
59
- updateAvatarVersion();
60
- // useNuxtApp().$event('RefreshUser',uid.value)
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>
@@ -6,8 +6,7 @@
6
6
  >
7
7
  <ClientOnly>
8
8
  <slot name="default">
9
- <Image v-if="selectedBase64Img" :src="selectedBase64Img" />
10
- <i v-else class="pi pi-upload text-3xl"></i>
9
+ <div class="text-red-600">add NuxtImg component</div>
11
10
  </slot>
12
11
 
13
12
  <Dialog
@@ -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="128" changable class="cursor-pointer" />
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));
@@ -34,6 +34,7 @@ export type EventType ={
34
34
  'RefreshUser' :string
35
35
  'RefreshDocument': string
36
36
  'RefreshDocumentList': RefreshDocumentList
37
+ 'RefreshPhoto':string[]
37
38
  'ViewRecord': ViewRecord
38
39
  'SessionExpire': string
39
40
  'CloseDialog': string
@@ -84,3 +84,11 @@ export type SearchBody = {
84
84
  export type DynamicObject = {
85
85
  [key: string]: any;
86
86
  };
87
+
88
+ export enum PHOTOSIZE {
89
+ "S40"="40",
90
+ "S64"="64",
91
+ "S200"="200",
92
+ "S500"="500",
93
+ }
94
+