Skip to content

Feature - DTO option for create + update actions #132

@bashleigh

Description

@bashleigh

As discussed. Add a DTO option to the crud decorator to use an optional DTO object instead of the entity.

@Crud({
  model: {
    type: User,
  },
  dto: {
    create: UserCreateDTO,
    update: UserUpdateDTO,
  },
  params: {
    companyId: {
      field: 'companyId',
      type: 'number',
    },
    id: {
      field: 'id',
      type: 'number',
      primary: true,
    },
  },
  query: {
    join: {
      company: {
        exclude: ['description'],
      },
      profile: {
        eager: true,
        exclude: ['updatedAt'],
      },
    },
  },
})
@ApiUseTags('users')
@Controller('/companies/:companyId/users')
export class UserController extends  CrudController<User> {}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions