vona-cli-set-api 1.0.216 → 1.0.220

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.
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "vona": "^5.0.128"
48
+ "vona": "^5.0.130"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@cabloy/lint": "^5.0.16",
@@ -16,9 +16,9 @@ export interface IControllerOptions<%=argv.resourceNameCapitalize%> extends IDec
16
16
  @Controller<IControllerOptions<%=argv.resourceNameCapitalize%>>('<%=argv.resourceName%>')
17
17
  export class Controller<%=argv.resourceNameCapitalize%> extends BeanBase {
18
18
  @Web.post()
19
- @Api.body(v.object(Entity<%=argv.resourceNameCapitalize%>))
20
- async create(@Arg.body() <%=argv.resourceName%>: Dto<%=argv.resourceNameCapitalize%>Create): Promise<Entity<%=argv.resourceNameCapitalize%>> {
21
- return await this.scope.service.<%=argv.resourceName%>.create(<%=argv.resourceName%>);
19
+ @Api.body(v.tableIdentity())
20
+ async create(@Arg.body() <%=argv.resourceName%>: Dto<%=argv.resourceNameCapitalize%>Create): Promise<TableIdentity> {
21
+ return (await this.scope.service.<%=argv.resourceName%>.create(<%=argv.resourceName%>)).id;
22
22
  }
23
23
 
24
24
  @Web.get()
@@ -19,24 +19,24 @@ describe('<%=argv.resourceName%>.test.ts', () => {
19
19
  // login
20
20
  await app.bean.passport.signinMock();
21
21
  // create
22
- const <%=argv.resourceName%>: Entity<%=argv.resourceNameCapitalize%> = await app.bean.executor.performAction('post', '<%=argv.moduleActionPathRaw%>', { body: data });
23
- assert.equal(<%=argv.resourceName%>.name, data.name);
22
+ const <%=argv.resourceName%>Id = await app.bean.executor.performAction('post', '<%=argv.moduleActionPathRaw%>', { body: data });
23
+ assert.equal(!!<%=argv.resourceName%>Id, true);
24
24
  // findMany
25
25
  const queryRes: Dto<%=argv.resourceNameCapitalize%>QueryRes = await app.bean.executor.performAction('get', '<%=argv.moduleActionPathRaw%>');
26
26
  assert.equal(queryRes.list.findIndex(item => item.name === data.name) > -1, true);
27
27
  // update
28
28
  await app.bean.executor.performAction('patch', '<%=argv.moduleActionPathRaw%>/:id', {
29
- params: { id: <%=argv.resourceName%>.id },
29
+ params: { id: <%=argv.resourceName%>Id },
30
30
  body: dataUpdate,
31
31
  });
32
32
  // findOne
33
- const <%=argv.resourceName%>One: Entity<%=argv.resourceNameCapitalize%> = await app.bean.executor.performAction('get', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>.id } });
34
- assert.equal(<%=argv.resourceName%>One.name, dataUpdate.name);
33
+ const <%=argv.resourceName%>: Entity<%=argv.resourceNameCapitalize%> = await app.bean.executor.performAction('get', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>Id } });
34
+ assert.equal(<%=argv.resourceName%>.name, dataUpdate.name);
35
35
  // delete
36
- await app.bean.executor.performAction('delete', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>One.id } });
36
+ await app.bean.executor.performAction('delete', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>.id } });
37
37
  // findOne
38
38
  const [_, err] = await catchError(() => {
39
- return app.bean.executor.performAction('get', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>One.id } });
39
+ return app.bean.executor.performAction('get', '<%=argv.moduleActionPathRaw%>/:id', { params: { id: <%=argv.resourceName%>.id } });
40
40
  });
41
41
  assert.equal(err?.code, 404);
42
42
  // logout
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.216",
4
+ "version": "1.0.220",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"