angular-architects / ngrx-toolkit

Various Extensions for the NgRx Signal Store
MIT License
146 stars 22 forks source link

withDataService: partial entity update #26

Closed qooco closed 4 months ago

qooco commented 6 months ago

This is a changes for DataService methods (create & update & updateAll) to use Partial Entity


Also have question, why update method receives only one argument Entity,

update(entity: Partial<Entity>)

is not better?

update(id: EntityId, data: Partial<Entity>)
rainerhahnekamp commented 6 months ago

Thanks, would it be possible to add a small unit test to it as well? If not, please let me know. I think I can help with that.

qooco commented 6 months ago

A bit busy, no time.

rainerhahnekamp commented 6 months ago

Thanks @qooco, the update didn't require the id so far, because it wasn't a partial. We'll discuss it internally. I support your changes. The only exception is the create. There, I don't want to have a partial.

qooco commented 6 months ago

Ok I Understand about update.

About create, thats too ok, in most cases it is right I think (except such properties as created_at|updated_at). As variant we can use EntityCreateRequest with only required properties...

Should I update PR to remove partial from create (rewrite commit) ?

qooco commented 6 months ago

PR update: only Partial update