This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from 7SOATSquad30/feature/use-cases
refactor: feature/use-cases
- Loading branch information
Showing
16 changed files
with
227 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/br/com/fiap/grupo30/fastfood/adapters/in/rest/exceptions/FieldMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package br.com.fiap.grupo30.fastfood.adapters.in.rest.exceptions; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class FieldMessage { | ||
private String fieldName; | ||
private String message; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/br/com/fiap/grupo30/fastfood/adapters/in/rest/exceptions/ValidationError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package br.com.fiap.grupo30.fastfood.adapters.in.rest.exceptions; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ValidationError extends StandardError { | ||
private final List<FieldMessage> errors = new ArrayList<>(); | ||
|
||
public void addError(String fieldName, String message) { | ||
errors.add(new FieldMessage(fieldName, message)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/br/com/fiap/grupo30/fastfood/application/useCases/CategoryUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package br.com.fiap.grupo30.fastfood.application.useCases; | ||
|
||
import br.com.fiap.grupo30.fastfood.application.dto.CategoryDTO; | ||
import java.util.List; | ||
|
||
public interface CategoryUseCase { | ||
|
||
List<CategoryDTO> findProducts(); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/br/com/fiap/grupo30/fastfood/application/useCases/CustomerUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package br.com.fiap.grupo30.fastfood.application.useCases; | ||
|
||
import br.com.fiap.grupo30.fastfood.application.dto.CustomerDTO; | ||
|
||
public interface CustomerUseCase { | ||
|
||
CustomerDTO findCustomerByCpf(String cpf); | ||
|
||
CustomerDTO createCustomer(CustomerDTO dto); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/br/com/fiap/grupo30/fastfood/application/useCases/ProductUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package br.com.fiap.grupo30.fastfood.application.useCases; | ||
|
||
import br.com.fiap.grupo30.fastfood.application.dto.ProductDTO; | ||
import java.util.List; | ||
|
||
public interface ProductUseCase { | ||
|
||
List<ProductDTO> findProductsByCategoryId(Long categoryId); | ||
|
||
ProductDTO findProductById(Long id); | ||
|
||
ProductDTO createProduct(ProductDTO productDTO); | ||
|
||
ProductDTO updateProduct(Long id, ProductDTO dto); | ||
|
||
void deleteProduct(Long id); | ||
} |
22 changes: 22 additions & 0 deletions
22
...main/java/br/com/fiap/grupo30/fastfood/application/useCases/impl/CategoryUseCaseImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package br.com.fiap.grupo30.fastfood.application.useCases.impl; | ||
|
||
import br.com.fiap.grupo30.fastfood.application.dto.CategoryDTO; | ||
import br.com.fiap.grupo30.fastfood.application.services.CategoryService; | ||
import br.com.fiap.grupo30.fastfood.application.useCases.CategoryUseCase; | ||
import java.util.List; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class CategoryUseCaseImpl implements CategoryUseCase { | ||
|
||
private final CategoryService categoryService; | ||
|
||
public CategoryUseCaseImpl(CategoryService categoryService) { | ||
this.categoryService = categoryService; | ||
} | ||
|
||
@Override | ||
public List<CategoryDTO> findProducts() { | ||
return categoryService.findAll(); | ||
} | ||
} |
Oops, something went wrong.