Skip to content
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

release: v0.40.0 #133

Merged
merged 123 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
007881b
chore(release): v0.0.2 [skip ci]
PedroChaparro Sep 20, 2023
b79e305
feat: Register student (#25)
PedroChaparro Sep 22, 2023
fea865d
chore(release): v0.1.0 [skip ci]
PedroChaparro Sep 22, 2023
d0baca9
fix(cd): Release development docker container (#26)
PedroChaparro Sep 22, 2023
849375c
chore(release): v0.1.1 [skip ci]
PedroChaparro Sep 22, 2023
2f89bc2
fix(cd): Run package pipeline when a tag is pushed (#27)
PedroChaparro Sep 22, 2023
43270f7
chore(release): v0.1.2 [skip ci]
PedroChaparro Sep 22, 2023
6609c90
fix(cd): Update tags filter
PedroChaparro Sep 22, 2023
c6a4310
chore(release): v0.1.3 [skip ci]
PedroChaparro Sep 22, 2023
50cbbac
fix(cd): Update pipeline trigger
PedroChaparro Sep 22, 2023
c0bc504
chore(release): v0.1.4 [skip ci]
PedroChaparro Sep 22, 2023
c662636
chore(cd): Restore tags filter
PedroChaparro Sep 22, 2023
26ad63f
refactor(accounts): Register student (#29)
PedroChaparro Sep 22, 2023
52edddd
feat: Register admin (#30)
PedroChaparro Sep 22, 2023
34fd9b9
chore(release): v0.2.0 [skip ci]
PedroChaparro Sep 22, 2023
f49dbb3
feat(session): Login endpoint (#31)
PedroChaparro Sep 22, 2023
01b0daf
chore(release): v0.3.0 [skip ci]
PedroChaparro Sep 22, 2023
8646b08
feat: Auth middlewares (#32)
PedroChaparro Sep 25, 2023
4ed970a
chore(release): v0.4.0 [skip ci]
PedroChaparro Sep 25, 2023
b297ec9
feat: Register teacher (#33)
PedroChaparro Sep 25, 2023
43db727
chore(release): v0.5.0 [skip ci]
PedroChaparro Sep 25, 2023
a3392f6
build: Remove binary step
PedroChaparro Sep 25, 2023
320e4e2
fix: Add CORS middleware
PedroChaparro Sep 25, 2023
cb05dbc
chore(release): v0.5.1 [skip ci]
PedroChaparro Sep 25, 2023
69b748f
Merge branch 'main' into dev
PedroChaparro Sep 25, 2023
a866d8e
feat: whoami (#38)
PedroChaparro Sep 25, 2023
67c48e2
chore(release): v0.6.0 [skip ci]
PedroChaparro Sep 25, 2023
81d5536
feat: Logout (#39)
PedroChaparro Sep 25, 2023
67d086e
chore(release): v0.7.0 [skip ci]
PedroChaparro Sep 25, 2023
7ba0762
feat: List admins (#40)
PedroChaparro Sep 25, 2023
25a06ca
chore(release): v0.8.0 [skip ci]
PedroChaparro Sep 25, 2023
7d85870
Merge branch 'main' into dev
PedroChaparro Sep 26, 2023
f4fdc3e
refactor: Return admins UUID (#42)
PedroChaparro Sep 27, 2023
09e15f8
feat: Create courses (#43)
PedroChaparro Sep 27, 2023
eb58249
chore(release): v0.9.0 [skip ci]
PedroChaparro Sep 27, 2023
752c910
refactor: Packages folders (#47)
PedroChaparro Sep 29, 2023
35af762
feat: Get invitation code (#50)
PedroChaparro Sep 29, 2023
7aa44ab
chore(release): v0.10.0 [skip ci]
PedroChaparro Sep 29, 2023
6206f3c
feat: Join course using invitation code (#51)
PedroChaparro Sep 29, 2023
00b8a38
chore(release): v0.11.0 [skip ci]
PedroChaparro Sep 29, 2023
2265a05
feat: Get teachers and students courses (#52)
PedroChaparro Sep 30, 2023
926c820
chore(release): v0.12.0 [skip ci]
PedroChaparro Sep 30, 2023
b9c6153
docs(openapi): Update spec (#54)
PedroChaparro Sep 30, 2023
28ec783
feat: Toggle course visibility (#55)
PedroChaparro Sep 30, 2023
850371e
chore(release): v0.13.0 [skip ci]
PedroChaparro Sep 30, 2023
cd78130
Merge branch 'main' into dev
PedroChaparro Sep 30, 2023
c534e71
fix: Send course information when an student joins using invitation c…
PedroChaparro Oct 4, 2023
386a69f
chore(release): v0.13.1 [skip ci]
PedroChaparro Oct 4, 2023
b8f1519
Merge branch 'main' into dev
PedroChaparro Oct 4, 2023
072a005
fix: Use case insensitive text for emails (#62)
PedroChaparro Oct 5, 2023
e2c0ebd
chore(release): v0.13.2 [skip ci]
PedroChaparro Oct 5, 2023
313d795
fix: Save who created admin and teacher accounts (#63)
PedroChaparro Oct 5, 2023
6b4f29d
chore(release): v0.13.3 [skip ci]
PedroChaparro Oct 5, 2023
7e7110b
feat: Rename course (#64)
PedroChaparro Oct 5, 2023
766ea63
chore(release): v0.14.0 [skip ci]
PedroChaparro Oct 5, 2023
f72482b
feat: Search students by full name (#65)
PedroChaparro Oct 6, 2023
88d4c31
chore(release): v0.15.0 [skip ci]
PedroChaparro Oct 6, 2023
565c90d
feat: Enroll student (#66)
PedroChaparro Oct 6, 2023
02bca07
chore(release): v0.16.0 [skip ci]
PedroChaparro Oct 6, 2023
f4b8741
feat: List enrolled students (#68)
PedroChaparro Oct 6, 2023
bc4a736
chore(release): v0.17.0 [skip ci]
PedroChaparro Oct 6, 2023
5703b9f
Merge branch 'main' into dev
PedroChaparro Oct 6, 2023
ae60ba4
feat: Get course by UUID (#71)
PedroChaparro Oct 8, 2023
172a823
chore(release): v0.18.0 [skip ci]
PedroChaparro Oct 8, 2023
ecf8703
Merge branch 'main' into dev
PedroChaparro Oct 8, 2023
ec43d55
feat: Create rubric (#80)
PedroChaparro Oct 10, 2023
429ea64
chore(release): v0.19.0 [skip ci]
PedroChaparro Oct 10, 2023
356af40
feat: Get rubrics created by teacher (#81)
PedroChaparro Oct 10, 2023
9111e27
chore(release): v0.20.0 [skip ci]
PedroChaparro Oct 10, 2023
533c8f4
feat: Get rubric by UUID (#82)
PedroChaparro Oct 12, 2023
07b50e2
chore(release): v0.21.0 [skip ci]
PedroChaparro Oct 12, 2023
9d91a94
feat: Add objective to rubric (#83)
PedroChaparro Oct 12, 2023
7d8b2f8
chore(release): v0.22.0 [skip ci]
PedroChaparro Oct 12, 2023
2bca229
feat: Add criteria to rubric objective (#84)
PedroChaparro Oct 13, 2023
f0cdd92
chore(release): v0.23.0 [skip ci]
PedroChaparro Oct 13, 2023
079d831
Merge branch 'main' into dev
PedroChaparro Oct 13, 2023
e245120
docs: Add bruno collection (#87)
PedroChaparro Oct 13, 2023
85cb925
fix: Sort rubric objectives by creation date (#90)
PedroChaparro Nov 15, 2023
090dbf2
chore(release): v0.23.1 [skip ci]
PedroChaparro Nov 15, 2023
a2cfb46
fix: Min criteria weight (#91)
PedroChaparro Nov 15, 2023
fcb1929
chore(release): v0.23.2 [skip ci]
PedroChaparro Nov 15, 2023
aabeec6
feat: Update rubric objective (#93)
PedroChaparro Nov 16, 2023
eb2f0b1
chore(release): v0.24.0 [skip ci]
PedroChaparro Nov 16, 2023
6d4e5e9
feat: Update objectives criteria (#94)
PedroChaparro Nov 16, 2023
bc55a7e
chore(release): v0.25.0 [skip ci]
PedroChaparro Nov 16, 2023
2f32e64
feat: Update rubric name (#95)
PedroChaparro Nov 16, 2023
283590d
chore(release): v0.26.0 [skip ci]
PedroChaparro Nov 16, 2023
a3d9eda
feat: Remove objective (#98)
PedroChaparro Nov 16, 2023
7eb1021
chore(release): v0.27.0 [skip ci]
PedroChaparro Nov 16, 2023
b7fe282
feat: Delete objective criteria (#99)
PedroChaparro Nov 16, 2023
e367d83
chore(release): v0.28.0 [skip ci]
PedroChaparro Nov 16, 2023
94fa109
ci: Trigger integration pipeline on pull request to `main`
PedroChaparro Nov 16, 2023
2a4e8b6
Merge branch 'main' into dev
PedroChaparro Nov 16, 2023
c577ea2
feat: Create laboratory (#103)
PedroChaparro Nov 27, 2023
de0e046
chore(release): v0.29.0 [skip ci]
PedroChaparro Nov 27, 2023
e388a54
feat: Update laboratory by UUID (#109)
PedroChaparro Nov 28, 2023
2a05d4e
chore(release): v0.30.0 [skip ci]
PedroChaparro Nov 28, 2023
44a870d
feat: Get laboratory by UUID (#110)
PedroChaparro Nov 28, 2023
653473e
feat: Get course laboratories (#111)
PedroChaparro Nov 28, 2023
4a604cf
chore(release): v0.31.0 [skip ci]
PedroChaparro Nov 28, 2023
e3c5ef1
feat: Create empty markdown block (#112)
PedroChaparro Nov 28, 2023
51d495a
chore(release): v0.32.0 [skip ci]
PedroChaparro Nov 28, 2023
3a6f762
feat: Update markdown block content (#113)
PedroChaparro Nov 29, 2023
750a25d
chore(release): v0.33.0 [skip ci]
PedroChaparro Nov 29, 2023
8040510
Merge branch 'main' into dev
PedroChaparro Nov 29, 2023
5983288
docs(openapi): Update spec (#121)
PedroChaparro Dec 28, 2023
e7d7539
feat: List supported languages (#122)
PedroChaparro Dec 28, 2023
deb7329
chore(release): v0.34.0 [skip ci]
PedroChaparro Dec 28, 2023
4f460f4
feat: Download languages template (#123)
PedroChaparro Dec 28, 2023
43931f1
chore(release): v0.35.0 [skip ci]
PedroChaparro Dec 28, 2023
ae8c2ba
feat: Create new test block (#126)
PedroChaparro Dec 29, 2023
116e4ca
chore(release): v0.36.0 [skip ci]
PedroChaparro Dec 29, 2023
fa8c816
feat: Update test block (#127)
PedroChaparro Dec 30, 2023
7f741e5
chore(release): v0.37.0 [skip ci]
PedroChaparro Dec 30, 2023
14a5b37
Merge branch 'main' into dev
PedroChaparro Dec 30, 2023
0797e01
feat: Update status of enrolled students (#129)
PedroChaparro Dec 30, 2023
7d538f4
chore(release): v0.38.0 [skip ci]
PedroChaparro Dec 30, 2023
1511156
refactor: Unify project packages (#130)
PedroChaparro Dec 30, 2023
1aee6d6
feat: Delete markdown block (#131)
PedroChaparro Dec 30, 2023
f0285eb
chore(release): v0.39.0 [skip ci]
PedroChaparro Dec 30, 2023
3ddaa80
feat: Delete test block (#132)
PedroChaparro Dec 30, 2023
086322e
chore(release): v0.40.0 [skip ci]
PedroChaparro Dec 30, 2023
4ee2c0b
Merge branch 'main' into dev
PedroChaparro Dec 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# [0.37.0](https://github.com/upb-code-labs/main-api/compare/v0.36.0...v0.37.0) (2023-12-30)
# [0.40.0](https://github.com/upb-code-labs/main-api/compare/v0.39.0...v0.40.0) (2023-12-30)


### Features

* Update test block ([#127](https://github.com/upb-code-labs/main-api/issues/127)) ([fa8c816](https://github.com/upb-code-labs/main-api/commit/fa8c816083650039ae831daeff69c8e65689796a))
* Delete test block ([#132](https://github.com/upb-code-labs/main-api/issues/132)) ([3ddaa80](https://github.com/upb-code-labs/main-api/commit/3ddaa80089b3e88404bfa0f92070d5f1e21722de))



# [0.36.0](https://github.com/upb-code-labs/main-api/compare/v0.35.0...v0.36.0) (2023-12-29)
# [0.39.0](https://github.com/upb-code-labs/main-api/compare/v0.38.0...v0.39.0) (2023-12-30)


### Features

* Create new test block ([#126](https://github.com/upb-code-labs/main-api/issues/126)) ([ae8c2ba](https://github.com/upb-code-labs/main-api/commit/ae8c2ba50914ec235cecb0a41784736f2a4692ac))
* Delete markdown block ([#131](https://github.com/upb-code-labs/main-api/issues/131)) ([1aee6d6](https://github.com/upb-code-labs/main-api/commit/1aee6d6c4509953aa03d1d449cb173a916eedc27))



# [0.35.0](https://github.com/upb-code-labs/main-api/compare/v0.34.0...v0.35.0) (2023-12-28)
# [0.38.0](https://github.com/upb-code-labs/main-api/compare/v0.37.0...v0.38.0) (2023-12-30)


### Features

* Download languages template ([#123](https://github.com/upb-code-labs/main-api/issues/123)) ([4f460f4](https://github.com/upb-code-labs/main-api/commit/4f460f41a90f38516b6dad38f40a97f5245efb99))
* Update status of enrolled students ([#129](https://github.com/upb-code-labs/main-api/issues/129)) ([0797e01](https://github.com/upb-code-labs/main-api/commit/0797e01e7795c2c46065c33b3c6549f3136dd95e))



# [0.34.0](https://github.com/upb-code-labs/main-api/compare/v0.33.0...v0.34.0) (2023-12-28)
# [0.37.0](https://github.com/upb-code-labs/main-api/compare/v0.36.0...v0.37.0) (2023-12-30)


### Features

* List supported languages ([#122](https://github.com/upb-code-labs/main-api/issues/122)) ([e7d7539](https://github.com/upb-code-labs/main-api/commit/e7d75396b242cdebc046d62ca184522bcfbb2ae2))
* Update test block ([#127](https://github.com/upb-code-labs/main-api/issues/127)) ([fa8c816](https://github.com/upb-code-labs/main-api/commit/fa8c816083650039ae831daeff69c8e65689796a))



# [0.33.0](https://github.com/upb-code-labs/main-api/compare/v0.32.0...v0.33.0) (2023-11-29)
# [0.36.0](https://github.com/upb-code-labs/main-api/compare/v0.35.0...v0.36.0) (2023-12-29)


### Features

* Update markdown block content ([#113](https://github.com/upb-code-labs/main-api/issues/113)) ([3a6f762](https://github.com/upb-code-labs/main-api/commit/3a6f762a1c5e1e3915bee380438803b0ce981aac))
* Create new test block ([#126](https://github.com/upb-code-labs/main-api/issues/126)) ([ae8c2ba](https://github.com/upb-code-labs/main-api/commit/ae8c2ba50914ec235cecb0a41784736f2a4692ac))



115 changes: 114 additions & 1 deletion __tests__/integration/blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestUpdateMarkdownBlockContent(t *testing.T) {
"name": "Update markdown block content test - laboratory",
"course_uuid": courseUUID,
"opening_date": "2023-12-01T08:00",
"due_date": "2023-12-01T12:00",
"due_date": "3023-12-01T12:00",
})
c.Equal(http.StatusCreated, status)
laboratoryUUID := laboratoryCreationResponse["uuid"].(string)
Expand Down Expand Up @@ -68,6 +68,51 @@ func TestUpdateMarkdownBlockContent(t *testing.T) {
c.Equal("# Updated main title", block["content"].(string))
}

func TestDeleteMarkdownBlock(t *testing.T) {
c := require.New(t)

// Login as a teacher
w, r := PrepareRequest("POST", "/api/v1/session/login", map[string]interface{}{
"email": registeredTeacherEmail,
"password": registeredTeacherPass,
})
router.ServeHTTP(w, r)
cookie := w.Result().Cookies()[0]

// Create a course
courseUUID, status := CreateCourse("Delete markdown block test - course")
c.Equal(http.StatusCreated, status)

// Create a laboratory
laboratoryCreationResponse, status := CreateLaboratory(cookie, map[string]interface{}{
"name": "Delete markdown block test - laboratory",
"course_uuid": courseUUID,
"opening_date": "2023-12-01T08:00",
"due_date": "3023-12-01T12:00",
})
c.Equal(http.StatusCreated, status)
laboratoryUUID := laboratoryCreationResponse["uuid"].(string)

// Create a markdown block
blockCreationResponse, status := CreateMarkdownBlock(cookie, laboratoryUUID)
c.Equal(http.StatusCreated, status)
markdownBlockUUID := blockCreationResponse["uuid"].(string)

// Get the laboratory
response, status := GetLaboratoryByUUID(cookie, laboratoryUUID)
c.Equal(http.StatusOK, status)
c.Equal(1, len(response["markdown_blocks"].([]interface{})))

// Delete the markdown block
_, status = DeleteMarkdownBlock(cookie, markdownBlockUUID)
c.Equal(http.StatusNoContent, status)

// Verify that the block was deleted
response, status = GetLaboratoryByUUID(cookie, laboratoryUUID)
c.Equal(http.StatusOK, status)
c.Equal(0, len(response["markdown_blocks"].([]interface{})))
}

func TestUpdateTestBlock(t *testing.T) {
c := require.New(t)

Expand Down Expand Up @@ -142,3 +187,71 @@ func TestUpdateTestBlock(t *testing.T) {
c.Equal(newName, block["name"].(string))
c.Equal(firstLanguageUUID, block["language_uuid"].(string))
}

func TestDeleteTestBlock(t *testing.T) {
c := require.New(t)

// Login as a teacher
w, r := PrepareRequest("POST", "/api/v1/session/login", map[string]interface{}{
"email": registeredTeacherEmail,
"password": registeredTeacherPass,
})
router.ServeHTTP(w, r)
cookie := w.Result().Cookies()[0]

// Create a course
courseUUID, status := CreateCourse("Delete test block test - course")
c.Equal(http.StatusCreated, status)

// Create a laboratory
laboratoryCreationResponse, status := CreateLaboratory(cookie, map[string]interface{}{
"name": "Delete test block test - laboratory",
"course_uuid": courseUUID,
"opening_date": "2023-12-01T08:00",
"due_date": "3023-12-01T00:00",
})
c.Equal(http.StatusCreated, status)
laboratoryUUID := laboratoryCreationResponse["uuid"].(string)

// Get the supported languages
languagesResponse, status := GetSupportedLanguages(cookie)
c.Equal(http.StatusOK, status)

languages := languagesResponse["languages"].([]interface{})
c.Greater(len(languages), 0)

firstLanguage := languages[0].(map[string]interface{})
firstLanguageUUID := firstLanguage["uuid"].(string)

// Create a test block
zipFile, err := GetSampleTestsArchive()
c.Nil(err)

blockCreationResponse, status := CreateTestBlock(&CreateTestBlockUtilsDTO{
laboratoryUUID: laboratoryUUID,
languageUUID: firstLanguageUUID,
blockName: "Delete test block test - block",
cookie: cookie,
testFile: zipFile,
})
c.Equal(http.StatusCreated, status)
testBlockUUID := blockCreationResponse["uuid"].(string)

// Check that the test block was created
laboratoryResponse, status := GetLaboratoryByUUID(cookie, laboratoryUUID)
c.Equal(http.StatusOK, status)

blocks := laboratoryResponse["test_blocks"].([]interface{})
c.Equal(1, len(blocks))

// Delete the test block
_, status = DeleteTestBlock(cookie, testBlockUUID)
c.Equal(http.StatusNoContent, status)

// Check that the test block was deleted
laboratoryResponse, status = GetLaboratoryByUUID(cookie, laboratoryUUID)
c.Equal(http.StatusOK, status)

blocks = laboratoryResponse["test_blocks"].([]interface{})
c.Equal(0, len(blocks))
}
20 changes: 20 additions & 0 deletions __tests__/integration/blocks_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ func UpdateMarkdownBlockContent(cookie *http.Cookie, blockUUID string, payload m
return jsonResponse, w.Code
}

func DeleteMarkdownBlock(cookie *http.Cookie, blockUUID string) (response map[string]interface{}, statusCode int) {
endpoint := fmt.Sprintf("/api/v1/blocks/markdown_blocks/%s", blockUUID)
w, r := PrepareRequest("DELETE", endpoint, nil)
r.AddCookie(cookie)
router.ServeHTTP(w, r)

jsonResponse := ParseJsonResponse(w.Body)
return jsonResponse, w.Code
}

type UpdateTestBlockUtilsDTO struct {
blockUUID string
languageUUID string
Expand Down Expand Up @@ -74,3 +84,13 @@ func UpdateTestBlock(dto *UpdateTestBlockUtilsDTO) (response map[string]interfac
jsonResponse := ParseJsonResponse(w.Body)
return jsonResponse, w.Code
}

func DeleteTestBlock(cookie *http.Cookie, blockUUID string) (response map[string]interface{}, statusCode int) {
endpoint := fmt.Sprintf("/api/v1/blocks/test_blocks/%s", blockUUID)
w, r := PrepareRequest("DELETE", endpoint, nil)
r.AddCookie(cookie)
router.ServeHTTP(w, r)

jsonResponse := ParseJsonResponse(w.Body)
return jsonResponse, w.Code
}
46 changes: 46 additions & 0 deletions __tests__/integration/courses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,3 +679,49 @@ func TestGetCourseLaboratories(t *testing.T) {
}
}
}

func TestSetStudentStatus(t *testing.T) {
c := require.New(t)

// 1. Create a course
courseUUID, code := CreateCourse("Set student status test - course")
c.Equal(http.StatusCreated, code)

// 2. Get the course invitation code
invitationCode, code := GetInvitationCode(courseUUID)
c.Equal(http.StatusOK, code)

// 3. Add a student to the course
_, code = AddStudentToCourse(invitationCode)
c.Equal(http.StatusOK, code)

// 4. Login as a teacher
w, r := PrepareRequest("POST", "/api/v1/session/login", map[string]interface{}{
"email": registeredTeacherEmail,
"password": registeredTeacherPass,
})
router.ServeHTTP(w, r)
cookie := w.Result().Cookies()[0]

// 5. Get the student uuid
students, code := GetStudentsEnrolledInCourse(cookie, courseUUID)
c.Equal(http.StatusOK, code)
c.Equal(1, len(students["students"].([]interface{})))
studentUUID := students["students"].([]interface{})[0].(map[string]interface{})["uuid"].(string)

// 6. Set the student status
code = SetStudentStatus(&SetStudentStatusUtilsDTO{
CourseUUID: courseUUID,
StudentUUID: studentUUID,
IsActive: false,
Cookie: cookie,
})
c.Equal(http.StatusNoContent, code)

// 7. Get the student status
students, code = GetStudentsEnrolledInCourse(cookie, courseUUID)
c.Equal(http.StatusOK, code)
c.Equal(1, len(students["students"].([]interface{})))
student := students["students"].([]interface{})[0].(map[string]interface{})
c.Equal(false, student["is_active"])
}
18 changes: 18 additions & 0 deletions __tests__/integration/courses_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,21 @@ func GetCourseLaboratories(cookie *http.Cookie, courseUUID string) (response map
jsonResponse := ParseJsonResponse(w.Body)
return jsonResponse, w.Code
}

type SetStudentStatusUtilsDTO struct {
CourseUUID string
StudentUUID string
IsActive bool
Cookie *http.Cookie
}

func SetStudentStatus(dto *SetStudentStatusUtilsDTO) (statusCode int) {
endpoint := fmt.Sprintf("/api/v1/courses/%s/students/%s/status", dto.CourseUUID, dto.StudentUUID)
w, r := PrepareRequest("PATCH", endpoint, map[string]interface{}{
"is_active": dto.IsActive,
})
r.AddCookie(dto.Cookie)
router.ServeHTTP(w, r)

return w.Code
}
4 changes: 2 additions & 2 deletions __tests__/integration/laboratorires_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestCreateLaboratory(t *testing.T) {
"name": "Create laboratory test - laboratory",
"course_uuid": courseUUID,
"opening_date": "2023-12-01T08:00",
"due_date": "2023-12-01T12:00",
"due_date": "3023-12-01T12:00",
},
ExpectedStatusCode: http.StatusCreated,
},
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestCreateMarkdownBlock(t *testing.T) {
"name": "Create markdown block test - laboratory",
"course_uuid": courseUUID,
"opening_date": "2023-12-01T08:00",
"due_date": "2023-12-01T12:00",
"due_date": "3023-12-01T12:00",
})
laboratoryUUID := laboratoryCreationResponse["uuid"].(string)
c.Equal(http.StatusCreated, status)
Expand Down
12 changes: 6 additions & 6 deletions __tests__/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"

"github.com/UPB-Code-Labs/main-api/src/accounts/infrastructure/requests"
config_infrastructure "github.com/UPB-Code-Labs/main-api/src/config/infrastructure"
shared_infrastructure "github.com/UPB-Code-Labs/main-api/src/shared/infrastructure"
configInfrastructure "github.com/UPB-Code-Labs/main-api/src/config/infrastructure"
sharedInfrastructure "github.com/UPB-Code-Labs/main-api/src/shared/infrastructure"
"github.com/gin-gonic/gin"
)

Expand Down Expand Up @@ -40,7 +40,7 @@ type GenericTestCase struct {
func TestMain(m *testing.M) {
// Setup database
setupDatabase()
defer shared_infrastructure.ClosePostgresConnection()
defer sharedInfrastructure.ClosePostgresConnection()

// Setup http router
setupRouter()
Expand All @@ -52,12 +52,12 @@ func TestMain(m *testing.M) {
}

func setupDatabase() {
shared_infrastructure.GetPostgresConnection()
config_infrastructure.RunMigrations()
sharedInfrastructure.GetPostgresConnection()
configInfrastructure.RunMigrations()
}

func setupRouter() {
router = config_infrastructure.InstanceHttpServer()
router = configInfrastructure.InstanceHttpServer()
}

func registerBaseAccounts() {
Expand Down
11 changes: 11 additions & 0 deletions docs/bruno/blocks/delete-markdown-block.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: delete-markdown-block
type: http
seq: 2
}

delete {
url: {{BASE_URL}}/blocks/markdown_blocks/eb4ef0ee-3865-44c3-8d52-2620fb2653e5
body: none
auth: none
}
11 changes: 11 additions & 0 deletions docs/bruno/blocks/delete-test-block.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: delete-test-block
type: http
seq: 3
}

delete {
url: {{BASE_URL}}/blocks/test_blocks/eb4ef0ee-3865-44c3-8d52-2620fb2653e5
body: none
auth: none
}
11 changes: 11 additions & 0 deletions docs/bruno/courses/update-enrolled-student-status.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
meta {
name: update-enrolled-student-status
type: http
seq: 11
}

patch {
url: {{BASE_URL}}/courses/b6268472-d569-4f60-9d64-58441433e0b3/students
body: none
auth: none
}
Loading
Loading