-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from bounswe/backend/feature/598-backend-retr…
…ieve-questions-and-answers-in-user-profile Get Questions and Answers for UserProfile
- Loading branch information
Showing
8 changed files
with
106 additions
and
5 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
31 changes: 31 additions & 0 deletions
31
...main/java/com/group1/programminglanguagesforum/DTOs/Responses/GetAnswerDtoForProfile.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 com.group1.programminglanguagesforum.DTOs.Responses; | ||
|
||
import lombok.*; | ||
|
||
@Builder | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class GetAnswerDtoForProfile { | ||
private Long id; | ||
private String content; | ||
private AuthorDto author; | ||
private String createdAt; | ||
private String updatedAt; | ||
private Long upvoteCount; | ||
private Long downvoteCount; | ||
private boolean selfAnswer; | ||
private Integer selfVoted; | ||
@Builder | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class QuesitonInfoForAnswer { | ||
private Long id; | ||
private String title; | ||
} | ||
private QuesitonInfoForAnswer question; | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
...end/src/main/java/com/group1/programminglanguagesforum/Repositories/AnswerRepository.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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
package com.group1.programminglanguagesforum.Repositories; | ||
|
||
import com.group1.programminglanguagesforum.Entities.Answer; | ||
import com.group1.programminglanguagesforum.Entities.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface AnswerRepository extends JpaRepository<Answer,Long> { | ||
|
||
@Query("SELECT a FROM Answer a WHERE a.answeredBy.id = :userId") | ||
List<Answer> findByAnsweredBy(Long userId); | ||
} |
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