@simitgroup/simpleapp-generator 2.0.2-y-alpha → 2.0.3-a-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 CHANGED
@@ -1,3 +1,6 @@
1
+ [2.0.3a-alpha]
2
+ 1. Add createMany controller for all nestJs resources
3
+
1
4
  [2.0.2y-alpha]
2
5
  1. Add utcToLocalOffset function
3
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "2.0.2y-alpha",
3
+ "version": "2.0.3a-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -212,6 +212,17 @@ export class <%= it.typename %>Controller extends SimpleAppController<
212
212
  return await this._update(appuser,id, data) ;
213
213
  }
214
214
 
215
+ @Post('bulk-create')
216
+ @Roles(Role.SuperAdmin, Role.SuperUser, Role.<%= it.typename%>_create)
217
+ @ApiResponse({ status: 201,description: 'success',type: [schemas.<%= it.typename%>] })
218
+ @ApiResponse({ status: 400, description: 'bad request' })
219
+ @ApiResponse({ status: 500, description: 'internal error' })
220
+ @ApiBody({ description: 'Data', type: [schemas.<%= it.typename%>] })
221
+ @ApiOperation({ operationId: 'runCreateMany' })
222
+ async createMany(@AppUser() appuser: UserContext, @Body() data: schemas.<%= it.typename%>[]) {
223
+ return await this._createMany(appuser, data);
224
+ }
225
+
215
226
  @Patch('bulk-patch')
216
227
  @ApiResponse({ status: 200, description: 'success', type: schemas.UpdateManyResponse})
217
228
  @Roles(Role.SuperAdmin, Role.SuperUser, Role.<%= it.typename%>_update)
@@ -29,6 +29,7 @@ type ServiceType = {
29
29
  setData: Function;
30
30
  getAutoComplete: Function;
31
31
  fullTextSearch: Function;
32
+ createMany: Function;
32
33
  patchMany: Function;
33
34
  };
34
35
 
@@ -94,6 +95,10 @@ export class SimpleAppController<TService extends ServiceType, TApiSchema> {
94
95
  return this.service.findIdThenDelete(appuser, id);
95
96
  }
96
97
 
98
+ async _createMany(appuser: UserContext, data: TApiSchema[]) {
99
+ return this.service.createMany(appuser, data) as TApiSchema[];
100
+ }
101
+
97
102
  async _patchMany(appuser: UserContext, patchManyData: PatchManyRequest<TApiSchema>) {
98
103
  return this.service.patchMany(appuser, patchManyData);
99
104
  }