Loading customer-service/src/main/java/cz/muni/fi/pa165/controller/CustomerAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/CustomerController.java +7 −4 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package cz.muni.fi.pa165.controller; import cz.muni.fi.pa165.facade.CustomerFacade; import cz.muni.fi.pa165.model.DTO.CustomerDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; Loading @@ -16,13 +17,13 @@ import org.springframework.web.bind.annotation.RestController; @Tag(name = "Customer API", description = "Provides API to create a customer.") @RestController("/customer") public class CustomerAPI { public class CustomerController { // Note: this might not be needed and might be a user api private final CustomerFacade customerFacade; @Autowired public CustomerAPI(CustomerFacade customerFacade) { public CustomerController(CustomerFacade customerFacade) { this.customerFacade = customerFacade; } Loading @@ -35,7 +36,7 @@ public class CustomerAPI { }) @PostMapping public void createCustomer( @RequestBody CustomerDTO customerDTO @Parameter(description = "Customer data", required = true) @RequestBody CustomerDTO customerDTO ) { customerFacade.createCustomer(customerDTO); } Loading @@ -48,7 +49,9 @@ public class CustomerAPI { content = @Content(mediaType = "application/json")), }) @GetMapping("/{customerId}") public CustomerDTO getCustomerById(@PathVariable Long customerId) { public CustomerDTO getCustomerById( @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId ) { return customerFacade.findCustomerById(customerId); } } customer-service/src/main/java/cz/muni/fi/pa165/controller/FeedbackAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/FeedbackController.java +14 −10 Original line number Diff line number Diff line Loading @@ -22,12 +22,12 @@ import java.util.List; @Tag(name = "Feedback API", description = "Provides API for manipulating with feedbacks on wine bottles.") @RestController("/feedback") public class FeedbackAPI { public class FeedbackController { private final FeedbackFacade feedbackFacade; @Autowired public FeedbackAPI(FeedbackFacade feedbackFacade) { public FeedbackController(FeedbackFacade feedbackFacade) { this.feedbackFacade = feedbackFacade; } Loading @@ -41,7 +41,7 @@ public class FeedbackAPI { }) @GetMapping("/{feedbackId}") public FeedbackDTO getFeedbackById( @Parameter(description = "Feedback Id") @PathVariable Long feedbackId @Parameter(description = "Feedback ID", required = true) @PathVariable Long feedbackId ) { return feedbackFacade.findById(feedbackId); } Loading @@ -54,9 +54,11 @@ public class FeedbackAPI { }) @GetMapping("/customer") public List<FeedbackDTO> getFeedbackByCustomerId( @Parameter(description = "Customer Id") @RequestParam Long customerId @Parameter(description = "Customer ID", required = true) @RequestParam Long customerId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return feedbackFacade.findByCustomerId(customerId); return feedbackFacade.findByCustomerId(customerId, page, size); } @Operation(summary = "Get all feedbacks of a wine", description = "Return all feedbacks of a wine by wine Id") Loading @@ -67,9 +69,11 @@ public class FeedbackAPI { }) @GetMapping("/wine-bottle") public List<FeedbackDTO> getFeedbackByWineBottleId( @Parameter(description = "External id of wine") @RequestParam Long wineBottleId @Parameter(description = "External id of wine") @RequestParam Long wineBottleId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return feedbackFacade.findByWineId(wineBottleId); return feedbackFacade.findByWineId(wineBottleId, page, size); } @Operation(summary = "Create feedback", description = "Create feedback as a customer") Loading @@ -81,8 +85,8 @@ public class FeedbackAPI { }) @PostMapping("/{customerId}") public void createFeedback( @Parameter(description = "Customer Id") @PathVariable Long customerId, @Parameter(description = "Feedback to create") @RequestBody FeedbackDTO feedback @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId, @Parameter(description = "Feedback to create", required = true) @RequestBody FeedbackDTO feedback ) { feedbackFacade.createFeedback(feedback, customerId); } Loading @@ -97,7 +101,7 @@ public class FeedbackAPI { }) @PutMapping public FeedbackDTO updateFeedback( @Parameter(description = "Feedback data to update") @RequestBody FeedbackDTO feedback @Parameter(description = "Feedback data to update", required = true) @RequestBody FeedbackDTO feedback ) { return feedbackFacade.updateFeedback(feedback); } Loading customer-service/src/main/java/cz/muni/fi/pa165/controller/InvoiceAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/InvoiceController.java +11 −8 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package cz.muni.fi.pa165.controller; import cz.muni.fi.pa165.facade.InvoiceFacade; import cz.muni.fi.pa165.model.DTO.InvoiceDTO; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; Loading @@ -19,12 +20,12 @@ import java.util.List; @Tag(name = "Invoice API", description = "Provides API for creating and displaying invoices.") @RestController("/invoice") public class InvoiceAPI { public class InvoiceController { private final InvoiceFacade invoiceFacade; @Autowired public InvoiceAPI(InvoiceFacade invoiceFacade) { public InvoiceController(InvoiceFacade invoiceFacade) { this.invoiceFacade = invoiceFacade; } Loading @@ -37,8 +38,8 @@ public class InvoiceAPI { }) @PostMapping("/create") public InvoiceDTO createInvoice( @RequestBody InvoiceDTO invoiceDTO, @RequestParam Long customerId @Parameter(description = "Invoice data", required = true) @RequestBody InvoiceDTO invoiceDTO, @Parameter(description = "Customer ID", required = true) @RequestParam Long customerId ) { return invoiceFacade.createInvoice(invoiceDTO, customerId); } Loading @@ -52,7 +53,7 @@ public class InvoiceAPI { }) @GetMapping("/{invoiceId}") public InvoiceDTO getInvoiceById( @PathVariable String invoiceId @Parameter(description = "Invoice ID", required = true) @PathVariable String invoiceId ) { return invoiceFacade.getInvoiceById(invoiceId); } Loading @@ -64,9 +65,11 @@ public class InvoiceAPI { }) @GetMapping("/customer/{customerId}") public List<InvoiceDTO> getInvoicesByCustomerId( @PathVariable Long customerId @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return invoiceFacade.getInvoicesByCustomerId(customerId); return invoiceFacade.getInvoicesByCustomerId(customerId, page, size); } @ApiResponses(value = { Loading @@ -78,7 +81,7 @@ public class InvoiceAPI { }) @GetMapping("/document/{invoiceId}") public byte[] generateInvoiceDocument( @PathVariable String invoiceId @Parameter(description = "Invoice ID", required = true) @PathVariable String invoiceId ) { return invoiceFacade.generateInvoiceDocument(invoiceId); } Loading customer-service/src/main/java/cz/muni/fi/pa165/controller/PurchaseAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/PurchaseController.java +4 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ import java.util.List; @Tag(name = "Purchase API", description = "Provides API for creating purchases and creating invoices.") @RestController("/purchase") public class PurchaseAPI { public class PurchaseController { private final PurchaseFacade purchaseFacade; @Autowired public PurchaseAPI(PurchaseFacade purchaseFacade) { public PurchaseController(PurchaseFacade purchaseFacade) { this.purchaseFacade = purchaseFacade; } Loading @@ -35,7 +35,7 @@ public class PurchaseAPI { }) @PostMapping("/single") public PurchaseDTO purchaseWineBottle( @Parameter(description = "Wine bottle purchase") @RequestBody PurchaseDTO purchases @Parameter(description = "Wine bottle purchase data", required = true) @RequestBody PurchaseDTO purchases ) { return purchaseFacade.purchaseWineBottle(purchases); } Loading @@ -48,7 +48,7 @@ public class PurchaseAPI { }) @PostMapping("/multiple") public List<PurchaseDTO> purchaseMultipleWineBottles( @Parameter(description = "Wine bottle purchases") @RequestBody List<PurchaseDTO> purchases @Parameter(description = "Wine bottles purchase data") @RequestBody List<PurchaseDTO> purchases ) { return purchaseFacade.purchaseWineBottles(purchases); } Loading customer-service/src/main/java/cz/muni/fi/pa165/facade/FeedbackFacade.java +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ import java.util.List; public interface FeedbackFacade { FeedbackDTO findById(Long feedbackId); List<FeedbackDTO> findByCustomerId(Long customerId); List<FeedbackDTO> findByCustomerId(Long customerId, int page, int size); List<FeedbackDTO> findByWineId(Long wineId); List<FeedbackDTO> findByWineId(Long wineId, int page, int size); void createFeedback(FeedbackDTO feedbackDTO, Long customerId); Loading Loading
customer-service/src/main/java/cz/muni/fi/pa165/controller/CustomerAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/CustomerController.java +7 −4 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package cz.muni.fi.pa165.controller; import cz.muni.fi.pa165.facade.CustomerFacade; import cz.muni.fi.pa165.model.DTO.CustomerDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; Loading @@ -16,13 +17,13 @@ import org.springframework.web.bind.annotation.RestController; @Tag(name = "Customer API", description = "Provides API to create a customer.") @RestController("/customer") public class CustomerAPI { public class CustomerController { // Note: this might not be needed and might be a user api private final CustomerFacade customerFacade; @Autowired public CustomerAPI(CustomerFacade customerFacade) { public CustomerController(CustomerFacade customerFacade) { this.customerFacade = customerFacade; } Loading @@ -35,7 +36,7 @@ public class CustomerAPI { }) @PostMapping public void createCustomer( @RequestBody CustomerDTO customerDTO @Parameter(description = "Customer data", required = true) @RequestBody CustomerDTO customerDTO ) { customerFacade.createCustomer(customerDTO); } Loading @@ -48,7 +49,9 @@ public class CustomerAPI { content = @Content(mediaType = "application/json")), }) @GetMapping("/{customerId}") public CustomerDTO getCustomerById(@PathVariable Long customerId) { public CustomerDTO getCustomerById( @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId ) { return customerFacade.findCustomerById(customerId); } }
customer-service/src/main/java/cz/muni/fi/pa165/controller/FeedbackAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/FeedbackController.java +14 −10 Original line number Diff line number Diff line Loading @@ -22,12 +22,12 @@ import java.util.List; @Tag(name = "Feedback API", description = "Provides API for manipulating with feedbacks on wine bottles.") @RestController("/feedback") public class FeedbackAPI { public class FeedbackController { private final FeedbackFacade feedbackFacade; @Autowired public FeedbackAPI(FeedbackFacade feedbackFacade) { public FeedbackController(FeedbackFacade feedbackFacade) { this.feedbackFacade = feedbackFacade; } Loading @@ -41,7 +41,7 @@ public class FeedbackAPI { }) @GetMapping("/{feedbackId}") public FeedbackDTO getFeedbackById( @Parameter(description = "Feedback Id") @PathVariable Long feedbackId @Parameter(description = "Feedback ID", required = true) @PathVariable Long feedbackId ) { return feedbackFacade.findById(feedbackId); } Loading @@ -54,9 +54,11 @@ public class FeedbackAPI { }) @GetMapping("/customer") public List<FeedbackDTO> getFeedbackByCustomerId( @Parameter(description = "Customer Id") @RequestParam Long customerId @Parameter(description = "Customer ID", required = true) @RequestParam Long customerId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return feedbackFacade.findByCustomerId(customerId); return feedbackFacade.findByCustomerId(customerId, page, size); } @Operation(summary = "Get all feedbacks of a wine", description = "Return all feedbacks of a wine by wine Id") Loading @@ -67,9 +69,11 @@ public class FeedbackAPI { }) @GetMapping("/wine-bottle") public List<FeedbackDTO> getFeedbackByWineBottleId( @Parameter(description = "External id of wine") @RequestParam Long wineBottleId @Parameter(description = "External id of wine") @RequestParam Long wineBottleId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return feedbackFacade.findByWineId(wineBottleId); return feedbackFacade.findByWineId(wineBottleId, page, size); } @Operation(summary = "Create feedback", description = "Create feedback as a customer") Loading @@ -81,8 +85,8 @@ public class FeedbackAPI { }) @PostMapping("/{customerId}") public void createFeedback( @Parameter(description = "Customer Id") @PathVariable Long customerId, @Parameter(description = "Feedback to create") @RequestBody FeedbackDTO feedback @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId, @Parameter(description = "Feedback to create", required = true) @RequestBody FeedbackDTO feedback ) { feedbackFacade.createFeedback(feedback, customerId); } Loading @@ -97,7 +101,7 @@ public class FeedbackAPI { }) @PutMapping public FeedbackDTO updateFeedback( @Parameter(description = "Feedback data to update") @RequestBody FeedbackDTO feedback @Parameter(description = "Feedback data to update", required = true) @RequestBody FeedbackDTO feedback ) { return feedbackFacade.updateFeedback(feedback); } Loading
customer-service/src/main/java/cz/muni/fi/pa165/controller/InvoiceAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/InvoiceController.java +11 −8 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package cz.muni.fi.pa165.controller; import cz.muni.fi.pa165.facade.InvoiceFacade; import cz.muni.fi.pa165.model.DTO.InvoiceDTO; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; Loading @@ -19,12 +20,12 @@ import java.util.List; @Tag(name = "Invoice API", description = "Provides API for creating and displaying invoices.") @RestController("/invoice") public class InvoiceAPI { public class InvoiceController { private final InvoiceFacade invoiceFacade; @Autowired public InvoiceAPI(InvoiceFacade invoiceFacade) { public InvoiceController(InvoiceFacade invoiceFacade) { this.invoiceFacade = invoiceFacade; } Loading @@ -37,8 +38,8 @@ public class InvoiceAPI { }) @PostMapping("/create") public InvoiceDTO createInvoice( @RequestBody InvoiceDTO invoiceDTO, @RequestParam Long customerId @Parameter(description = "Invoice data", required = true) @RequestBody InvoiceDTO invoiceDTO, @Parameter(description = "Customer ID", required = true) @RequestParam Long customerId ) { return invoiceFacade.createInvoice(invoiceDTO, customerId); } Loading @@ -52,7 +53,7 @@ public class InvoiceAPI { }) @GetMapping("/{invoiceId}") public InvoiceDTO getInvoiceById( @PathVariable String invoiceId @Parameter(description = "Invoice ID", required = true) @PathVariable String invoiceId ) { return invoiceFacade.getInvoiceById(invoiceId); } Loading @@ -64,9 +65,11 @@ public class InvoiceAPI { }) @GetMapping("/customer/{customerId}") public List<InvoiceDTO> getInvoicesByCustomerId( @PathVariable Long customerId @Parameter(description = "Customer ID", required = true) @PathVariable Long customerId, @Parameter(description = "Page") @RequestParam(defaultValue = "0") int page, @Parameter(description = "Size") @RequestParam(defaultValue = "10") int size ) { return invoiceFacade.getInvoicesByCustomerId(customerId); return invoiceFacade.getInvoicesByCustomerId(customerId, page, size); } @ApiResponses(value = { Loading @@ -78,7 +81,7 @@ public class InvoiceAPI { }) @GetMapping("/document/{invoiceId}") public byte[] generateInvoiceDocument( @PathVariable String invoiceId @Parameter(description = "Invoice ID", required = true) @PathVariable String invoiceId ) { return invoiceFacade.generateInvoiceDocument(invoiceId); } Loading
customer-service/src/main/java/cz/muni/fi/pa165/controller/PurchaseAPI.java→customer-service/src/main/java/cz/muni/fi/pa165/controller/PurchaseController.java +4 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ import java.util.List; @Tag(name = "Purchase API", description = "Provides API for creating purchases and creating invoices.") @RestController("/purchase") public class PurchaseAPI { public class PurchaseController { private final PurchaseFacade purchaseFacade; @Autowired public PurchaseAPI(PurchaseFacade purchaseFacade) { public PurchaseController(PurchaseFacade purchaseFacade) { this.purchaseFacade = purchaseFacade; } Loading @@ -35,7 +35,7 @@ public class PurchaseAPI { }) @PostMapping("/single") public PurchaseDTO purchaseWineBottle( @Parameter(description = "Wine bottle purchase") @RequestBody PurchaseDTO purchases @Parameter(description = "Wine bottle purchase data", required = true) @RequestBody PurchaseDTO purchases ) { return purchaseFacade.purchaseWineBottle(purchases); } Loading @@ -48,7 +48,7 @@ public class PurchaseAPI { }) @PostMapping("/multiple") public List<PurchaseDTO> purchaseMultipleWineBottles( @Parameter(description = "Wine bottle purchases") @RequestBody List<PurchaseDTO> purchases @Parameter(description = "Wine bottles purchase data") @RequestBody List<PurchaseDTO> purchases ) { return purchaseFacade.purchaseWineBottles(purchases); } Loading
customer-service/src/main/java/cz/muni/fi/pa165/facade/FeedbackFacade.java +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ import java.util.List; public interface FeedbackFacade { FeedbackDTO findById(Long feedbackId); List<FeedbackDTO> findByCustomerId(Long customerId); List<FeedbackDTO> findByCustomerId(Long customerId, int page, int size); List<FeedbackDTO> findByWineId(Long wineId); List<FeedbackDTO> findByWineId(Long wineId, int page, int size); void createFeedback(FeedbackDTO feedbackDTO, Long customerId); Loading