-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#103 - adding pagination #104
base: development
Are you sure you want to change the base?
#103 - adding pagination #104
Conversation
return taskExecutor; | ||
@Bean(name = "explorationForkJoinPool") | ||
public ForkJoinPool forkJoinPool() { | ||
return new ForkJoinPool(50); // todo set from config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number and a TODO tag, should we not have these summarised in some issue? Maybe deal with it all under one issue?
Ideally, should be configurable.
import io.edpn.backend.trade.application.dto.persistence.entity.PersistencePageInfo; | ||
import io.edpn.backend.trade.application.dto.persistence.entity.mapper.PersistencePageInfoMapper; | ||
|
||
public class MybatisPageInfoMapper implements PersistencePageInfoMapper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing in this class is specific to Trade, but could be useful for other modules... perhaps we should consider adding a "common" module for things like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would mean breaking changes for all modules, one change in will ripple to all. the modules are not versioned independently in the modulith
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would mean breaking changes for all modules, one change in will ripple to all. the modules are not versioned independently in the modulith
Well, is there something keeping us from versioning them independently?
require_odyssey, | ||
fleet_carrier | ||
FROM filtered_lcv | ||
WHERE 1 = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have WHERE 1=1
- not critical though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it is needed, all following AND clauses can be filtered out and we need one initial where otherwise there is a syntax error
|
||
private PageFilter.PageFilterBuilder getDefaultFilterBuilder() { | ||
return PageFilter.builder() | ||
.size(20) //TODO get from config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number again that should be configurable as a defaultPageSize
etc.
…tion-to-locate-commodityfilter-endpoint
…tion-to-locate-commodityfilter-endpoint
@@ -228,7 +230,7 @@ public RequestMissingSystemCoordinatesService requestMissingSystemCoordinatesUse | |||
CreateSystemCoordinateRequestPort createSystemCoordinateRequestPort, | |||
SendKafkaMessagePort sendKafkaMessagePort, | |||
@Qualifier("tradeRetryTemplate") RetryTemplate retryTemplate, | |||
@Qualifier("tradeThreadPoolTaskExecutor") Executor executor, | |||
@Qualifier("tradeForkJoinPool") Executor executor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant comment the line apparently, line 246 for tradeRequestMissingStationRequireOdysseyUseCase bean has an invalid executor qualifier now. Revise
Long minSupply, | ||
Long minDemand) implements LocateCommodityFilterDto { | ||
Long minDemand, | ||
RestPageFilterDto page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently does not work. Im not sure if we can fix this with @Jacksonized. But with a corrected http request this throws mapping errors. Consider flattening and converting to a domain object via mapper, or investigate a way to make this work with a get request
|
||
@GetMapping("/locate-commodity/filter") | ||
public List<RestLocateCommodityDto> locateCommodityWithFilters(RestLocateCommodityFilterDto locateCommodityFilterDto){ | ||
@ApiResponses({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endpoint does not work. [] do not encode properly in tomcat 8.5+, http encrypts [ = %5B and ] = %5D
Find a way to fix if we are going to maintain this structure for the endpoint. This is potentially a problem on the swagger side, but requires a bit more digging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit at a loss about where enum
s, record
s and such can or cannot be used and why. Doesn't seem very consistent to me. 😕
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
@EqualsAndHashCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As much as I hate writing boilerplate, this sort of ADD (not attention deficit disorder, Annotation Driven Development!) makes me cringe, too. IIRC, we have some limitations wrt. using records, but do they apply here?
OFFSET (#{page.size} * #{page.page}) | ||
</if> | ||
</script> | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't get why annotations with embedded scripting generating SQL would be a good idea. Personally, would choose a type-safe programmatic approach any given day. JOOQ or QueryDSL or something.
Please, at least tell me the validity and correctness of the scripts are checked at compile time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disclaimer: I don't have any prior experience on MyBatis. In fact, been trying to read up on it, but their own documentation seems a bit... thin. Could use a few pointers or a reading list.
|
||
private static LandingPadSize getShipSize(LocateCommodityFilterDto locateCommodityFilterDto) { | ||
return Optional.ofNullable(locateCommodityFilterDto.shipSize()) | ||
.map(LandingPadSize::valueOf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the enum is being converted back and forth - I'm guessing enum is not an option for DTOs because reasons?
@ToString | ||
@AllArgsConstructor | ||
@Builder | ||
public class PageInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guessing this could be a record, since PagedResult
right next door is...
Double yCoordinate(); | ||
|
||
|
||
Double zCoordinate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW do X, Y and Z coordinates make much sense independently? If not, shouldn't we have a Coordinates
object instead?
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
@ExtendWith(MockitoExtension.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like MockitoExtension
isn't really used here?
closes #103