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
feature/advertisement_history #70
Conversation
MateuszBednarczyk
commented
Sep 12, 2022
- 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
src/main/java/pl/simpleascoding/tutoringplatform/domain/advertisement/Advertisement.java
Show resolved
Hide resolved
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); |
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.
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
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.
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.