@@ -27,8 +27,10 @@ public class TeacherController {
2727
2828
2929 /**
30- * Get all students in Group from database
30+ * Get all students in group from database
31+ * Needs group name
3132 *
33+ * @param json
3234 * @return
3335 */
3436 @ PreAuthorize ("hasAuthority('TEACHER')" )
@@ -40,6 +42,13 @@ public ResponseEntity<?> getAllStudents(@RequestBody String json) {
4042 return new ResponseEntity <>(HttpStatus .OK );
4143 }
4244
45+ /**
46+ * Create a new group
47+ * Needs group name
48+ *
49+ * @param json
50+ * @return
51+ */
4352 @ PreAuthorize ("hasAuthority('TEACHER')" )
4453 @ PutMapping ("/createGroup" )
4554 @ ResponseBody
@@ -48,6 +57,13 @@ public ResponseEntity<?> createGroup(@RequestBody String json) {
4857 return new ResponseEntity <>(HttpStatus .OK );
4958 }
5059
60+ /**
61+ * Deletes a existing group
62+ * Needs group name
63+ *
64+ * @param json
65+ * @return
66+ */
5167 @ PreAuthorize ("hasAuthority('TEACHER')" )
5268 @ DeleteMapping ("/deleteGroup" )
5369 @ ResponseBody
@@ -56,6 +72,13 @@ public ResponseEntity<?> deleteGroup(@RequestBody String json) {
5672 return new ResponseEntity <>(HttpStatus .OK );
5773 }
5874
75+ /**
76+ * Adds student to existing group
77+ * Needs group name + student name
78+ *
79+ * @param json
80+ * @return
81+ */
5982 @ PreAuthorize ("hasAuthority('TEACHER')" )
6083 @ PostMapping ("/addStudentGroup" )
6184 @ ResponseBody
@@ -64,14 +87,28 @@ public ResponseEntity<?> addStudentGroup(@RequestBody String json) {
6487 return new ResponseEntity <>(HttpStatus .OK );
6588 }
6689
90+ /**
91+ * Removes student from group
92+ * Needs group name + student name
93+ *
94+ * @param json
95+ * @return
96+ */
6797 @ PreAuthorize ("hasAuthority('TEACHER')" )
6898 @ DeleteMapping ("/removeStudentGroup" )
6999 @ ResponseBody
70100 public ResponseEntity <?> removeStudentGroup (@ RequestBody String json ) {
71101 // TODO: removing students from Group
72102 return new ResponseEntity <>(HttpStatus .OK );
73103 }
74-
104+
105+ /**
106+ * Creates a new exercise in a existing group
107+ * Needs group name + exercise object
108+ *
109+ * @param json
110+ * @return
111+ */
75112 @ PreAuthorize ("hasAuthority('TEACHER')" )
76113 @ PutMapping ("/createExercise" )
77114 @ ResponseBody
@@ -80,14 +117,13 @@ public ResponseEntity<?> createExercise(@RequestBody String json) {
80117 return new ResponseEntity <>(HttpStatus .OK );
81118 }
82119
83- @ PreAuthorize ("hasAuthority('TEACHER')" )
84- @ PostMapping ("/rateExercise" )
85- @ ResponseBody
86- public ResponseEntity <?> rateExercise (@ RequestBody String json ) {
87- // TODO: rate exercise from student
88- return new ResponseEntity <>(HttpStatus .OK );
89- }
90-
120+ /**
121+ * Changes already existing (and published) exercises
122+ * Needs group name + exercise object
123+ *
124+ * @param json
125+ * @return
126+ */
91127 @ PreAuthorize ("hasAuthority('TEACHER')" )
92128 @ PostMapping ("/patchExercise" )
93129 @ ResponseBody
@@ -96,11 +132,34 @@ public ResponseEntity<?> patchExercise(@RequestBody String json) {
96132 return new ResponseEntity <>(HttpStatus .OK );
97133 }
98134
135+ /**
136+ * Deletes existing exercise
137+ * Needs group name + exercise name
138+ *
139+ * @param json
140+ * @return
141+ */
99142 @ PreAuthorize ("hasAuthority('TEACHER')" )
100143 @ PutMapping ("/deleteExercise" )
101144 @ ResponseBody
102145 public ResponseEntity <?> deleteExercise (@ RequestBody String json ) {
103146 // TODO: delete existing exercise
104147 return new ResponseEntity <>(HttpStatus .OK );
105148 }
149+
150+ /**
151+ * Gives a rating to an exercise for one student
152+ * Needs group name + exercise name + student name
153+ *
154+ * @param json
155+ * @return
156+ */
157+ @ PreAuthorize ("hasAuthority('TEACHER')" )
158+ @ PostMapping ("/rateExercise" )
159+ @ ResponseBody
160+ public ResponseEntity <?> rateExercise (@ RequestBody String json ) {
161+ // TODO: rate exercise from student
162+ return new ResponseEntity <>(HttpStatus .OK );
163+ }
164+
106165}
0 commit comments