-
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.
feat: Add criteria to rubric objective (#84)
* refactor(rubrics): Create functions to verify rubrics ownership * fix(rubrics): Use separated views to verify objectives and criteria ownership * docs(openapi): Update spec * feat(rubrics): Create endpoint to add criteria to a rubric objective * fix(rubrics): Order objectives and criteria by creation date * chore: Clean tests cache before running tests * test(accounts): Register a second teacher account by default * test(rubrics): Ensure teacher can add criteria to rubric objective * chore(db): Update down migration * chore(deps): Bump dependencies
- Loading branch information
1 parent
7d8b2f8
commit 2bca229
Showing
17 changed files
with
404 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,9 @@ var ( | |
|
||
registeredTeacherEmail string | ||
registeredTeacherPass string | ||
|
||
secondRegisteredTeacherEmail string | ||
secondRegisteredTeacherPass string | ||
) | ||
|
||
type GenericTestCase struct { | ||
|
@@ -59,7 +62,7 @@ func setupRouter() { | |
|
||
func registerBaseAccounts() { | ||
registerBaseStudent() | ||
registerBaseTeacher() | ||
registerBaseTeachers() | ||
} | ||
|
||
func registerBaseStudent() { | ||
|
@@ -80,7 +83,8 @@ func registerBaseStudent() { | |
registeredStudentPass = studentPassword | ||
} | ||
|
||
func registerBaseTeacher() { | ||
func registerBaseTeachers() { | ||
// Register the first teacher | ||
teacherEmail := "[email protected]" | ||
teacherPassword := "judy/password/2023" | ||
|
||
|
@@ -95,6 +99,22 @@ func registerBaseTeacher() { | |
|
||
registeredTeacherEmail = teacherEmail | ||
registeredTeacherPass = teacherPassword | ||
|
||
// Register the second teacher | ||
secondTeacherEmail := "[email protected]" | ||
secondTeacherPassword := "trofim/password/2023" | ||
|
||
code = RegisterTeacherAccount(requests.RegisterTeacherRequest{ | ||
FullName: "Trofim Vijay", | ||
Email: secondTeacherEmail, | ||
Password: secondTeacherPassword, | ||
}) | ||
if code != http.StatusCreated { | ||
panic("Error registering base teacher") | ||
} | ||
|
||
secondRegisteredTeacherEmail = secondTeacherEmail | ||
secondRegisteredTeacherPass = secondTeacherPassword | ||
} | ||
|
||
// --- Helpers --- | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dtos | ||
|
||
type AddCriteriaToObjectiveDTO struct { | ||
TeacherUUID string | ||
ObjectiveUUID string | ||
CriteriaDescription string | ||
CriteriaWeight float64 | ||
} |
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,13 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
type CriteriaNotFoundError struct{} | ||
|
||
func (err *CriteriaNotFoundError) Error() string { | ||
return "Rubric criteria not found" | ||
} | ||
|
||
func (err *CriteriaNotFoundError) StatusCode() int { | ||
return http.StatusNotFound | ||
} |
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,13 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
type ObjectiveNotFoundError struct{} | ||
|
||
func (err *ObjectiveNotFoundError) Error() string { | ||
return "Rubric objective not found" | ||
} | ||
|
||
func (err *ObjectiveNotFoundError) StatusCode() int { | ||
return http.StatusNotFound | ||
} |
Oops, something went wrong.