-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,309 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This workflow will triage pull requests and apply a label based on the | ||
# paths that are modified in the pull request. | ||
# | ||
# To use this workflow, you will need to set up a .github/labeler.yml | ||
# file with configuration. For more information, see: | ||
# https://github.com/actions/labeler | ||
|
||
name: Labeler | ||
on: [pull_request_target] | ||
|
||
jobs: | ||
label: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" |
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,14 @@ | ||
name: running test with github actions | ||
on: pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: run unit tests on java 17 | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: setup java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
- run: gradle test -p backend/app/ |
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,6 +1,3 @@ | ||
# UGent-6 | ||
|
||
|
||
WIP (ik ga korte uitleg schrijven hoe je dit lokaal kan opzetten) | ||
# dependencies | ||
docker compose | ||
https://github.com/SELab-2/UGent-6/wiki |
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
4 changes: 4 additions & 0 deletions
4
backend/app/src/main/java/com/ugent/pidgeon/controllers/AuthTestController.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
55 changes: 55 additions & 0 deletions
55
backend/app/src/main/java/com/ugent/pidgeon/controllers/JpaCourseController.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,55 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.postgre.models.CourseEntity; | ||
import com.ugent.pidgeon.postgre.models.GroupClusterEntity; | ||
import com.ugent.pidgeon.postgre.models.ProjectEntity; | ||
import com.ugent.pidgeon.postgre.models.UserEntity; | ||
import com.ugent.pidgeon.postgre.repository.CourseRepository; | ||
import com.ugent.pidgeon.postgre.repository.GroupClusterRepository; | ||
import com.ugent.pidgeon.postgre.repository.ProjectRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
public class JpaCourseController { | ||
@Autowired | ||
private CourseRepository courseRepository; | ||
|
||
@Autowired | ||
private GroupClusterRepository groupClusterRepository; | ||
|
||
@Autowired | ||
private ProjectRepository projectRepository; | ||
|
||
@GetMapping("/api/courses") | ||
public String getCourses() { | ||
StringBuilder res = new StringBuilder(); | ||
for (CourseEntity course : courseRepository.findAll()) { | ||
res.append(course.getName()).append(" with users: "); | ||
for (CourseRepository.UserWithRelation user : courseRepository.findUsersByCourseId(course.getId())) { | ||
UserEntity userEntity = user.getUser(); | ||
String relation = user.getRelation(); | ||
res.append(userEntity.getName()).append("(").append(relation).append("), "); | ||
} | ||
res.append("- with group clusters:"); | ||
for (GroupClusterEntity groupcluster: groupClusterRepository.findByCourseId(course.getId())) { | ||
res.append(groupcluster.getName()).append(" (").append(groupcluster.getGroupAmount()).append("), "); | ||
} | ||
res.append("- with projects:"); | ||
for (ProjectEntity project: projectRepository.findByCourseId(course.getId())) { | ||
res.append(project.getName()).append(", "); | ||
} | ||
res.append("|\n"); | ||
} | ||
|
||
return res.toString(); | ||
} | ||
|
||
// @GetMapping("/api/course") | ||
// public String addCourse(String name, String description) { | ||
// CourseEntity course = new CourseEntity("test", "added to test creating with contstructing"); | ||
// course.setId(1); | ||
// courseRepository.save(course); | ||
// return "Course added"; | ||
// } | ||
} |
55 changes: 55 additions & 0 deletions
55
backend/app/src/main/java/com/ugent/pidgeon/controllers/JpaGroupController.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,55 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.postgre.models.GroupEntity; | ||
import com.ugent.pidgeon.postgre.models.GroupFeedbackEntity; | ||
import com.ugent.pidgeon.postgre.models.SubmissionEntity; | ||
import com.ugent.pidgeon.postgre.models.UserEntity; | ||
import com.ugent.pidgeon.postgre.repository.GroupFeedbackRepository; | ||
import com.ugent.pidgeon.postgre.repository.GroupRepository; | ||
import com.ugent.pidgeon.postgre.repository.SubmissionRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@RestController | ||
public class JpaGroupController { | ||
|
||
@Autowired | ||
private GroupRepository groupRepository; | ||
|
||
@Autowired | ||
private GroupFeedbackRepository groupFeedbackRepository; | ||
|
||
@Autowired | ||
SubmissionRepository submissionRepository; | ||
|
||
@GetMapping("/api/groups") | ||
public List<String> getGroups() { | ||
List<String> res = new ArrayList<>(); | ||
for (GroupEntity group : groupRepository.findAll()) { | ||
StringBuilder groupString = new StringBuilder(); | ||
groupString.append(group.getName()).append("-with users: "); | ||
for (UserEntity user : groupRepository.findCourseUsersByGroupId(group.getId())) { | ||
groupString.append(user.getName()).append(", "); | ||
} | ||
List<Long> projectIds = groupRepository.findProjectsByGroupId(group.getId()); | ||
groupString.append("-with grades: "); | ||
for (long projectId : projectIds) { | ||
GroupFeedbackEntity feedback = groupFeedbackRepository.findByGroupIdAndProjectId(group.getId(), projectId); | ||
groupString.append(feedback.getGrade()).append(", "); | ||
} | ||
groupString.append("-with submissions: "); | ||
for (long projectId : projectIds) { | ||
for (SubmissionEntity submission : submissionRepository.findByGroupIdAndProjectId(group.getId(), projectId)) { | ||
groupString.append(submission.getSubmissionTime()).append(", "); | ||
} | ||
} | ||
groupString.append("|"); | ||
res.add(groupString.toString()); | ||
} | ||
return res; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
backend/app/src/main/java/com/ugent/pidgeon/controllers/JpaProjectController.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,39 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.postgre.models.DeadlineEntity; | ||
import com.ugent.pidgeon.postgre.models.ProjectEntity; | ||
import com.ugent.pidgeon.postgre.models.TestEntity; | ||
import com.ugent.pidgeon.postgre.repository.ProjectRepository; | ||
import com.ugent.pidgeon.postgre.repository.TestRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@RestController | ||
public class JpaProjectController { | ||
@Autowired | ||
private ProjectRepository projectRepository; | ||
|
||
@Autowired | ||
private TestRepository testRepository; | ||
|
||
@GetMapping("/api/projects") | ||
public List<String> getProjects() { | ||
List<String> res = new ArrayList<>(); | ||
for (ProjectEntity project : projectRepository.findAll()) { | ||
StringBuilder projectString = new StringBuilder(project.getName()); | ||
Optional<TestEntity> test = testRepository.findById(project.getId()); | ||
test.ifPresent(testEntity -> projectString.append(" with test: ").append(testEntity.getId())); | ||
projectString.append(" with deadlines: "); | ||
for (DeadlineEntity deadline : project.getDeadlines()) { | ||
projectString.append(deadline.getDeadline()); | ||
} | ||
res.add(projectString.toString()); | ||
} | ||
return res; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
backend/app/src/main/java/com/ugent/pidgeon/controllers/JpaSubmissionController.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,38 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.postgre.models.FileEntity; | ||
import com.ugent.pidgeon.postgre.models.SubmissionEntity; | ||
import com.ugent.pidgeon.postgre.repository.FileRepository; | ||
import com.ugent.pidgeon.postgre.repository.SubmissionRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@RestController | ||
public class JpaSubmissionController { | ||
@Autowired | ||
private SubmissionRepository submissionRepository; | ||
|
||
@Autowired | ||
private FileRepository fileRepository; | ||
|
||
@GetMapping("/api/submissions") | ||
public List<String> getSubmissions() { | ||
List<String> res = new ArrayList<>(); | ||
for (SubmissionEntity submission : submissionRepository.findAll()) { | ||
StringBuilder submissionString = new StringBuilder(); | ||
submissionString.append(submission.getSubmissionTime()).append(" with files: "); | ||
Optional<FileEntity> file = fileRepository.findById(submission.getFileId()); | ||
file.ifPresent(fileEntity -> submissionString.append(fileEntity.getName()).append(", ")); | ||
|
||
submissionString.append("|"); | ||
res.add(submissionString.toString()); | ||
} | ||
return res; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
backend/app/src/main/java/com/ugent/pidgeon/controllers/JpaUserController.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,34 @@ | ||
package com.ugent.pidgeon.controllers; | ||
|
||
import com.ugent.pidgeon.postgre.models.CourseEntity; | ||
import com.ugent.pidgeon.postgre.models.types.CourseRelation; | ||
import com.ugent.pidgeon.postgre.models.UserEntity; | ||
import com.ugent.pidgeon.postgre.repository.UserRepository; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class JpaUserController { | ||
@Autowired | ||
private UserRepository userRepository; | ||
|
||
Logger logger = LoggerFactory.getLogger(JpaUserController.class); | ||
@GetMapping("/api/users") | ||
public String getUsers() { | ||
StringBuilder res = new StringBuilder(); | ||
for (UserEntity user : userRepository.findAll()) { | ||
res.append(user.getName()).append("(").append(user.getRole().toString()).append(") in courses: "); | ||
for (UserRepository.CourseWithRelation course : userRepository.findCoursesByUserId(user.getId())) { | ||
CourseEntity courseEntity = course.getCourse(); | ||
CourseRelation courseRelation = course.getRelation(); | ||
res.append(courseEntity.getName()).append("(").append(courseRelation.toString()).append("), "); | ||
} | ||
res.append("\n"); | ||
} | ||
|
||
return res.toString(); | ||
} | ||
} |
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
Oops, something went wrong.