@shys/crud 1.0.1-beta.2 → 1.0.1-beta.4

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/generator.js CHANGED
@@ -72,6 +72,9 @@ function joiRuleOf(field, opts = {}) {
72
72
  default:
73
73
  j = 'Joi.string()' + (field.len ? `.max(${field.len})` : '');
74
74
  }
75
+ const label = field.comment || field.camel;
76
+ if (label)
77
+ j += `.label(${JSON.stringify(label)})`;
75
78
  if (allowNull)
76
79
  j += '.allow(null)';
77
80
  if (required)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shys/crud",
3
- "version": "1.0.1-beta.2",
3
+ "version": "1.0.1-beta.4",
4
4
  "description": "MidwayJS v4 模块化 CRUD CLI 生成器",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,5 +1,5 @@
1
- import { Controller, Inject } from '@midwayjs/core';
2
- import { CrudPiped } from '@shys/crud-piped';
1
+ import { Inject } from '@midwayjs/core';
2
+ import { YSController, CrudPiped } from '@shys/core';
3
3
  import { {{ Pascal }} } from '../entity/{{ Camel }}.entity';
4
4
  import { {{ ServiceName }} } from '../service/{{ Camel }}.service';
5
5
  import {
@@ -10,7 +10,7 @@ import {
10
10
  } from '../dto/{{ Camel }}';
11
11
  import { {{ VOName }}, {{ ListVOName }} } from '../vo/{{ Camel }}';
12
12
 
13
- @Controller({{ ('/api/' + pluralKebab) | json }}, {
13
+ @YSController({
14
14
  tagName: {{ tagName | json }},
15
15
  description: {{ desc | json }},
16
16
  })
@@ -24,7 +24,7 @@ export class {{ Pascal }} extends BaseEntity {
24
24
  description: {{ (pkInfo.comment or '主键ID') | json }},
25
25
  })
26
26
  @Expose()
27
- @Rule(Joi.number().integer().required())
27
+ @Rule(Joi.number().integer().label({{ (pkInfo.comment or '主键ID') | json }}).required())
28
28
  {{ pkInfo.camel }}: number;
29
29
 
30
30
  {% endif -%}