Skip to content

OBPIH-6015 Endpoint to fetch product sources data with filters, pagination, sorting (post-code review fixes)#4457

Merged
awalkowiak merged 7 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6015-fix
Jan 18, 2024
Merged

OBPIH-6015 Endpoint to fetch product sources data with filters, pagination, sorting (post-code review fixes)#4457
awalkowiak merged 7 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6015-fix

Conversation

@kchelstowski
Copy link
Collaborator

Implemented @jmiranda 's suggestions from the PR: #4435

  • I've reverted DTO pattern and used default Map toJson()
  • I've moved sorting logic to a separate method - this was not that straightforward, because there is no static method to use to add the order to the criteria, hence I needed to somehow pass the criteria to the method - it was possible thanks to the delegate property.
  • renamed the eachPrice to unitPrice

QA fixes:

  • I've removed the default values for pagination params, because Katarzyna suggested that if we didn't provide any pagination params, we should be getting all product sources.

Improvements that were forgotten previously:

  • added a link to stock card from product name column (needed to add productId property to the dto).

@kchelstowski kchelstowski self-assigned this Jan 16, 2024
@kchelstowski kchelstowski added warn: do not merge Marks a pull request that is not yet ready to be merged and removed warn: do not merge Marks a pull request that is not yet ready to be merged labels Jan 16, 2024
List<ProductSupplierListDto> productSuppliers = productSupplierService.getProductSuppliers(filterParams)
render([data: productSuppliers, totalCount: productSuppliers.totalCount] as JSON)
List<ProductSupplier> productSuppliers = productSupplierService.getProductSuppliers(filterParams)
render([data: productSuppliers.collect { it.toJson() }, totalCount: productSuppliers.totalCount] as JSON)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can define a Marshaler for ProductSupplier and avoid doing this collect{ it.toJson() }

I remember we were talking about it not too long ago but I am not sure if we want to move away from Marshalers and toJson() or are we still doing it?
Also made a discussion #4427 that I wanted to bring up on one of the tech-huddles but was never able to cause we had more important things to discuss.

So I would add the Marshaler for now, unless there are counterarguments to it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmiranda wanted me to revert my convention with the dto pattern and do it .toJson() way.

I remember we were talking about it not too long ago but I am not sure if we want to move away from Marshalers and toJson() or are we still doing it?
@jmiranda said he would eventually like to get rid of the marshallers.

I'm also against them, because by doing it .toJson() way, you immediately can see what will be returned, while with marshallers you can see in the method something like return productSuppliers which is List<ProductSupplier> and in the response you suddenly see some other dto.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it

Comment on lines +5 to +7
Integer offset

Integer max = 10
Integer max
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably I missed some part of the discussion about it, but what was the reason for deleting the default value of those fields?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alannadolny
description:

QA fixes:

I've removed the default values for pagination params, because Katarzyna suggested that if we didn't provide any pagination params, we should be getting all product sources.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, right

@awalkowiak
Copy link
Collaborator

@kchelstowski please fix the conflict

@awalkowiak awalkowiak merged commit d4c7ea4 into feature/product-supplier-list-redesign Jan 18, 2024
@awalkowiak awalkowiak deleted the OBPIH-6015-fix branch January 18, 2024 18:26
awalkowiak pushed a commit that referenced this pull request Mar 12, 2024
…ation, sorting (post-code review fixes) (#4457)

* OBPIH-6015 Revert DTO classes and use default Map toJson()

* OBPIH-6015 Move sorting logic to a separate method

* OBPIH-6015 Make the product name column a link that redirects to the stock card page

* OBPIH-6015 Remove default settings for offset and max pagination params

* OBPIH-6015 Include more fields for search field filter on product sources list

* OBPIH-6015 Fix supplier code column and preference type column to display name instead of id of the preference type

* OBPIH-6015 fix conflicts and eslint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants