hftlclub / node-iltis

Node.js backend for ILTIS
MIT License
1 stars 0 forks source link

Add check for Products and Sizes (delete, deactivate) #22

Closed rweisse closed 7 years ago

rweisse commented 7 years ago

/product/{productId}/unused /product/{productId}/size/{sizeTypeId}/unused

fmalcher commented 7 years ago

For the sizes check you used deletable: /product/{productId}/size/{sizeTypeId}/deletable

I'd like to see the same wording in all those cases – either unsued or deletable. What do you think? @rweisse

rweisse commented 7 years ago

Yes. The problem is that I need a second ressource for the deactivation-check of Sizes. /deletable checks the occurances of product-sizetype-relations in event-transfers- and transactions-tables. /unused just checks if the current inventory of this product or product-size is zero or not. That's a difference. Furthermore I need to address the same ressource twice because of this two types of checks :

/product/{productId}/size/{sizeTypeId}/unused /product/{productId}/size/{sizeTypeId}/deletable

Therefore we need two different wordings. I don't like that, too :-/ Do you have a better idea?

fmalcher commented 7 years ago

I understand the problem... what about offering unused AND deletable for all those cases? Then I could always use deletable for delete actions and unused for deactivation – even if they resolve to the same controller function. Difficult thing...

rweisse commented 7 years ago

Ok, then I will implement a second ressource next to /product/{productId}/unused named /product/{productId}/deletable which does the same backend-job like unused. You are right. That's a cleaner way from the APIs point of view.