Skip to content

Commit

Permalink
Move Service to domain layer (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
hdescottes authored Jun 7, 2024
1 parent b6dc6f4 commit 65ebcca
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.appplication.stock;
package com.project.reactdashboard.application.stock;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.appplication.stock;
package com.project.reactdashboard.application.stock;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;

import java.time.OffsetDateTime;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.appplication.stock.mapper;
package com.project.reactdashboard.application.stock.mapper;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.controllers.StockDto;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.reactdashboard.appplication.stock.model;
package com.project.reactdashboard.application.stock.model;

import java.io.Serializable;
import java.time.OffsetDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.reactdashboard.appplication.stock.model;
package com.project.reactdashboard.application.stock.model;

public class SymbolValuesApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.project.reactdashboard.configuration;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

@Configuration
@ComponentScan(
basePackages = {"com.project.reactdashboard.domain.stock"},
includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {UseCase.class})})
public class StockMarketConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.project.reactdashboard.configuration;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface UseCase {
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.project.reactdashboard.appplication.stock;
package com.project.reactdashboard.domain.stock;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import org.springframework.stereotype.Service;
import com.project.reactdashboard.application.stock.StockApi;
import com.project.reactdashboard.application.stock.StockSpi;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.configuration.UseCase;

import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.List;

import static com.project.reactdashboard.domain.stock.Date.lastWorkingDay;

@Service
@UseCase
public class StockService implements StockApi {

private final StockSpi stockSpi;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.project.reactdashboard.infrastructure.stock.controllers;

import com.project.reactdashboard.appplication.stock.StockApi;
import com.project.reactdashboard.appplication.stock.mapper.StockApplicationMapper;
import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.StockApi;
import com.project.reactdashboard.application.stock.mapper.StockApplicationMapper;
import com.project.reactdashboard.application.stock.model.StockApplication;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.project.reactdashboard.infrastructure.stock.persistence;

import com.project.reactdashboard.appplication.stock.StockSpi;
import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.StockSpi;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.mapper.StockMapper;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.Stock;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.infrastructure.stock.persistence.mapper;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.Stock;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.infrastructure.stock.persistence.mapper;

import com.project.reactdashboard.appplication.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.application.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.SymbolValues;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.project.reactdashboard;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.controllers.StockDto;
import com.project.reactdashboard.appplication.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.application.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.Stock;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.SymbolValues;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.project.reactdashboard.appplication.stock.mapper;
package com.project.reactdashboard.application.stock.mapper;

import com.project.reactdashboard.appplication.stock.mapper.StockApplicationMapper;
import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.controllers.StockDto;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.project.reactdashboard.appplication.stock;
package com.project.reactdashboard.domain.stock;

import com.project.reactdashboard.appplication.stock.StockService;
import com.project.reactdashboard.appplication.stock.StockSpi;
import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.StockSpi;
import com.project.reactdashboard.application.stock.model.StockApplication;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.project.reactdashboard.appplication.stock.StockApi;
import com.project.reactdashboard.appplication.stock.mapper.StockApplicationMapper;
import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.controllers.StockController;
import com.project.reactdashboard.infrastructure.stock.controllers.StockDto;
import com.project.reactdashboard.application.stock.StockApi;
import com.project.reactdashboard.application.stock.mapper.StockApplicationMapper;
import com.project.reactdashboard.application.stock.model.StockApplication;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.reactdashboard.infrastructure.stock.persistence;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.mapper.StockMapper;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.Stock;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.project.reactdashboard.infrastructure.stock.persistence.mapper;

import com.project.reactdashboard.appplication.stock.model.StockApplication;
import com.project.reactdashboard.application.stock.model.StockApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.Stock;
import com.project.reactdashboard.infrastructure.stock.persistence.mapper.StockMapper;
import com.project.reactdashboard.infrastructure.stock.persistence.mapper.SymbolValuesMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.project.reactdashboard.infrastructure.stock.persistence.mapper;

import com.project.reactdashboard.appplication.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.application.stock.model.SymbolValuesApplication;
import com.project.reactdashboard.infrastructure.stock.persistence.entities.SymbolValues;
import com.project.reactdashboard.infrastructure.stock.persistence.mapper.SymbolValuesMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down

0 comments on commit 65ebcca

Please sign in to comment.