Project

General

Profile

roos-fs tasks #310

Updated by Vadim Pariev 9 months ago

**API Endpoints that needs to be created** 

 GET  

 - Returns the list of spare parts assigned to the given customer (through vechicle). 
 - Only includes items with status = In Stock. 

 POST 

 Validates that: 

 - The spare part is assigned to the given customer and vehicle. 
 - The serial number matches the assigned spare part. 
 - The spare part is In Stock. 

 Returns 200 OK if validation passes, otherwise error message. 

 PATCH 

 - Updates the status of a spare part (In Stock → Installed). 
 - Called automatically when the related service task is marked as completed. 

 GET  

 - Fetches full detail of the spare part including relations: 

 2. Business Logic 

 - API must ensure a Monteur cannot select a spare part that belongs to a different customer. 
 - If a serial number does not match the assigned spare part → return 400 Bad Request with error message. 
 - When a service is completed → automatically update spare part’s status to Installed and link it to: 

 1) Service 
 2) Vehicle 

 3. Localization 

 All API responses must return messages in English and German 
 Validate the solution with @vi.grishkova@gmail.com  

 Acceptance criterea: 

 - Mobile app can fetch spare parts per vehicle/customer via API. 
 - API validates spare part selection and serial number. 
 - API prevents assigning spare parts to the wrong customer/vehicle. 
 - When service = completed → spare part status is updated to Installed and linked with service/vehicle. 
 - All error/success messages available in English + German.

Back