Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateOne Override creates a new record instead of updating a record #38

Closed
lapwat opened this issue Mar 12, 2019 · 1 comment
Closed

Comments

@lapwat
Copy link

lapwat commented Mar 12, 2019

What works ?

Code

@Crud(Role)
@Controller('roles')
export class RolesController implements CrudController<RolesService, Role> {
  constructor(public service: RolesService) {}
}

Test

PATCH /roles/2 Works and returns { id:2, ...updatedFields}

What does not work ?

Code

@Crud(Role)
@Controller('roles')
export class RolesController implements CrudController<RolesService, Role> {
  constructor(public service: RolesService) {}

  get base(): CrudController<RolesService, Role> {
    return this;
  }

  @Override()
  updateOne(@Param('id') id, @Param() params, @Body() dto) {
    // id, params and dto are good here
    return this.base.updateOneBase(id, params, dto);
  }
}

Test

PATCH /roles/2 Does not work because it returns a new record { id:14, ...newField}

I think it might be correlated with this issue: #4

@michaelyali
Copy link
Member

Please, try it with v3.0.0
Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants