Как сделать поле Id скрытым в методе создания (POST) - PullRequest
0 голосов
/ 06 июля 2019

Я использую Loopback4 и у меня есть определение следующей модели

export class ResourceGroup extends Entity {
  @property({
    type: 'number',
    id: true,
    generated: true
  })
  id: number;
// ...

Ниже приведено действие контроллера

@post('/resource-groups', {
    responses: {
      '200': {
        description: 'ResourceGroup model instance',
        content: {'application/json': {schema: {'x-ts-type': ResourceGroup}}},
      },
    },
  })
  async create(@requestBody() resourceGroup: ResourceGroup): Promise<ResourceGroup> {
    return await this.resourceGroupRepository.create(resourceGroup);
  }

enter image description here

Я не хочу предоставлять атрибут "id" для запроса POST.

Как я могу это скрыть?

...