package com.lemans.ds.studioorder import com.lemans.LemansApiController class StudioOrderPartController extends LemansApiController { def studioOrderPartService def studioOrderPartManagerService def index(Integer studioOrderId) { Map criteria = common() + pagination() + filters(['statusId']) + [studioOrderId: studioOrderId] renderPaginated studioOrderPartService.findParts(criteria) } def show(Integer studioOrderId, String partNumber) { renderOne studioOrderPartService.findPart([studioOrderId: studioOrderId, partNumber: partNumber]) } def performActions(Integer studioOrderId) { Map values = request.JSON Map data = studioOrderPartManagerService.performActions(values + [studioOrderId: studioOrderId], auditUserName) if (data?.messages && values.action != 'create') { response.status = 400 render toJson(data) } else { render(toJson(data)) } } }