Skip to content
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

feature/advertisement_history #70

Conversation

MateuszBednarczyk
Copy link
Contributor

  • created getUsersAdvertisements method in controller
  • created findAllByAuthor_Name method in repository
  • created getUsersAdvertisements method and it's implementation

- created findAllByAuthor_Name method in repository
- created getUsersAdvertisements method and it's implementation
- edited finding for users advertisements method, to order by creationDate
- edited createAdvertisementEntity method
import org.springframework.data.jpa.repository.JpaRepository;
import pl.simpleascoding.tutoringplatform.domain.advertisement.Advertisement;

public interface AdvertisementRepository extends JpaRepository<Advertisement, Long> {
Page<Advertisement> findAllByAuthor_NameOrderByCreationDateDesc(String username, Pageable pageable);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add @PageableDefault or @SortDefault annotation to your controller method instead of a long JPA method name, but it's a valid approach and you don't need to change it if you don't want to.
Info about these annotations

Copy link
Contributor

@Eukon05 Eukon05 left a comment

Choose a reason for hiding this comment

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

Everything looks good to me, except for the endpoint path advertisement/history/{username} (but it's because I'm used to a different style of REST paths).
We should decide on Discord on how we should name our endpoints (so that we maintain consistency throughout the entire api), but there are no other issues that I could find.
I approve.

@dawciobiel dawciobiel merged commit 385b50a into Simple-as-Coding:main Sep 24, 2022
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.

None yet

3 participants