-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pieter Van Eeckhout
committed
Aug 29, 2023
1 parent
fd1cfec
commit 4ce3f74
Showing
22 changed files
with
416 additions
and
55 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
22 changes: 22 additions & 0 deletions
22
...ule/src/main/java/io/edpn/backend/trade/adapter/persistence/filter/MybatisPageFilter.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 io.edpn.backend.trade.adapter.persistence.filter; | ||
|
||
import io.edpn.backend.trade.application.dto.persistence.filter.PersistencePageFilter; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
@EqualsAndHashCode | ||
public class MybatisPageFilter implements PersistencePageFilter { | ||
private int size; | ||
private int page; | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...n/backend/trade/adapter/persistence/filter/mapper/MybatisPersistencePageFilterMapper.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,16 @@ | ||
package io.edpn.backend.trade.adapter.persistence.filter.mapper; | ||
|
||
import io.edpn.backend.trade.adapter.persistence.filter.MybatisPageFilter; | ||
import io.edpn.backend.trade.application.domain.filter.PageFilter; | ||
import io.edpn.backend.trade.application.dto.persistence.filter.PersistencePageFilter; | ||
import io.edpn.backend.trade.application.dto.persistence.filter.mapper.PersistencePageFilterMapper; | ||
|
||
public class MybatisPersistencePageFilterMapper implements PersistencePageFilterMapper { | ||
@Override | ||
public PersistencePageFilter map(PageFilter pageFilter) { | ||
return MybatisPageFilter.builder() | ||
.size(pageFilter.getSize()) | ||
.page(pageFilter.getPage()) | ||
.build(); | ||
} | ||
} |
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
...-module/src/main/java/io/edpn/backend/trade/adapter/web/dto/filter/RestPageFilterDto.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 io.edpn.backend.trade.adapter.web.dto.filter; | ||
|
||
import io.edpn.backend.trade.application.dto.web.filter.PageFilterDto; | ||
|
||
public record RestPageFilterDto( | ||
int size, | ||
int page | ||
) implements PageFilterDto { | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...ain/java/io/edpn/backend/trade/adapter/web/dto/filter/mapper/RestPageFilterDtoMapper.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,31 @@ | ||
package io.edpn.backend.trade.adapter.web.dto.filter.mapper; | ||
|
||
import io.edpn.backend.trade.application.domain.filter.PageFilter; | ||
import io.edpn.backend.trade.application.dto.web.filter.PageFilterDto; | ||
import io.edpn.backend.trade.application.dto.web.filter.mapper.PageFilterDtoMapper; | ||
|
||
public class RestPageFilterDtoMapper implements PageFilterDtoMapper { | ||
@Override | ||
public PageFilter map(PageFilterDto pageFilterDto) { | ||
PageFilter.PageFilterBuilder bulder = getDefaultFilterBuilder(); | ||
if (pageFilterDto.size() > 0) { | ||
bulder.size(pageFilterDto.size()); | ||
} | ||
if (pageFilterDto.page() >= 0) { | ||
bulder.page(pageFilterDto.page()); | ||
} | ||
return bulder.build(); | ||
} | ||
|
||
@Override | ||
public PageFilter getDefaultFilter() { | ||
return getDefaultFilterBuilder() | ||
.build(); | ||
} | ||
|
||
private PageFilter.PageFilterBuilder getDefaultFilterBuilder() { | ||
return PageFilter.builder() | ||
.size(20) //TODO get from config | ||
.page(0); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
trade-module/src/main/java/io/edpn/backend/trade/application/domain/filter/PageFilter.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,18 @@ | ||
package io.edpn.backend.trade.application.domain.filter; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@AllArgsConstructor | ||
@Builder | ||
public class PageFilter { | ||
private int size; | ||
|
||
private int page; | ||
} |
7 changes: 7 additions & 0 deletions
7
.../java/io/edpn/backend/trade/application/dto/persistence/filter/PersistencePageFilter.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,7 @@ | ||
package io.edpn.backend.trade.application.dto.persistence.filter; | ||
|
||
public interface PersistencePageFilter { | ||
|
||
int getSize(); | ||
int getPage(); | ||
} |
9 changes: 9 additions & 0 deletions
9
.../backend/trade/application/dto/persistence/filter/mapper/PersistencePageFilterMapper.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 io.edpn.backend.trade.application.dto.persistence.filter.mapper; | ||
|
||
import io.edpn.backend.trade.application.domain.filter.PageFilter; | ||
import io.edpn.backend.trade.application.dto.persistence.filter.PersistencePageFilter; | ||
|
||
public interface PersistencePageFilterMapper { | ||
|
||
PersistencePageFilter map(PageFilter pageFilter); | ||
} |
Oops, something went wrong.