From b390f6c41d953b6124eff28149b7ef9c163395d0 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 6 Mar 2022 16:16:36 +0300 Subject: [PATCH 01/21] add changes of user and university models --- backend/app/models/uni_models.py | 120 +++++++------- backend/app/models/user_models.py | 153 +++++++++++------- .../app/routers/user_routers/user_routers.py | 9 +- 3 files changed, 160 insertions(+), 122 deletions(-) diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index 03d7070..ef7b7c7 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -14,8 +14,8 @@ class UniversitySlotModel(BaseModel): class UniversitySectionModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - section: str = Field(...) - instructor: str = Field(...) + section: int = Field(..., ge=0) + instructor: str = Field(..., min_length=1, max_length=127) slots: List[UniversitySlotModel] = Field(...) class Config: @@ -27,8 +27,8 @@ class Config: } schema_extra = { "example": { - "section": "01", - "instructor": "JACK JOE", + "section": 1, + "instructor": "Jack Joe", "slots": [ {"day": 2, "hour": 7, "isLab": 0}, {"day": 2, "hour": 8, "isLab": 0}, @@ -39,7 +39,7 @@ class Config: class UniversitySectionAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") - section: Optional[str] + section: Optional[int] instructor: Optional[str] slots: Optional[List[List[int]]] @@ -47,8 +47,8 @@ class Config: allow_population_by_field_name = True schema_extra = { "example": { - "section": "01", - "instructor": "JACK JOE", + "section": 1, + "instructor": "Jack Joe", "slots": [[2, 7, 0], [2, 8, 0]], } } @@ -56,12 +56,12 @@ class Config: class UniversityLessonModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(...) - code: str = Field(...) + name: str = Field(..., min_length=1, max_length=127) + code: str = Field(..., min_length=1, max_length=10) ects: float = Field(..., ge=0) - absenceLimit: int = Field(..., ge=0) - section: str = Field(...) - instructor: str = Field(...) + absence_limit: int = Field(..., ge=0) + section: int = Field(..., ge=0) + instructor: str = Field(..., min_length=1, max_length=127) slots: List[UniversitySlotModel] = Field(...) class Config: @@ -76,9 +76,9 @@ class Config: "name": "ART OF COMPUTING", "code": "COMP101", "ects": 6, - "absenceLimit": 8, - "section": "01", - "instructor": "JACK JOE", + "absence_limit": 8, + "section": 1, + "instructor": "Jack Joe", "slots": [ {"day": 2, "hour": 7, "isLab": 0}, {"day": 2, "hour": 8, "isLab": 0}, @@ -92,7 +92,7 @@ class UniversityLessonAPIModel(BaseModel): name: str = Field(...) code: str = Field(...) ects: float = Field(..., ge=0) - absenceLimit: int = Field(..., ge=0) + absence_limit: int = Field(..., ge=0) sections: List[UniversitySectionAPIModel] = [] class Config: @@ -104,7 +104,7 @@ class Config: "name": "ART OF COMPUTING", "code": "COMP101", "ects": 6, - "absenceLimit": 0, + "absence_limit": 0, } } @@ -125,50 +125,24 @@ class Config: } -class UniversitySemesterAPIModel(BaseModel): - id: Optional[str] = Field(alias="_id") - name: Optional[str] - startDate: Optional[datetime] - endDate: Optional[datetime] - startHour: Optional[str] - dLesson: Optional[int] - dBreak: Optional[int] - slotCount: Optional[int] - - class Config: - allow_population_by_field_name = True - schema_extra = { - "example": { - "_id": "61ddea901311ecaed99afb7c", - "name": "2020-21 Spring", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.10", - "dLesson": 50, - "dBreak": 10, - "slotCount": 12, - } - } - - class CurriculumLessonModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(...) - code: str = Field(...) - lessonType: str = Field(...) + name: str = Field(..., min_length=1, max_length=100) + code: str = Field(..., min_length=1, max_length=100) + lesson_type: str = Field(..., min_length=1, max_length=30) class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} schema_extra = { - "example": {"name": "PHYSICS I", "code": "PHYS101", "lessonType": "science"} + "example": {"name": "PHYSICS I", "code": "PHYS101", "lesson_type": "science"} } class CurriculumSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - semester: int = Field(..., gt=0, lt=9) + semester: int = Field(..., gt=0, lt=20) lessons: List[CurriculumLessonModel] = [] class Config: @@ -185,8 +159,8 @@ class Config: class UniversityCurriculumModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=1) - startYear: int = Field(...) - endYear: int = Field(...) + start_year: int = Field(...) + end_year: int = Field(...) semesters: List[CurriculumSemesterModel] = [] class Config: @@ -194,13 +168,13 @@ class Config: arbitrary_types_allowed = True json_encoders = {ObjectId: str} schema_extra = { - "example": {"name": "2016 Later", "startYear": 2016, "endYear": 2100} + "example": {"name": "2016 Later", "start_year": 2016, "end_year": 2100} } class UniversityDepartmentModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(..., min_length=2 ,max_length=100,) + name: str = Field(..., min_length=2 ,max_length=100) curriculums: List[UniversityCurriculumModel] = [] class Config: @@ -216,7 +190,15 @@ class Config: class UniversityModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(...) + name: str = Field(..., min_length=2, max_length=100) + domain: str = Field(..., min_length=5, max_length=100), + country: str = Field(..., min_length=2, max_length=100), + city: str = Field(..., min_length=2, max_length=100), + address: str = Field(..., min_length=2, max_length=100), + zip_code: str = Field(..., min_length=2, max_length=100), + description: str = Field(..., max_length=255), + logo: str = Field(..., max_length=255), + cover_photo: str = Field(..., max_length=255), departments: List[UniversityDepartmentModel] = [] semesters: List[UniversitySemesterModel] = [] @@ -226,7 +208,15 @@ class Config: json_encoders = {ObjectId: str} schema_extra = { "example": { - "name": "AGU", + "name": "Test University", + "domain": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", } } @@ -234,7 +224,15 @@ class Config: class UniversityAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") name: Optional[str] - curSemesterID: Optional[str] + domain: Optional[str] + country: Optional[str] + city: Optional[str] + address: Optional[str] + zip_code: Optional[str] + description: Optional[str] + logo: Optional[str] + cover_photo: Optional[str] + cur_semester_id: Optional[str] class Config: allow_population_by_field_name = True @@ -243,8 +241,16 @@ class Config: schema_extra = { "example": { "_id": "61fc266ae3d749b1d65c17c6", - "name": "AGU", - "curSemesterID": "61fc266ae3d749b1d65c17c7", + "name": "Test University", + "domain": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "cur_semester_id": "61fc266ae3d749b1d65c17c7", } } diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 47b50e5..bb48df3 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -9,14 +9,14 @@ class SlotModel(BaseModel): day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) - isLab: int = Field(..., ge=0, le=1) + is_lab: int = Field(..., ge=0, le=1) class AbsenceModel(BaseModel): week: int = Field(..., ge=0) day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) - isLab: int = Field(..., ge=0, le=1) + is_lab: int = Field(..., ge=0, le=1) class LessonAbsenceModel(BaseModel): @@ -34,8 +34,11 @@ class Config: class LessonModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=1) + code: str = Field(..., min_length=1) instructor: str = Field(..., min_length=1) - absenceLimit: int = Field(..., ge=0) + ects: int = Field(..., ge=0) + grade: float = Field(ge=0, le=10) + absence_limit: int = Field(..., ge=0) slots: List[SlotModel] = Field(...) absences: List[AbsenceModel] = [] @@ -50,8 +53,11 @@ class Config: schema_extra = { "example": { "name": "Algebra", + "code": "ALG", "instructor": "Jack Joe", - "absenceLimit": 21, + "ects": 5, + "grade": 3.67, + "absence_limit": 21, "slots": [ {"day": 2, "hour": 7, "isLab": 0}, {"day": 2, "hour": 8, "isLab": 0}, @@ -67,8 +73,11 @@ class Config: class LessonAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") name: Optional[str] + code: Optional[str] instructor: Optional[str] - absenceLimit: Optional[int] + ects: Optional[int] + grade: Optional[float] + absence_limit: Optional[int] slots: Optional[List[List[int]]] absences: Optional[List[List[int]]] @@ -78,8 +87,11 @@ class Config: "example": { "_id": "61ddea901311ecaed99afb7c", "name": "Algebra", + "code": "ALG", "instructor": "Jack Joe", - "absenceLimit": 21, + "ects": 5, + "grade": 3.67, + "absence_limit": 21, "slots": [[2, 7, 0], [2, 8, 0]], "absences": [[0, 2, 7, 0], [0, 2, 8, 0]], } @@ -87,9 +99,12 @@ class Config: class UpdateLessonModel(BaseModel): - name: str = Field(...) - instructor: str = Field(...) - absenceLimit: int = Field(..., ge=0) + name: str = Field(..., min_length=1) + code: str = Field(..., min_length=1) + instructor: str = Field(..., min_length=1) + ects: int = Field(..., ge=0) + grade: float = Field(ge=0, le=10) + absence_limit: int = Field(..., ge=0) slots: List[SlotModel] = Field(...) class Config: @@ -99,8 +114,11 @@ class Config: schema_extra = { "example": { "name": "Algebra", + "code": "ALG", "instructor": "Jack Joe", - "absenceLimit": 21, + "ects": 5, + "grade": 3.67, + "absence_limit": 21, "slots": [ {"day": 2, "hour": 7, "isLab": 0}, {"day": 2, "hour": 8, "isLab": 0}, @@ -112,12 +130,12 @@ class Config: class UserSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(...) - startDate: datetime = Field(...) - endDate: datetime = Field(...) - startHour: str = Field(...) - dLesson: int = Field(..., gt=0) - dBreak: int = Field(..., gt=0) - slotCount: int = Field(..., gt=3, lt=16) + start_date: datetime = Field(...) + end_date: datetime = Field(...) + start_hour: str = Field(...) + duration_lesson: int = Field(..., gt=0) + duration_break: int = Field(..., gt=0) + slot_count: int = Field(..., gt=3, lt=16) lessons: List[LessonModel] = [] class Config: @@ -127,36 +145,36 @@ class Config: schema_extra = { "example": { "name": "2020-21 Spring", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.10", - "dLesson": 50, - "dBreak": 10, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00Z", + "end_date": "2022-06-18T00:00:00Z", + "start_hour": "8.10", + "duration_lesson": 50, + "duration_break": 10, + "slot_count": 12, } } class UpdateUserSemesterModel(BaseModel): name: str = Field(...) - startDate: datetime = Field(...) - endDate: datetime = Field(...) - startHour: str = Field(...) - dLesson: int = Field(..., gt=0) - dBreak: int = Field(..., gt=0) - slotCount: int = Field(..., gt=3, lt=16) + start_date: datetime = Field(...) + end_date: datetime = Field(...) + start_hour: str = Field(...) + duration_lesson: int = Field(..., gt=0) + duration_break: int = Field(..., gt=0) + slot_count: int = Field(..., gt=3, lt=16) class Config: allow_population_by_field_name = True schema_extra = { "example": { "name": "2020-21 Spring", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.10", - "dLesson": 50, - "dBreak": 10, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00Z", + "end_date": "2022-06-18T00:00:00Z", + "start_hour": "8.10", + "duration_lesson": 50, + "duration_break": 10, + "slot_count": 12, } } @@ -164,12 +182,12 @@ class Config: class SemesterAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") name: Optional[str] - startDate: Optional[datetime] - endDate: Optional[datetime] - startHour: Optional[str] - dLesson: Optional[int] - dBreak: Optional[int] - slotCount: Optional[int] + start_date: Optional[datetime] + end_date: Optional[datetime] + start_hour: Optional[str] + duration_lesson: Optional[int] + duration_break: Optional[int] + slot_count: Optional[int] class Config: allow_population_by_field_name = True @@ -177,12 +195,12 @@ class Config: "example": { "_id": "61ddea901311ecaed99afb7c", "name": "2020-21 Spring", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.10", - "dLesson": 50, - "dBreak": 10, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00Z", + "end_date": "2022-06-18T00:00:00Z", + "start_hour": "8.10", + "duration_lesson": 50, + "duration_break": 10, + "slot_count": 12, } } @@ -191,22 +209,31 @@ class UserModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") email: EmailStr = Field(...) password: str = Field(...) + full_name: str = Field(...) semesters: List[UserSemesterModel] = [] class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} - schema_extra = {"example": {"email": "hello@agu.edu.tr", "password": "123456"}} + schema_extra = { + "example": { + "email": "hello@agu.edu.tr", + "password": "123456", + "full_name": "John Doe", + } + } class UserAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") email: Optional[EmailStr] - userGroup: Optional[str] - curSemesterID: Optional[str] - curUniversityID: Optional[str] - entranceYear: Optional[int] + full_name: Optional[str] + current_gpa: Optional[float] + user_group: Optional[str] + current_semester_id: Optional[str] + current_university_id: Optional[str] + entrance_year: Optional[int] class Config: allow_population_by_field_name = True @@ -214,10 +241,12 @@ class Config: "example": { "_id": "61ddea901311ecaed99afb7c", "email": "hello@agu.edu.tr", - "userGroup": "default", - "curSemesterID": "61ddea901311ecaed99afb7d", - "curUniversityID": "61ddea901311ecaed99afb7e", - "entranceYear": 2018, + "full_name": "John Doe", + "current_gpa": 4.0, + "user_group": "default", + "current_semester_id": "61ddea901311ecaed99afb7d", + "current_university_id": "61ddea901311ecaed99afb7e", + "entrance_year": 2018, } } @@ -230,24 +259,26 @@ class Config: class UpdateSemesterModel(BaseModel): - curSemesterID: str = Field(...) + current_semester_id: str = Field(...) class Config: - schema_extra = {"example": {"curSemesterID": "61ddea901311ecaed99afb7f"}} + schema_extra = {"example": {"current_semester_id": "61ddea901311ecaed99afb7f"}} class UpdateEntranceYearModel(BaseModel): - entranceYear: int = Field(...) + entrance_year: int = Field(...) class Config: - schema_extra = {"example": {"entranceYear": 2018,}} + schema_extra = {"example": {"entrance_year": 2018,}} class UpdateUniversityModel(BaseModel): - curUniversityID: str = Field(...) + current_university_id: str = Field(...) class Config: - schema_extra = {"example": {"curUniversityID": "61ddea901311ecaed99afb7g"}} + schema_extra = { + "example": {"current_university_id": "61ddea901311ecaed99afb7g"} + } class MessageCreate(BaseModel): diff --git a/backend/app/routers/user_routers/user_routers.py b/backend/app/routers/user_routers/user_routers.py index 42f6fa5..7deba02 100644 --- a/backend/app/routers/user_routers/user_routers.py +++ b/backend/app/routers/user_routers/user_routers.py @@ -33,10 +33,11 @@ async def create_user(request: Request, user: UserModel = Body(...)): """Create a user""" user = jsonable_encoder(user) - user["userGroup"] = "default" - user["curSemesterID"] = "null" - user["curUniversityID"] = "null" - user["entranceYear"] = 0 + user["user_group"] = "default" + user["current_semester_id"] = "null" + user["current_university_id"] = "null" + user["entrance_year"] = 0 + user["current_gpa"] = 0.0 if (await request.app.mongodb["users"].find_one({"email": user["email"]})) is None: user["password"] = bcrypt.hash(user["password"]) From d54f3544f42876e35312e1f4b272ebc369c3d191 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 6 Mar 2022 22:02:31 +0300 Subject: [PATCH 02/21] update university models and lesson section logic --- backend/app/dependencies.py | 8 +- backend/app/models/uni_models.py | 165 +++++++++++------- .../university_routers/schedule_routers.py | 2 +- .../uni_cur_lesson_routers.py | 6 +- .../uni_cur_semester_routers.py | 6 +- .../uni_curriculum_routers.py | 6 +- .../uni_department_routers.py | 6 +- .../university_routers/uni_lesson_routers.py | 130 ++------------ .../routers/university_routers/uni_routers.py | 16 +- .../university_routers/uni_section_routers.py | 104 +++++++++-- .../uni_semester_routers.py | 29 ++- .../routers/user_routers/semester_routers.py | 10 +- .../app/routers/user_routers/user_routers.py | 28 +-- 13 files changed, 264 insertions(+), 252 deletions(-) diff --git a/backend/app/dependencies.py b/backend/app/dependencies.py index bb2e6fc..4be11d9 100644 --- a/backend/app/dependencies.py +++ b/backend/app/dependencies.py @@ -30,10 +30,10 @@ async def create_admin_user(request: Request): email=settings.ADMIN_USERNAME, password=bcrypt.hash(settings.ADMIN_PASSWORD) ) user = jsonable_encoder(user) - user["userGroup"] = "admin" - user["curSemesterID"] = "null" - user["curUniversityID"] = "null" - user["entranceYear"] = 0 + user["user_group"] = "admin" + user["current_semester_id"] = "null" + user["current_university_id"] = "null" + user["entrance_year"] = 0 res = await request["users"].insert_one(user) if res.inserted_id is None: raise HTTPException(status_code=500, detail="Could not create admin user") diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index ef7b7c7..a25ebe5 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -7,31 +7,36 @@ class UniversitySlotModel(BaseModel): + id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") + room: str = Field(max_length=100) day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) - isLab: int = Field(..., ge=0, le=1) + is_lab: int = Field(..., ge=0, le=1) + + class Config: + allow_population_by_field_name = True + arbitrary_types_allowed = True + json_encoders = {ObjectId: str} + schema_extra = {"example": {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}} class UniversitySectionModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - section: int = Field(..., ge=0) + number: int = Field(..., ge=0) instructor: str = Field(..., min_length=1, max_length=127) - slots: List[UniversitySlotModel] = Field(...) + slots: List[UniversitySlotModel] = Field() class Config: allow_population_by_field_name = True arbitrary_types_allowed = True - json_encoders = { - ObjectId: str, - UniversitySlotModel: lambda x: [x.day, x.hour, x.isLab], - } + json_encoders = {ObjectId: str} schema_extra = { "example": { - "section": 1, + "number": 1, "instructor": "Jack Joe", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], } } @@ -39,17 +44,32 @@ class Config: class UniversitySectionAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") - section: Optional[int] + number: Optional[int] instructor: Optional[str] - slots: Optional[List[List[int]]] + slots: Optional[List[UniversitySlotModel]] class Config: allow_population_by_field_name = True schema_extra = { "example": { - "section": 1, + "number": 1, "instructor": "Jack Joe", - "slots": [[2, 7, 0], [2, 8, 0]], + "slots": [ + { + "_id": "61ddea901311ecaed99afb7c", + "room": "F0D01", + "day": 2, + "hour": 7, + "is_lab": 0, + }, + { + "_id": "61ddea901311ecaed99afb7d", + "room": "F0D01", + "day": 2, + "hour": 8, + "is_lab": 0, + }, + ], } } @@ -60,29 +80,18 @@ class UniversityLessonModel(BaseModel): code: str = Field(..., min_length=1, max_length=10) ects: float = Field(..., ge=0) absence_limit: int = Field(..., ge=0) - section: int = Field(..., ge=0) - instructor: str = Field(..., min_length=1, max_length=127) - slots: List[UniversitySlotModel] = Field(...) + sections: List[UniversitySectionAPIModel] = [] class Config: allow_population_by_field_name = True arbitrary_types_allowed = True - json_encoders = { - ObjectId: str, - UniversitySlotModel: lambda x: [x.day, x.hour, x.isLab], - } + json_encoders = {ObjectId: str} schema_extra = { "example": { "name": "ART OF COMPUTING", "code": "COMP101", "ects": 6, "absence_limit": 8, - "section": 1, - "instructor": "Jack Joe", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], } } @@ -101,10 +110,34 @@ class Config: json_encoders = {ObjectId: str} schema_extra = { "example": { + "_id": "61ddea901311ecaed99afb7c", "name": "ART OF COMPUTING", "code": "COMP101", "ects": 6, "absence_limit": 0, + "sections": [ + { + "_id": "61ddea901311ecaed99afb7c", + "number": 1, + "instructor": "Jack Joe", + "slots": [ + { + "_id": "61ddea901311ecaed99afb7c", + "room": "F0D01", + "day": 2, + "hour": 7, + "is_lab": 0, + }, + { + "_id": "61ddea901311ecaed99afb7d", + "room": "F0D01", + "day": 2, + "hour": 8, + "is_lab": 0, + }, + ], + } + ], } } @@ -114,14 +147,23 @@ class UniversitySemesterModel(BaseModel): name: str = Field(...) lessons: List[UniversityLessonAPIModel] = [] + class Config: + allow_population_by_field_name = True + arbitrary_types_allowed = True + json_encoders = {ObjectId: str} + schema_extra = {"example": {"name": "20-21 Spring",}} + + +class UniversitySemesterAPIModel(BaseModel): + id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") + name: str = Field(...) + class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} schema_extra = { - "example": { - "name": "20-21 Spring", - } + "example": {"_id": "61fc266ae3d749b1d65c17c6", "name": "20-21 Spring",} } @@ -136,24 +178,24 @@ class Config: arbitrary_types_allowed = True json_encoders = {ObjectId: str} schema_extra = { - "example": {"name": "PHYSICS I", "code": "PHYS101", "lesson_type": "science"} + "example": { + "name": "PHYSICS I", + "code": "PHYS101", + "lesson_type": "science", + } } class CurriculumSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - semester: int = Field(..., gt=0, lt=20) + number: int = Field(..., gt=0, lt=20) lessons: List[CurriculumLessonModel] = [] class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} - schema_extra = { - "example": { - "semester": 1, - } - } + schema_extra = {"example": {"number": 1,}} class UniversityCurriculumModel(BaseModel): @@ -174,31 +216,27 @@ class Config: class UniversityDepartmentModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(..., min_length=2 ,max_length=100) + name: str = Field(..., min_length=2, max_length=100) curriculums: List[UniversityCurriculumModel] = [] class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} - schema_extra = { - "example": { - "name": "COMP", - } - } + schema_extra = {"example": {"name": "COMP",}} class UniversityModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=2, max_length=100) - domain: str = Field(..., min_length=5, max_length=100), - country: str = Field(..., min_length=2, max_length=100), - city: str = Field(..., min_length=2, max_length=100), - address: str = Field(..., min_length=2, max_length=100), - zip_code: str = Field(..., min_length=2, max_length=100), - description: str = Field(..., max_length=255), - logo: str = Field(..., max_length=255), - cover_photo: str = Field(..., max_length=255), + domain: str = Field(..., min_length=5, max_length=100) + country: str = Field(..., min_length=2, max_length=100) + city: str = Field(..., min_length=2, max_length=100) + address: str = Field(..., min_length=2, max_length=100) + zip_code: str = Field(..., min_length=2, max_length=100) + description: str = Field(..., max_length=255) + logo: str = Field(..., max_length=255) + cover_photo: str = Field(..., max_length=255) departments: List[UniversityDepartmentModel] = [] semesters: List[UniversitySemesterModel] = [] @@ -224,15 +262,15 @@ class Config: class UniversityAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") name: Optional[str] - domain: Optional[str] - country: Optional[str] - city: Optional[str] - address: Optional[str] + domain: Optional[str] + country: Optional[str] + city: Optional[str] + address: Optional[str] zip_code: Optional[str] - description: Optional[str] - logo: Optional[str] - cover_photo: Optional[str] - cur_semester_id: Optional[str] + description: Optional[str] + logo: Optional[str] + cover_photo: Optional[str] + current_semester_id: Optional[str] class Config: allow_population_by_field_name = True @@ -250,7 +288,7 @@ class Config: "description": "Test University Description", "logo": "test_logo.png", "cover_photo": "test_cover_photo.png", - "cur_semester_id": "61fc266ae3d749b1d65c17c7", + "current_semester_id": "61fc266ae3d749b1d65c17c7", } } @@ -259,8 +297,5 @@ class UpdateUniversityNameModel(BaseModel): name: str = Field(...) class Config: - schema_extra = { - "example": { - "name": "AGU", - } - } + schema_extra = {"example": {"name": "AGU",}} + diff --git a/backend/app/routers/university_routers/schedule_routers.py b/backend/app/routers/university_routers/schedule_routers.py index d651d3f..92c3c27 100644 --- a/backend/app/routers/university_routers/schedule_routers.py +++ b/backend/app/routers/university_routers/schedule_routers.py @@ -35,7 +35,7 @@ async def create_schedule(unid: str, lesson_codes: List[str], request: Request): content={"message": "University not found"}, ) - current_semester_id = university["curSemesterID"] + current_semester_id = university["current_semester_id"] if not current_semester_id: return JSONResponse( status_code=status.HTTP_404_NOT_FOUND, diff --git a/backend/app/routers/university_routers/uni_cur_lesson_routers.py b/backend/app/routers/university_routers/uni_cur_lesson_routers.py index fd9ff73..47f9ffc 100644 --- a/backend/app/routers/university_routers/uni_cur_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_cur_lesson_routers.py @@ -35,7 +35,7 @@ async def create_curriculum_lesson( ): """Create lesson for a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": curriculum_lesson = jsonable_encoder(curriculum_lesson) if ( @@ -195,7 +195,7 @@ async def update_curriculum_lesson( ): """Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": curriculum_lesson = jsonable_encoder(curriculum_lesson) if ( @@ -326,7 +326,7 @@ async def delete_curriculum_lesson( ): """Delete a lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": delete_result = await request.app.mongodb["universities"].update_one( { "_id": unid, diff --git a/backend/app/routers/university_routers/uni_cur_semester_routers.py b/backend/app/routers/university_routers/uni_cur_semester_routers.py index c6faadd..db0bf52 100644 --- a/backend/app/routers/university_routers/uni_cur_semester_routers.py +++ b/backend/app/routers/university_routers/uni_cur_semester_routers.py @@ -34,7 +34,7 @@ async def create_curriculum_semester( ): """Create semester for a curriculum with given universityID, universityDepartmentID and departmentCurriculumID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": curriculum_semester = jsonable_encoder(curriculum_semester) if ( @@ -175,7 +175,7 @@ async def update_curriculum_semester( ): """Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": curriculum_semester = { k: v for k, v in curriculum_semester.dict().items() if v is not None } @@ -257,7 +257,7 @@ async def delete_curriculum_semester( ): """Delete a university department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": delete_result = await request.app.mongodb["universities"].update_one( { "_id": unid, diff --git a/backend/app/routers/university_routers/uni_curriculum_routers.py b/backend/app/routers/university_routers/uni_curriculum_routers.py index 4b8f9a0..a758e88 100644 --- a/backend/app/routers/university_routers/uni_curriculum_routers.py +++ b/backend/app/routers/university_routers/uni_curriculum_routers.py @@ -33,7 +33,7 @@ async def create_department_curriculum( ): """Create department for a university with given universityID and universityDepartmentID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": department_curriculum = jsonable_encoder(department_curriculum) if ( @@ -152,7 +152,7 @@ async def update_department_curriculum( ): """Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": department_curriculum = { k: v for k, v in department_curriculum.dict().items() if v is not None } @@ -241,7 +241,7 @@ async def delete_department_curriculum( ): """Delete a university department with given universityID, universityDepartmentID and departmentCurriculumID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": delete_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "departments._id": depid,}, {"$pull": {"departments.$.curriculums": {"_id": curid}}}, diff --git a/backend/app/routers/university_routers/uni_department_routers.py b/backend/app/routers/university_routers/uni_department_routers.py index d024319..39d3638 100644 --- a/backend/app/routers/university_routers/uni_department_routers.py +++ b/backend/app/routers/university_routers/uni_department_routers.py @@ -38,7 +38,7 @@ async def create_university_department( ): """Create department for a university with given universityID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_department = jsonable_encoder(university_department) if ( @@ -140,7 +140,7 @@ async def update_university_department( ): """Update department of a university with given universityID and universityDepartmentID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_department = { k: v for k, v in university_department.dict().items() if v is not None } @@ -193,7 +193,7 @@ async def delete_university_department( ): """Delete a university department with given universityID and universitySemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": delete_result = await request.app.mongodb["universities"].update_one( {"_id": unid}, {"$pull": {"departments": {"_id": depid}}} ) diff --git a/backend/app/routers/university_routers/uni_lesson_routers.py b/backend/app/routers/university_routers/uni_lesson_routers.py index 8445f16..9116d08 100644 --- a/backend/app/routers/university_routers/uni_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_lesson_routers.py @@ -9,7 +9,6 @@ from ...models.uni_models import ( UniversityLessonAPIModel, UniversityLessonModel, - UniversitySectionModel, ) from ...models.user_models import Message, MessageCreate, UserModel @@ -37,124 +36,23 @@ async def create_university_lesson( ): """Create a lesson for a semester of a university with given universityID and universitySemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_lesson = jsonable_encoder(university_lesson) - section = UniversitySectionModel( - section=university_lesson["section"], - instructor=university_lesson["instructor"], - slots=university_lesson["slots"], - ) - section = section.json(by_alias=True, models_as_dict=False) - section = json.loads(section.replace("\\", "")) - - if ( - await request.app.mongodb["universities"].find_one( - { - "_id": unid, - "semesters._id": unisid, - "semesters.lessons.code": university_lesson["code"], - } - ) - ) is not None: - if await ( - request.app.mongodb["universities"] - .aggregate( - [ - { - "$match": { - "_id": unid, - "semesters._id": unisid, - "semesters.lessons.code": university_lesson["code"], - }, - }, - {"$unwind": "$semesters"}, - {"$unwind": "$semesters.lessons"}, - { - "$match": { - "semesters.lessons.code": university_lesson["code"], - "semesters.lessons.sections.section": university_lesson[ - "section" - ], - }, - }, - ] - ) - .to_list(length=None) - ): - return JSONResponse( - status_code=status.HTTP_409_CONFLICT, - content={"message": "University lesson section already exists"}, - ) - - update_result = await request.app.mongodb["universities"].update_one( - { - "_id": unid, - "semesters._id": unisid, - "semesters.lessons.code": university_lesson["code"], - }, - {"$push": {"semesters.$[i].lessons.$[j].sections": section}}, - array_filters=[ - {"i._id": unisid}, - {"j.code": university_lesson["code"]}, - ], - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_201_CREATED, - content=jsonable_encoder( - MessageCreate( - id=section["_id"], - message="University lesson section created", - ) - ), - ) - - return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "University lesson section could not be created"}, - ) - - new_lesson = UniversityLessonAPIModel( - name=university_lesson["name"], - code=university_lesson["code"], - ects=university_lesson["ects"], - absenceLimit=university_lesson["absenceLimit"], - sections=[], - ) - new_lesson = new_lesson.json(by_alias=True, models_as_dict=False) - new_lesson = json.loads(new_lesson.replace("\\", "")) - update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid}, - {"$push": {"semesters.$.lessons": new_lesson}}, + {"$push": {"semesters.$.lessons": university_lesson}}, ) if update_result.modified_count == 1: - update_result = await request.app.mongodb["universities"].update_one( - { - "_id": unid, - "semesters._id": unisid, - "semesters.lessons.code": new_lesson["code"], - }, - {"$push": {"semesters.$[i].lessons.$[j].sections": section}}, - array_filters=[{"i._id": unisid}, {"j.code": new_lesson["code"]},], - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_201_CREATED, - content=jsonable_encoder( - MessageCreate( - id=new_lesson["_id"], message="University lesson created", - ) - ), - ) - return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "University lesson could not be created"}, + status_code=status.HTTP_201_CREATED, + content=jsonable_encoder( + MessageCreate( + id=university_lesson["_id"], + message="University lesson created", + ) + ), ) return JSONResponse( @@ -284,12 +182,12 @@ async def update_university_lesson( unisid: str, unilid: str, request: Request, - university_lesson: UniversityLessonAPIModel = Body(...), + university_lesson: UniversityLessonModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_lesson = university_lesson.json(by_alias=True, models_as_dict=False) university_lesson = json.loads(university_lesson.replace("\\", "")) @@ -345,8 +243,8 @@ async def update_university_lesson( "semesters.$[i].lessons.$[j].name": university_lesson["name"], "semesters.$[i].lessons.$[j].code": university_lesson["code"], "semesters.$[i].lessons.$[j].ects": university_lesson["ects"], - "semesters.$[i].lessons.$[j].absenceLimit": university_lesson[ - "absenceLimit" + "semesters.$[i].lessons.$[j].absence_limit": university_lesson[ + "absence_limit" ], } }, @@ -389,7 +287,7 @@ async def delete_university_lesson( ): """Delete a university lesson with given universityID, universitySemesterID and universityLessonID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid}, {"$pull": {"semesters.$.lessons": {"_id": unilid}}}, diff --git a/backend/app/routers/university_routers/uni_routers.py b/backend/app/routers/university_routers/uni_routers.py index 28f1f2c..95a5d03 100644 --- a/backend/app/routers/university_routers/uni_routers.py +++ b/backend/app/routers/university_routers/uni_routers.py @@ -35,9 +35,9 @@ async def create_university( ): """Create a university""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university = jsonable_encoder(university) - university["curSemesterID"] = "null" + university["current_semester_id"] = "null" if await request.app.mongodb["universities"].find_one( {"name": university["name"]} @@ -131,7 +131,7 @@ async def update_university_name( ): """Update name of a university with given universityID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_name = jsonable_encoder(university_name) if ( @@ -184,12 +184,12 @@ async def update_university_current_semester( ): """Update current semester of a university with given universityID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": current_semester = jsonable_encoder(current_semester) if ( await request.app.mongodb["universities"].find_one( - {"_id": unid, "semesters._id": current_semester["curSemesterID"]} + {"_id": unid, "semesters._id": current_semester["current_semester_id"]} ) ) is None: return JSONResponse( @@ -199,7 +199,7 @@ async def update_university_current_semester( update_result = await request.app.mongodb["universities"].update_one( {"_id": unid}, - {"$set": {"curSemesterID": current_semester["curSemesterID"]}}, + {"$set": {"current_semester_id": current_semester["current_semester_id"]}}, ) if update_result.modified_count == 1: @@ -237,7 +237,7 @@ async def show_university_current_semester(unid: str, request: Request): {"$unwind": "$semesters"}, { "$match": { - "$expr": {"$eq": ["$semesters._id", "$curSemesterID"]} + "$expr": {"$eq": ["$semesters._id", "$current_semester_id"]} } }, ] @@ -265,7 +265,7 @@ async def delete_university( ): """Delete a university with given universityID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": delete_result = await request.app.mongodb["universities"].delete_one( {"_id": unid} ) diff --git a/backend/app/routers/university_routers/uni_section_routers.py b/backend/app/routers/university_routers/uni_section_routers.py index 601ec4e..89b4656 100644 --- a/backend/app/routers/university_routers/uni_section_routers.py +++ b/backend/app/routers/university_routers/uni_section_routers.py @@ -1,15 +1,97 @@ import json from fastapi import APIRouter, Body, Depends, Request, status +from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from ...dependencies import get_current_user from ...models.uni_models import UniversitySectionModel -from ...models.user_models import Message, UserModel +from ...models.user_models import Message, MessageCreate, UserModel router = APIRouter() +@router.post( + "/{unid}/semesters/{unisid}/lessons/{unilid}/sections", + response_description="Add a lesson section", + operation_id="addLessonSection", + response_model=Message, + responses={ + 201: {"model": MessageCreate}, + 403: {"model": Message}, + 404: {"model": Message}, + 409: {"model": Message}, + }, +) +async def create_lesson_section( + unid: str, + unisid: str, + unilid: str, + request: Request, + new_section: UniversitySectionModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Create a university section""" + + if auth_user["user_group"] == "professor": + new_section = jsonable_encoder(new_section) + + if await ( + request.app.mongodb["universities"] + .aggregate( + [ + { + "$match": { + "_id": unid, + "semesters._id": unisid, + "semesters.lessons._id": unilid, + }, + }, + {"$unwind": "$semesters"}, + {"$unwind": "$semesters.lessons"}, + { + "$match": { + "semesters.lessons._id": unilid, + "semesters.lessons.sections.number": new_section["number"], + }, + }, + ] + ) + .to_list(length=None) + ): + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={"message": "University lesson section already exists"}, + ) + + update_result = await request.app.mongodb["universities"].update_one( + {"_id": unid, "semesters._id": unisid, "semesters.lessons._id": unilid,}, + {"$push": {"semesters.$[i].lessons.$[j].sections": new_section}}, + array_filters=[{"i._id": unisid}, {"j._id": unilid},], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_201_CREATED, + content=jsonable_encoder( + MessageCreate( + id=new_section["_id"], + message="University lesson section created", + ) + ), + ) + + return JSONResponse( + status_code=status.HTTP_400_BAD_REQUEST, + content={"message": "University lesson section could not be created"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, + content={"message": "No right to access"}, + ) + + @router.put( "/{unid}/semesters/{unisid}/lessons/{unilid}/sections/{secid}", response_description="Update a lesson section", @@ -35,7 +117,7 @@ async def update_lesson_section( new_section = new_section.json(by_alias=True, models_as_dict=False) new_section = json.loads(new_section.replace("\\", "")) - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": if ( await ( @@ -56,8 +138,8 @@ async def update_lesson_section( "$match": { "semesters.lessons._id": unilid, "semesters.lessons.sections._id": secid, - "semesters.lessons.sections.section": new_section[ - "section" + "semesters.lessons.sections.number": new_section[ + "number" ], }, }, @@ -83,8 +165,8 @@ async def update_lesson_section( { "$match": { "semesters.lessons._id": unilid, - "semesters.lessons.sections.section": new_section[ - "section" + "semesters.lessons.sections.number": new_section[ + "number" ], }, }, @@ -92,7 +174,6 @@ async def update_lesson_section( ) .to_list(length=None) ) - is not None ): return JSONResponse( status_code=status.HTTP_409_CONFLICT, @@ -110,8 +191,8 @@ async def update_lesson_section( }, { "$set": { - "semesters.$[i].lessons.$[j].sections.$[k].section": new_section[ - "section" + "semesters.$[i].lessons.$[j].sections.$[k].number": new_section[ + "number" ], "semesters.$[i].lessons.$[j].sections.$[k].instructor": new_section[ "instructor" @@ -157,7 +238,7 @@ async def delete_lesson_section( ): """Delete a lesson section with given universityID, universitySemesterID, universityLessonID and sectionID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid, "semesters.lessons._id": unilid,}, {"$pull": {"semesters.$[i].lessons.$[j].sections": {"_id": secid}}}, @@ -166,7 +247,8 @@ async def delete_lesson_section( if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_200_OK, content={"message": "University lesson section deleted"}, + status_code=status.HTTP_200_OK, + content={"message": "University lesson section deleted"}, ) return JSONResponse( diff --git a/backend/app/routers/university_routers/uni_semester_routers.py b/backend/app/routers/university_routers/uni_semester_routers.py index d0a1c4b..c6b957a 100644 --- a/backend/app/routers/university_routers/uni_semester_routers.py +++ b/backend/app/routers/university_routers/uni_semester_routers.py @@ -8,7 +8,7 @@ from fastapi.responses import JSONResponse from ...dependencies import get_current_user -from ...models.uni_models import UniversitySemesterModel +from ...models.uni_models import UniversitySemesterAPIModel, UniversitySemesterModel from ...models.user_models import Message, MessageCreate, UpdateSemesterModel, UserModel router = APIRouter() @@ -33,7 +33,7 @@ async def create_university_semester( ): """Create semester for a university with given universityID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_semester = jsonable_encoder(university_semester) if await request.app.mongodb["universities"].find_one( @@ -50,12 +50,12 @@ async def create_university_semester( if new_semester.modified_count == 1: if (await request.app.mongodb["universities"].find_one({"_id": unid}))[ - "curSemesterID" + "current_semester_id" ] == "null": await update_university_current_semester( unid, request, - UpdateSemesterModel(curSemesterID=university_semester["_id"]), + UpdateSemesterModel(current_semester_id=university_semester["_id"]), auth_user, ) @@ -84,10 +84,8 @@ async def create_university_semester( "/{unid}/semesters", response_description="List all university semeseters", operation_id="listUniversitySemesters", - response_model=List[UniversitySemesterModel], - responses={ - 404: {"model": Message}, - }, + response_model=List[UniversitySemesterAPIModel], + responses={404: {"model": Message},}, ) async def list_university_semesters(unid: str, request: Request): """list all semesters of a university with given universityID""" @@ -108,9 +106,7 @@ async def list_university_semesters(unid: str, request: Request): response_description="List a university semeseters", operation_id="getSingleUniversitySemesters", response_model=UniversitySemesterModel, - responses={ - 404: {"model": Message}, - }, + responses={404: {"model": Message},}, ) async def show_university_semester(unid: str, unisid: str, request: Request): """Get a single semester of a university with given universityID and universitySemesterID""" @@ -155,7 +151,7 @@ async def update_university_semester( ): """Update university of a semester with given universityID and universitySemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": university_semester = { k: v for k, v in university_semester.dict().items() if v is not None } @@ -209,10 +205,7 @@ async def update_university_semester( response_description="Delete university semester", operation_id="deleteUniversitySemester", response_model=Message, - responses={ - 404: {"model": Message}, - 403: {"model": Message}, - }, + responses={404: {"model": Message}, 403: {"model": Message},}, ) async def delete_university_semester( unid: str, @@ -222,10 +215,10 @@ async def delete_university_semester( ): """Delete a university semester with given universityID and universitySemesterID""" - if auth_user["userGroup"] == "professor": + if auth_user["user_group"] == "professor": if ( await request.app.mongodb["universities"].find_one( - {"_id": unid, "curSemesterID": unisid} + {"_id": unid, "current_semester_id": unisid} ) ) is not None: return JSONResponse( diff --git a/backend/app/routers/user_routers/semester_routers.py b/backend/app/routers/user_routers/semester_routers.py index c9e070e..ec1fcba 100644 --- a/backend/app/routers/user_routers/semester_routers.py +++ b/backend/app/routers/user_routers/semester_routers.py @@ -65,7 +65,7 @@ async def create_semester( await update_current_semester( uid, request, - UpdateSemesterModel(curSemesterID=semester["_id"]), + UpdateSemesterModel(current_semester_id=semester["_id"]), auth_user, ) @@ -98,8 +98,7 @@ async def create_semester( }, ) async def list_semesters( - uid: str, - auth_user: UserModel = Depends(get_current_user), + uid: str, auth_user: UserModel = Depends(get_current_user), ): """list all semesters of a user with given userID""" @@ -245,7 +244,7 @@ async def delete_semester( """Delete a semester with given userID and semesterID""" if auth_user["_id"] == uid: - if auth_user["curSemesterID"] == sid: + if auth_user["current_semester_id"] == sid: return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content={"message": "Cannot delete current semester"}, @@ -257,8 +256,7 @@ async def delete_semester( if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Semester deleted"}, + status_code=status.HTTP_200_OK, content={"message": "Semester deleted"}, ) return JSONResponse( diff --git a/backend/app/routers/user_routers/user_routers.py b/backend/app/routers/user_routers/user_routers.py index 7deba02..c23c82b 100644 --- a/backend/app/routers/user_routers/user_routers.py +++ b/backend/app/routers/user_routers/user_routers.py @@ -208,7 +208,8 @@ async def update_current_semester( if len(semester) >= 1: update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, {"$set": {"curSemesterID": semester["curSemesterID"]}} + {"_id": uid}, + {"$set": {"current_semester_id": semester["current_semester_id"]}}, ) if update_result.matched_count == 1: @@ -259,7 +260,11 @@ async def update_current_university( update_result = await request.app.mongodb["users"].update_one( {"_id": uid}, - {"$set": {"curUniversityID": university["curUniversityID"]}}, + { + "$set": { + "current_university_id": university["current_university_id"] + } + }, ) if update_result.modified_count == 1: @@ -297,19 +302,20 @@ async def update_current_university( async def update_entrance_year( uid: str, request: Request, - entranceYear: UpdateEntranceYearModel = Body(...), + entrance_year: UpdateEntranceYearModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update entrance year of a user with given userID""" if auth_user["_id"] == uid: - entranceYear = {k: v for k, v in entranceYear.dict().items() if v is not None} + entrance_year = {k: v for k, v in entrance_year.dict().items() if v is not None} - if len(entranceYear) >= 1: + if len(entrance_year) >= 1: update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, {"$set": {"entranceYear": entranceYear["entranceYear"]}}, + {"_id": uid}, + {"$set": {"entrance_year": entrance_year["entrance_year"]}}, ) if update_result.modified_count == 1: @@ -351,13 +357,13 @@ async def create_professor_user( ): """Create a professor user""" - if auth_user["userGroup"] == "admin": + if auth_user["user_group"] == "admin": user = jsonable_encoder(user) - user["userGroup"] = "professor" - user["curSemesterID"] = "null" - user["curUniversityID"] = "null" - user["entranceYear"] = 0 + user["user_group"] = "professor" + user["current_semester_id"] = "null" + user["current_university_id"] = "null" + user["entrance_year"] = 0 if ( await request.app.mongodb["users"].find_one({"email": user["email"]}) From cda1ba59395d4c4ad9fc921a632fcdbb07c75f29 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 12 Mar 2022 12:09:38 +0300 Subject: [PATCH 03/21] update semester start hour --- backend/app/models/user_models.py | 38 ++++--- .../routers/user_routers/semester_routers.py | 101 +++++++----------- 2 files changed, 63 insertions(+), 76 deletions(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index bb48df3..5ee4f95 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -1,7 +1,8 @@ -from typing import Optional, List -from pydantic import BaseModel, Field, EmailStr from datetime import datetime +from typing import List, Optional + from bson import ObjectId +from pydantic import BaseModel, EmailStr, Field from .PyObjectId import PyObjectId @@ -108,9 +109,6 @@ class UpdateLessonModel(BaseModel): slots: List[SlotModel] = Field(...) class Config: - json_encoders = { - SlotModel: lambda x: [x.day, x.hour, x.isLab], - } schema_extra = { "example": { "name": "Algebra", @@ -127,12 +125,20 @@ class Config: } +class StartHourModel(BaseModel): + hour: int = Field(..., ge=0, le=23) + minute: int = Field(..., ge=0, le=59) + + class Confid: + schema_extra = {"example": {"hour": 8, "minute": 20}} + + class UserSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(...) start_date: datetime = Field(...) end_date: datetime = Field(...) - start_hour: str = Field(...) + start_hour: StartHourModel = Field(...) duration_lesson: int = Field(..., gt=0) duration_break: int = Field(..., gt=0) slot_count: int = Field(..., gt=3, lt=16) @@ -141,13 +147,16 @@ class UserSemesterModel(BaseModel): class Config: allow_population_by_field_name = True arbitrary_types_allowed = True - json_encoders = {ObjectId: str} + json_encoders = { + ObjectId: str, + StartHourModel: lambda x: [x.hour, x.minute], + } schema_extra = { "example": { "name": "2020-21 Spring", "start_date": "2022-02-18T00:00:00Z", "end_date": "2022-06-18T00:00:00Z", - "start_hour": "8.10", + "start_hour": {"hour": 8, "minute": 20}, "duration_lesson": 50, "duration_break": 10, "slot_count": 12, @@ -159,19 +168,22 @@ class UpdateUserSemesterModel(BaseModel): name: str = Field(...) start_date: datetime = Field(...) end_date: datetime = Field(...) - start_hour: str = Field(...) + start_hour: StartHourModel = Field(...) duration_lesson: int = Field(..., gt=0) duration_break: int = Field(..., gt=0) slot_count: int = Field(..., gt=3, lt=16) class Config: - allow_population_by_field_name = True + arbitrary_types_allowed = True + json_encoders = { + StartHourModel: lambda x: [x.hour, x.minute], + } schema_extra = { "example": { "name": "2020-21 Spring", "start_date": "2022-02-18T00:00:00Z", "end_date": "2022-06-18T00:00:00Z", - "start_hour": "8.10", + "start_hour": {"hour": 8, "minute": 20}, "duration_lesson": 50, "duration_break": 10, "slot_count": 12, @@ -184,7 +196,7 @@ class SemesterAPIModel(BaseModel): name: Optional[str] start_date: Optional[datetime] end_date: Optional[datetime] - start_hour: Optional[str] + start_hour: Optional[List[int]] duration_lesson: Optional[int] duration_break: Optional[int] slot_count: Optional[int] @@ -197,7 +209,7 @@ class Config: "name": "2020-21 Spring", "start_date": "2022-02-18T00:00:00Z", "end_date": "2022-06-18T00:00:00Z", - "start_hour": "8.10", + "start_hour": [8, 20], "duration_lesson": 50, "duration_break": 10, "slot_count": 12, diff --git a/backend/app/routers/user_routers/semester_routers.py b/backend/app/routers/user_routers/semester_routers.py index ec1fcba..4821a7d 100644 --- a/backend/app/routers/user_routers/semester_routers.py +++ b/backend/app/routers/user_routers/semester_routers.py @@ -1,3 +1,4 @@ +import json from typing import List from app.routers.user_routers.user_routers import update_current_semester @@ -40,20 +41,8 @@ async def create_semester( ): """Create a semester for a user with given userID""" - semester = jsonable_encoder(semester) - - resStartHour = semester["startHour"].split(".") - if ( - len(resStartHour) != 2 - or int(resStartHour[0]) < 0 - or int(resStartHour[0]) > 23 - or int(resStartHour[1]) < 0 - or int(resStartHour[1]) > 59 - ): - return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid start hour"}, - ) + semester = semester.json(by_alias=True, models_as_dict=False) + semester = json.loads(semester.replace("\\", "")) if auth_user["_id"] == uid: update_result = await request.app.mongodb["users"].update_one( @@ -103,12 +92,7 @@ async def list_semesters( """list all semesters of a user with given userID""" if auth_user["_id"] == uid: - semesters = [] - for semester in auth_user["semesters"]: - semester.pop("lessons") - semesters.append(semester) - - return semesters + return auth_user["semesters"] return JSONResponse( status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} @@ -135,9 +119,20 @@ async def show_semester( """Get a single semester with given userID and semesterID""" if auth_user["_id"] == uid: - for semester in auth_user["semesters"]: - if semester["_id"] == sid: - return semester + if ( + user := ( + await request.app.mongodb["users"] + .aggregate( + [ + {"$match": {"_id": uid}}, + {"$unwind": "$semesters"}, + {"$match": {"semesters._id": sid}}, + ] + ) + .to_list(length=None) + ) + ) : + return user[0]["semesters"] return JSONResponse( status_code=status.HTTP_404_NOT_FOUND, @@ -169,53 +164,33 @@ async def update_semester( ): """Update a semester with given userID and semesterID""" - semester = {k: v for k, v in semester.dict().items() if v is not None} - semester = jsonable_encoder(semester) - - resStartHour = semester["startHour"].split(".") - if ( - len(resStartHour) != 2 - or int(resStartHour[0]) < 0 - or int(resStartHour[0]) > 23 - or int(resStartHour[1]) < 0 - or int(resStartHour[1]) > 59 - ): - return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid start hour"}, - ) + semester = semester.json(by_alias=True, models_as_dict=False) + semester = json.loads(semester.replace("\\", "")) if auth_user["_id"] == uid: - if len(semester) >= 1: - update_result = await request.app.mongodb["users"].update_many( - {"_id": uid, "semesters._id": sid}, - { - "$set": { - "semesters.$.name": semester["name"], - "semesters.$.startDate": semester["startDate"], - "semesters.$.endDate": semester["endDate"], - "semesters.$.startHour": semester["startHour"], - "semesters.$.dLesson": semester["dLesson"], - "semesters.$.dBreak": semester["dBreak"], - "semesters.$.slotCount": semester["slotCount"], - } - }, - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Semester updated"}, - ) + update_result = await request.app.mongodb["users"].update_many( + {"_id": uid, "semesters._id": sid}, + { + "$set": { + "semesters.$.name": semester["name"], + "semesters.$.start_date": semester["start_date"], + "semesters.$.end_date": semester["end_date"], + "semesters.$.start_hour": semester["start_hour"], + "semesters.$.duration_lesson": semester["duration_lesson"], + "semesters.$.duration_break": semester["duration_break"], + "semesters.$.slot_count": semester["slot_count"], + } + }, + ) + if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Semester couldn't be updated"}, + status_code=status.HTTP_200_OK, content={"message": "Semester updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid input"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Semester couldn't be updated"}, ) return JSONResponse( From 6cb69e05f9f796f18982f9645788af230208f0c8 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 12 Mar 2022 20:55:58 +0300 Subject: [PATCH 04/21] update section logic from integer list to model --- backend/app/models/user_models.py | 36 +++--- .../routers/user_routers/lesson_routers.py | 108 ++++++++++++------ 2 files changed, 88 insertions(+), 56 deletions(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 5ee4f95..d82ab2f 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -8,10 +8,15 @@ class SlotModel(BaseModel): + room: str = Field(max_length=100) day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) is_lab: int = Field(..., ge=0, le=1) + class Config: + arbitrary_types_allowed = True + schema_extra = {"example": {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}} + class AbsenceModel(BaseModel): week: int = Field(..., ge=0) @@ -25,10 +30,10 @@ class LessonAbsenceModel(BaseModel): class Config: json_encoders = { - AbsenceModel: lambda x: [x.week, x.day, x.hour, x.isLab], + AbsenceModel: lambda x: [x.week, x.day, x.hour, x.is_lab], } schema_extra = { - "example": {"absence": {"week": 0, "day": 2, "hour": 7, "isLab": 0},} + "example": {"absence": {"week": 0, "day": 2, "hour": 7, "is_lab": 0},} } @@ -40,17 +45,13 @@ class LessonModel(BaseModel): ects: int = Field(..., ge=0) grade: float = Field(ge=0, le=10) absence_limit: int = Field(..., ge=0) - slots: List[SlotModel] = Field(...) + slots: List[SlotModel] = Field() absences: List[AbsenceModel] = [] class Config: allow_population_by_field_name = True arbitrary_types_allowed = True - json_encoders = { - ObjectId: str, - SlotModel: lambda x: [x.day, x.hour, x.isLab], - AbsenceModel: lambda x: [x.week, x.day, x.hour, x.isLab], - } + json_encoders = {ObjectId: str} schema_extra = { "example": { "name": "Algebra", @@ -60,12 +61,8 @@ class Config: "grade": 3.67, "absence_limit": 21, "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], - "absences": [ - {"week": 0, "day": 2, "hour": 7, "isLab": 0}, - {"week": 0, "day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], } } @@ -79,7 +76,7 @@ class LessonAPIModel(BaseModel): ects: Optional[int] grade: Optional[float] absence_limit: Optional[int] - slots: Optional[List[List[int]]] + slots: Optional[List[SlotModel]] absences: Optional[List[List[int]]] class Config: @@ -93,7 +90,10 @@ class Config: "ects": 5, "grade": 3.67, "absence_limit": 21, - "slots": [[2, 7, 0], [2, 8, 0]], + "slots": [ + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0,}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0,}, + ], "absences": [[0, 2, 7, 0], [0, 2, 8, 0]], } } @@ -118,8 +118,8 @@ class Config: "grade": 3.67, "absence_limit": 21, "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], } } diff --git a/backend/app/routers/user_routers/lesson_routers.py b/backend/app/routers/user_routers/lesson_routers.py index d050aac..9e8123f 100644 --- a/backend/app/routers/user_routers/lesson_routers.py +++ b/backend/app/routers/user_routers/lesson_routers.py @@ -40,10 +40,26 @@ async def create_lesson( ): """Create a lessons for a semester with given userID, semesterID""" - lesson = lesson.json(by_alias=True, models_as_dict=False) - lesson = json.loads(lesson.replace("\\", "")) - if auth_user["_id"] == uid: + + lesson = jsonable_encoder(lesson) + + if ( + await ( + request.app.mongodb["users"].find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons": {"$elemMatch": {"code": lesson["code"]}}, + } + ) + ).to_list(length=None) + ) != []: + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={"message": "Given lesson code already exists"}, + ) + update_result = await request.app.mongodb["users"].update_one( {"_id": uid, "semesters._id": sid}, {"$push": {"semesters.$.lessons": lesson}}, @@ -142,11 +158,7 @@ async def show_lesson( {"$unwind": "$semesters"}, {"$match": {"semesters._id": sid}}, {"$unwind": "$semesters.lessons"}, - { - "$match": { - "semesters.lessons._id": lid, - } - }, + {"$match": {"semesters.lessons._id": lid,}}, ] ) .to_list(length=None) @@ -185,21 +197,56 @@ async def update_lesson( ): """Update a lesson with given userID, semesterID and lessonID""" - lesson = lesson.json(by_alias=True, models_as_dict=False) - lesson = json.loads(lesson.replace("\\", "")) - if auth_user["_id"] == uid: + lesson = jsonable_encoder(lesson) + + if ( + await ( + request.app.mongodb["users"] + .find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons": { + "$elemMatch": {"_id": lid, "code": lesson["code"]} + }, + } + ) + .to_list(length=None) + ) + == [] + and ( + await request.app.mongodb["users"] + .find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons": {"$elemMatch": {"code": lesson["code"]}}, + } + ) + .to_list(length=None) + ) + != [] + ): + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={ + "message": "Given lesson code already exists or lesson not found" + }, + ) + update_result = await request.app.mongodb["users"].update_many( - { - "_id": uid, - "semesters._id": sid, - "semesters.lessons._id": lid, - }, + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, { "$set": { "semesters.$[i].lessons.$[j].name": lesson["name"], + "semesters.$[i].lessons.$[j].code": lesson["code"], "semesters.$[i].lessons.$[j].instructor": lesson["instructor"], - "semesters.$[i].lessons.$[j].absenceLimit": lesson["absenceLimit"], + "semesters.$[i].lessons.$[j].ects": lesson["ects"], + "semesters.$[i].lessons.$[j].grade": lesson["grade"], + "semesters.$[i].lessons.$[j].absence_limit": lesson[ + "absence_limit" + ], "semesters.$[i].lessons.$[j].slots": lesson["slots"], } }, @@ -208,8 +255,7 @@ async def update_lesson( if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Lesson updated"}, + status_code=status.HTTP_200_OK, content={"message": "Lesson updated"}, ) return JSONResponse( @@ -250,8 +296,7 @@ async def delete_lesson( if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Lesson deleted"}, + status_code=status.HTTP_200_OK, content={"message": "Lesson deleted"}, ) return JSONResponse( @@ -307,16 +352,8 @@ async def create_absence( ) update_result = await request.app.mongodb["users"].update_one( - { - "_id": uid, - "semesters._id": sid, - "semesters.lessons._id": lid, - }, - { - "$push": { - "semesters.$[i].lessons.$[j].absences": absence["absence"], - } - }, + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + {"$push": {"semesters.$[i].lessons.$[j].absences": absence["absence"],}}, array_filters=[{"i._id": sid}, {"j._id": lid}], ) @@ -363,19 +400,14 @@ async def delete_absence( if auth_user["_id"] == uid: update_result = await request.app.mongodb["users"].update_one( - { - "_id": uid, - "semesters._id": sid, - "semesters.lessons._id": lid, - }, + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, {"$pull": {"semesters.$[i].lessons.$[j].absences": absence["absence"]}}, array_filters=[{"i._id": sid}, {"j._id": lid}], ) if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Absence deleted"}, + status_code=status.HTTP_200_OK, content={"message": "Absence deleted"}, ) return JSONResponse( From 6ca7c18c20ed972f0b14e9ea329e2f9d4a54a7aa Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 12 Mar 2022 22:04:32 +0300 Subject: [PATCH 05/21] remove id from section slots --- backend/app/models/uni_models.py | 41 +++++++------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index a25ebe5..99ef404 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -1,13 +1,12 @@ -from typing import Optional, List -from pydantic import BaseModel, Field -from datetime import datetime +from typing import List, Optional + from bson import ObjectId +from pydantic import BaseModel, Field from .PyObjectId import PyObjectId class UniversitySlotModel(BaseModel): - id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") room: str = Field(max_length=100) day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) @@ -24,7 +23,7 @@ class UniversitySectionModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") number: int = Field(..., ge=0) instructor: str = Field(..., min_length=1, max_length=127) - slots: List[UniversitySlotModel] = Field() + slots: List[UniversitySlotModel] = [] class Config: allow_population_by_field_name = True @@ -55,20 +54,8 @@ class Config: "number": 1, "instructor": "Jack Joe", "slots": [ - { - "_id": "61ddea901311ecaed99afb7c", - "room": "F0D01", - "day": 2, - "hour": 7, - "is_lab": 0, - }, - { - "_id": "61ddea901311ecaed99afb7d", - "room": "F0D01", - "day": 2, - "hour": 8, - "is_lab": 0, - }, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0,}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0,}, ], } } @@ -121,20 +108,8 @@ class Config: "number": 1, "instructor": "Jack Joe", "slots": [ - { - "_id": "61ddea901311ecaed99afb7c", - "room": "F0D01", - "day": 2, - "hour": 7, - "is_lab": 0, - }, - { - "_id": "61ddea901311ecaed99afb7d", - "room": "F0D01", - "day": 2, - "hour": 8, - "is_lab": 0, - }, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0,}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0,}, ], } ], From 947db6515fe9b6b41ae77d43b46207a08020b6ba Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 12 Mar 2022 23:24:57 +0300 Subject: [PATCH 06/21] update slot and absence logic put absences into slots to be able to relate absence with slots --- backend/app/main.py | 2 + backend/app/models/user_models.py | 66 ++-- .../routers/user_routers/lesson_routers.py | 118 +----- .../app/routers/user_routers/slot_routers.py | 348 ++++++++++++++++++ 4 files changed, 395 insertions(+), 139 deletions(-) create mode 100644 backend/app/routers/user_routers/slot_routers.py diff --git a/backend/app/main.py b/backend/app/main.py index 08ea0fd..6dac52e 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -28,6 +28,7 @@ from .routers.university_routers.uni_semester_routers import ( router as uni_semester_router, ) +from .routers.user_routers.slot_routers import router as slot_router from .routers.user_routers.lesson_routers import router as lesson_router from .routers.user_routers.semester_routers import router as semester_router from .routers.user_routers.user_routers import router as user_router @@ -63,6 +64,7 @@ async def shutdown_db_client(): app.include_router(user_router, tags=["users"], prefix="/users") app.include_router(semester_router, tags=["semesters"], prefix="/users") app.include_router(lesson_router, tags=["lessons"], prefix="/users") +app.include_router(slot_router, tags=["slots"], prefix="/users") app.include_router(uni_router, tags=["universities"], prefix="/universities") app.include_router( uni_semester_router, tags=["university semesters"], prefix="/universities" diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index d82ab2f..73ff46b 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -7,33 +7,47 @@ from .PyObjectId import PyObjectId +class AbsenceModel(BaseModel): + week: int = Field(..., ge=1) + + class Config: + schema_extra = {"example": {"week": 1}} + + class SlotModel(BaseModel): + id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") room: str = Field(max_length=100) day: int = Field(..., ge=0, le=4) hour: int = Field(..., ge=0, le=15) is_lab: int = Field(..., ge=0, le=1) + absences: List[int] = [] class Config: + allow_population_by_field_name = True arbitrary_types_allowed = True + json_encoders = {ObjectId: str} schema_extra = {"example": {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}} -class AbsenceModel(BaseModel): - week: int = Field(..., ge=0) - day: int = Field(..., ge=0, le=4) - hour: int = Field(..., ge=0, le=15) - is_lab: int = Field(..., ge=0, le=1) - - -class LessonAbsenceModel(BaseModel): - absence: AbsenceModel = Field(...) +class SlotAPIModel(BaseModel): + id: Optional[str] = Field(alias="_id") + room: Optional[str] + day: Optional[int] + hour: Optional[int] + is_lab: Optional[int] + absences: Optional[List[int]] class Config: - json_encoders = { - AbsenceModel: lambda x: [x.week, x.day, x.hour, x.is_lab], - } + allow_population_by_field_name = True schema_extra = { - "example": {"absence": {"week": 0, "day": 2, "hour": 7, "is_lab": 0},} + "example": { + "_id": "61ddea901311ecaed99afb7c", + "room": "F0D01", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [1, 2], + } } @@ -46,7 +60,6 @@ class LessonModel(BaseModel): grade: float = Field(ge=0, le=10) absence_limit: int = Field(..., ge=0) slots: List[SlotModel] = Field() - absences: List[AbsenceModel] = [] class Config: allow_population_by_field_name = True @@ -76,8 +89,7 @@ class LessonAPIModel(BaseModel): ects: Optional[int] grade: Optional[float] absence_limit: Optional[int] - slots: Optional[List[SlotModel]] - absences: Optional[List[List[int]]] + slots: Optional[List[SlotAPIModel]] class Config: allow_population_by_field_name = True @@ -91,10 +103,21 @@ class Config: "grade": 3.67, "absence_limit": 21, "slots": [ - {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0,}, - {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0,}, + { + "room": "F0D01", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [1], + }, + { + "room": "F0D01", + "day": 2, + "hour": 8, + "is_lab": 0, + "absences": [2], + }, ], - "absences": [[0, 2, 7, 0], [0, 2, 8, 0]], } } @@ -106,7 +129,6 @@ class UpdateLessonModel(BaseModel): ects: int = Field(..., ge=0) grade: float = Field(ge=0, le=10) absence_limit: int = Field(..., ge=0) - slots: List[SlotModel] = Field(...) class Config: schema_extra = { @@ -117,10 +139,6 @@ class Config: "ects": 5, "grade": 3.67, "absence_limit": 21, - "slots": [ - {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, - {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, - ], } } diff --git a/backend/app/routers/user_routers/lesson_routers.py b/backend/app/routers/user_routers/lesson_routers.py index 9e8123f..22a6db2 100644 --- a/backend/app/routers/user_routers/lesson_routers.py +++ b/backend/app/routers/user_routers/lesson_routers.py @@ -1,4 +1,3 @@ -import json from typing import List from fastapi import APIRouter, Body, Depends, Request, status @@ -7,7 +6,6 @@ from ...dependencies import get_current_user from ...models.user_models import ( - LessonAbsenceModel, LessonAPIModel, LessonModel, Message, @@ -29,6 +27,7 @@ 401: {"model": Message}, 403: {"model": Message}, 404: {"model": Message}, + 409: {"model": Message}, }, ) async def create_lesson( @@ -185,6 +184,7 @@ async def show_lesson( 401: {"model": Message}, 403: {"model": Message}, 404: {"model": Message}, + 409: {"model": Message}, }, ) async def update_lesson( @@ -235,7 +235,7 @@ async def update_lesson( }, ) - update_result = await request.app.mongodb["users"].update_many( + update_result = await request.app.mongodb["users"].update_one( {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, { "$set": { @@ -247,7 +247,6 @@ async def update_lesson( "semesters.$[i].lessons.$[j].absence_limit": lesson[ "absence_limit" ], - "semesters.$[i].lessons.$[j].slots": lesson["slots"], } }, array_filters=[{"i._id": sid}, {"j._id": lid}], @@ -307,114 +306,3 @@ async def delete_lesson( return JSONResponse( status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} ) - - -@router.post( - "/{uid}/semesters/{sid}/lessons/{lid}/absences", - response_description="Add absence into a lesson", - operation_id="createAbsence", - response_model=Message, - responses={ - 201: {"model": Message}, - 400: {"model": Message}, - 401: {"model": Message}, - 403: {"model": Message}, - 404: {"model": Message}, - }, -) -async def create_absence( - uid: str, - sid: str, - lid: str, - request: Request, - absence: LessonAbsenceModel = Body(...), - auth_user: UserModel = Depends(get_current_user), -): - """Create an absence for a lesson with given userID, semesterID and lessonID""" - - absence = absence.json(models_as_dict=False) - absence = json.loads(absence.replace("\\", "")) - - if auth_user["_id"] == uid: - if ( - await request.app.mongodb["users"].find_one( - { - "_id": uid, - "semesters._id": sid, - "semesters.lessons._id": lid, - "semesters.lessons.absences": absence["absence"], - } - ) - ) is not None: - return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Absence already exists"}, - ) - - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, - {"$push": {"semesters.$[i].lessons.$[j].absences": absence["absence"],}}, - array_filters=[{"i._id": sid}, {"j._id": lid}], - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_201_CREATED, - content={"message": "Absence created"}, - ) - - return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Absence could not be created"}, - ) - - return JSONResponse( - status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} - ) - - -@router.delete( - "/{uid}/semesters/{sid}/lessons/{lid}/absences", - response_description="Delete absence into a lesson", - operation_id="deleteAbsence", - response_model=Message, - responses={ - 404: {"model": Message}, - 403: {"model": Message}, - 401: {"model": Message}, - 400: {"model": Message}, - }, -) -async def delete_absence( - uid: str, - sid: str, - lid: str, - request: Request, - absence: LessonAbsenceModel = Body(...), - auth_user: UserModel = Depends(get_current_user), -): - """Delete an absence from a lesson with given userID, semesterID and lessonID""" - - absence = absence.json(models_as_dict=False) - absence = json.loads(absence.replace("\\", "")) - - if auth_user["_id"] == uid: - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, - {"$pull": {"semesters.$[i].lessons.$[j].absences": absence["absence"]}}, - array_filters=[{"i._id": sid}, {"j._id": lid}], - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, content={"message": "Absence deleted"}, - ) - - return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Absence not found"}, - ) - - return JSONResponse( - status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} - ) diff --git a/backend/app/routers/user_routers/slot_routers.py b/backend/app/routers/user_routers/slot_routers.py new file mode 100644 index 0000000..b5bf98e --- /dev/null +++ b/backend/app/routers/user_routers/slot_routers.py @@ -0,0 +1,348 @@ +from fastapi import APIRouter, Body, Depends, Request, status +from fastapi.encoders import jsonable_encoder +from fastapi.responses import JSONResponse + +from ...dependencies import get_current_user +from ...models.user_models import ( + AbsenceModel, + Message, + MessageCreate, + SlotModel, + UserModel, +) + +router = APIRouter() + + +@router.post( + "/{uid}/semesters/{sid}/lessons/{lid}/slots", + response_description="Add new slot into a lesson", + operation_id="createSlot", + response_model=MessageCreate, + responses={ + 201: {"model": MessageCreate}, + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + 409: {"model": Message}, + }, +) +async def create_slot( + uid: str, + sid: str, + lid: str, + request: Request, + slot: SlotModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Create a slot for a lesson""" + + if auth_user["_id"] == uid: + + slot = jsonable_encoder(slot) + + if ( + await ( + request.app.mongodb["users"].find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lid, + "semesters.lessons.slots": { + "$elemMatch": {"day": slot["day"], "hour": slot["hour"]} + }, + } + ) + ).to_list(length=None) + ) != []: + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={"message": "Given slot already exists"}, + ) + + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + {"$push": {"semesters.$[i].lessons.$[j].slots": slot}}, + array_filters=[{"i._id": sid}, {"j._id": lid},], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_201_CREATED, + content=jsonable_encoder( + MessageCreate(id=slot["_id"], message="Slot created") + ), + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Slot could not be created"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.put( + "/{uid}/semesters/{sid}/lessons/{lid}/slots/{slid}", + response_description="Update a slot", + operation_id="updateSlot", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + 409: {"model": Message}, + }, +) +async def update_slot( + uid: str, + sid: str, + lid: str, + slid: str, + request: Request, + slot: SlotModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Update a slot of a lesson""" + + if auth_user["_id"] == uid: + slot = jsonable_encoder(slot) + + if ( + await ( + request.app.mongodb["users"] + .find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lid, + "semesters.lessons.slots": { + "$elemMatch": { + "_id": slid, + "day": slot["day"], + "hour": slot["hour"], + } + }, + } + ) + .to_list(length=None) + ) + == [] + and ( + await request.app.mongodb["users"] + .find( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lid, + "semesters.lessons.slots": { + "$elemMatch": {"day": slot["day"], "hour": slot["hour"]} + }, + } + ) + .to_list(length=None) + ) + != [] + ): + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={"message": "Given slot already exists or slot not found"}, + ) + + update_result = await request.app.mongodb["users"].update_one( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lid, + "semesters.lessons.slots._id": slid, + }, + { + "$set": { + "semesters.$[i].lessons.$[j].slots.$[k].room": slot["room"], + "semesters.$[i].lessons.$[j].slots.$[k].day": slot["day"], + "semesters.$[i].lessons.$[j].slots.$[k].hour": slot["hour"], + "semesters.$[i].lessons.$[j].slots.$[k].is_lab": slot["is_lab"], + } + }, + array_filters=[{"i._id": sid}, {"j._id": lid}, {"k._id": slid},], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, content={"message": "Slot updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Slot could not be updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.delete( + "/{uid}/semesters/{sid}/lessons/{lid}/slots/{slid}", + response_description="Delete a slot", + operation_id="deleteSlot", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def delete_slot( + uid: str, + sid: str, + lid: str, + slid: str, + request: Request, + auth_user: UserModel = Depends(get_current_user), +): + """Delete a slot of a lesson""" + + if auth_user["_id"] == uid: + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + {"$pull": {"semesters.$[i].lessons.$[j].slots": {"_id": slid}}}, + array_filters=[{"i._id": sid}, {"j._id": lid}], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, content={"message": "Slot deleted"}, + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Slot not found"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.post( + "/{uid}/semesters/{sid}/lessons/{lid}/absences/{slid}", + response_description="Add absence into a slot", + operation_id="createAbsence", + response_model=Message, + responses={ + 201: {"model": Message}, + 400: {"model": Message}, + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def create_absence( + uid: str, + sid: str, + lid: str, + slid: str, + request: Request, + absence: AbsenceModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Create an absence for a slot""" + + if auth_user["_id"] == uid: + absence = jsonable_encoder(absence) + + if ( + await request.app.mongodb["users"].find_one( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lid, + "semesters.lessons.slots": { + "$elemMatch": {"_id": slid, "absences": absence["week"],} + }, + } + ) + ) is not None: + return JSONResponse( + status_code=status.HTTP_400_BAD_REQUEST, + content={"message": "Absence already exists"}, + ) + + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + { + "$push": { + "semesters.$[i].lessons.$[j].slots.$[k].absences": absence["week"] + } + }, + array_filters=[{"i._id": sid}, {"j._id": lid}, {"k._id": slid}], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_201_CREATED, + content={"message": "Absence created"}, + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Absence could not be created"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.delete( + "/{uid}/semesters/{sid}/lessons/{lid}/absences/{slid}", + response_description="Delete absence into a slot", + operation_id="deleteAbsence", + response_model=Message, + responses={ + 404: {"model": Message}, + 403: {"model": Message}, + 401: {"model": Message}, + 400: {"model": Message}, + }, +) +async def delete_absence( + uid: str, + sid: str, + lid: str, + slid: str, + request: Request, + absence: AbsenceModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Delete an absence from a slot""" + + if auth_user["_id"] == uid: + absence = jsonable_encoder(absence) + + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + { + "$pull": { + "semesters.$[i].lessons.$[j].slots.$[k].absences": absence["week"] + } + }, + array_filters=[{"i._id": sid}, {"j._id": lid}, {"k._id": slid}], + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, content={"message": "Absence deleted"}, + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Absence not found"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) From 31e8f4f52893068255a1a0d65fe7244bd33a5348 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 00:10:46 +0300 Subject: [PATCH 07/21] sort absences while adding --- backend/app/routers/user_routers/slot_routers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/routers/user_routers/slot_routers.py b/backend/app/routers/user_routers/slot_routers.py index b5bf98e..207d85e 100644 --- a/backend/app/routers/user_routers/slot_routers.py +++ b/backend/app/routers/user_routers/slot_routers.py @@ -275,8 +275,11 @@ async def create_absence( {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, { "$push": { - "semesters.$[i].lessons.$[j].slots.$[k].absences": absence["week"] - } + "semesters.$[i].lessons.$[j].slots.$[k].absences": { + "$each": [absence["week"]], + "$sort": 1, + }, + }, }, array_filters=[{"i._id": sid}, {"j._id": lid}, {"k._id": slid}], ) From a307d5c8d0efafa9b78d9114d6bd18d974933671 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 00:50:10 +0300 Subject: [PATCH 08/21] update slot order while adding/updating slots --- .../routers/user_routers/lesson_routers.py | 16 ++++++++++++++ .../app/routers/user_routers/slot_routers.py | 21 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/backend/app/routers/user_routers/lesson_routers.py b/backend/app/routers/user_routers/lesson_routers.py index 22a6db2..498e0a6 100644 --- a/backend/app/routers/user_routers/lesson_routers.py +++ b/backend/app/routers/user_routers/lesson_routers.py @@ -65,6 +65,22 @@ async def create_lesson( ) if update_result.modified_count == 1: + await request.app.mongodb["users"].update_one( + { + "_id": uid, + "semesters._id": sid, + "semesters.lessons._id": lesson["_id"], + }, + { + "$push": { + "semesters.$[i].lessons.$[j].slots": { + "$each": [], + "$sort": {"day": 1, "hour": 1}, + }, + }, + }, + array_filters=[{"i._id": sid}, {"j._id": lesson["_id"]}], + ) return JSONResponse( status_code=status.HTTP_201_CREATED, content=jsonable_encoder( diff --git a/backend/app/routers/user_routers/slot_routers.py b/backend/app/routers/user_routers/slot_routers.py index 207d85e..e7244dd 100644 --- a/backend/app/routers/user_routers/slot_routers.py +++ b/backend/app/routers/user_routers/slot_routers.py @@ -62,7 +62,14 @@ async def create_slot( update_result = await request.app.mongodb["users"].update_one( {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, - {"$push": {"semesters.$[i].lessons.$[j].slots": slot}}, + { + "$push": { + "semesters.$[i].lessons.$[j].slots": { + "$each": [slot], + "$sort": {"day": 1, "hour": 1}, + } + } + }, array_filters=[{"i._id": sid}, {"j._id": lid},], ) @@ -170,6 +177,18 @@ async def update_slot( ) if update_result.modified_count == 1: + await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, + { + "$push": { + "semesters.$[i].lessons.$[j].slots": { + "$each": [], + "$sort": {"day": 1, "hour": 1}, + }, + }, + }, + array_filters=[{"i._id": sid}, {"j._id": lid}], + ) return JSONResponse( status_code=status.HTTP_200_OK, content={"message": "Slot updated"}, ) From 5a8c34649c757943c197f7e3e2d76b18d3ecb28d Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 01:17:14 +0300 Subject: [PATCH 09/21] update order of sections and slots while adding/updating sections --- .../university_routers/uni_section_routers.py | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/backend/app/routers/university_routers/uni_section_routers.py b/backend/app/routers/university_routers/uni_section_routers.py index 89b4656..f835096 100644 --- a/backend/app/routers/university_routers/uni_section_routers.py +++ b/backend/app/routers/university_routers/uni_section_routers.py @@ -66,11 +66,38 @@ async def create_lesson_section( update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid, "semesters.lessons._id": unilid,}, - {"$push": {"semesters.$[i].lessons.$[j].sections": new_section}}, + { + "$push": { + "semesters.$[i].lessons.$[j].sections": { + "$each": [new_section], + "$sort": {"number": 1}, + } + } + }, array_filters=[{"i._id": unisid}, {"j._id": unilid},], ) if update_result.modified_count == 1: + await request.app.mongodb["universities"].update_one( + { + "_id": unid, + "semesters._id": unisid, + "semesters.lessons._id": unilid, + }, + { + "$push": { + "semesters.$[i].lessons.$[j].sections.$[k].slots": { + "$each": [], + "$sort": {"day": 1, "hour": 1}, + }, + }, + }, + array_filters=[ + {"i._id": unisid}, + {"j._id": unilid}, + {"k._id": new_section["_id"]}, + ], + ) return JSONResponse( status_code=status.HTTP_201_CREATED, content=jsonable_encoder( @@ -206,6 +233,38 @@ async def update_lesson_section( ) if update_result.modified_count == 1: + await request.app.mongodb["universities"].update_one( + { + "_id": unid, + "semesters._id": unisid, + "semesters.lessons._id": unilid, + }, + { + "$push": { + "semesters.$[i].lessons.$[j].sections": { + "$each": [], + "$sort": {"number": 1}, + }, + }, + }, + array_filters=[{"i._id": unisid}, {"j._id": unilid}], + ) + await request.app.mongodb["universities"].update_one( + { + "_id": unid, + "semesters._id": unisid, + "semesters.lessons._id": unilid, + }, + { + "$push": { + "semesters.$[i].lessons.$[j].sections.$[k].slots": { + "$each": [], + "$sort": {"day": 1, "hour": 1}, + }, + }, + }, + array_filters=[{"i._id": unisid}, {"j._id": unilid}, {"k._id": secid},], + ) return JSONResponse( status_code=status.HTTP_200_OK, content={"message": "University lesson section updated"}, From 54491b8e068c0f5b330236a31dd61c25cf827140 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 12:09:12 +0300 Subject: [PATCH 10/21] do not let creating new university lesson with same code --- .../university_routers/uni_lesson_routers.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/app/routers/university_routers/uni_lesson_routers.py b/backend/app/routers/university_routers/uni_lesson_routers.py index 9116d08..0124fbb 100644 --- a/backend/app/routers/university_routers/uni_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_lesson_routers.py @@ -39,6 +39,20 @@ async def create_university_lesson( if auth_user["user_group"] == "professor": university_lesson = jsonable_encoder(university_lesson) + if ( + await request.app.mongodb["universities"].find_one( + { + "_id": unid, + "semesters._id": unisid, + "semesters.lessons.code": university_lesson["code"], + } + ) + ) is not None: + return JSONResponse( + status_code=status.HTTP_409_CONFLICT, + content={"message": "Given lesson code already exists",}, + ) + update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid}, {"$push": {"semesters.$.lessons": university_lesson}}, From e3f8fd742afc3f16778f65c69fcd690e4db7a280 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 12:58:18 +0300 Subject: [PATCH 11/21] add new attriubutes and routers to user and semester --- backend/app/models/user_models.py | 61 ++++- .../routers/user_routers/semester_routers.py | 47 +++- .../app/routers/user_routers/user_routers.py | 248 ++++++++++++------ 3 files changed, 266 insertions(+), 90 deletions(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 73ff46b..cf5b4d8 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -151,6 +151,13 @@ class Confid: schema_extra = {"example": {"hour": 8, "minute": 20}} +class UpdateSemesterGPAModel(BaseModel): + semester_gpa: float = Field(ge=0, le=10) + + class Config: + schema_extra = {"example": {"semester_gpa": 3.67}} + + class UserSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(...) @@ -160,6 +167,7 @@ class UserSemesterModel(BaseModel): duration_lesson: int = Field(..., gt=0) duration_break: int = Field(..., gt=0) slot_count: int = Field(..., gt=3, lt=16) + semester_gpa: float = Field(0.0, ge=0, le=10) lessons: List[LessonModel] = [] class Config: @@ -190,6 +198,7 @@ class UpdateUserSemesterModel(BaseModel): duration_lesson: int = Field(..., gt=0) duration_break: int = Field(..., gt=0) slot_count: int = Field(..., gt=3, lt=16) + semester_gpa: float = Field(..., ge=0, le=10) class Config: arbitrary_types_allowed = True @@ -218,6 +227,7 @@ class SemesterAPIModel(BaseModel): duration_lesson: Optional[int] duration_break: Optional[int] slot_count: Optional[int] + semester_gpa: Optional[float] class Config: allow_population_by_field_name = True @@ -231,6 +241,7 @@ class Config: "duration_lesson": 50, "duration_break": 10, "slot_count": 12, + "semester_gpa": 3.67, } } @@ -238,8 +249,13 @@ class Config: class UserModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") email: EmailStr = Field(...) - password: str = Field(...) - full_name: str = Field(...) + password: str = Field(..., max_length=32) + first_name: str = Field(..., max_length=32) + last_name: str = Field(..., max_length=32) + current_gpa: float = Field(3.67, ge=0, le=10.0) + current_semester_id: str = "null" + current_university_id: str = "null" + entrance_year: int = Field(2010, gt=2000) semesters: List[UserSemesterModel] = [] class Config: @@ -250,7 +266,8 @@ class Config: "example": { "email": "hello@agu.edu.tr", "password": "123456", - "full_name": "John Doe", + "first_name": "John", + "last_name": "Doe", } } @@ -258,7 +275,8 @@ class Config: class UserAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") email: Optional[EmailStr] - full_name: Optional[str] + first_name: Optional[str] + last_name: Optional[str] current_gpa: Optional[float] user_group: Optional[str] current_semester_id: Optional[str] @@ -271,8 +289,9 @@ class Config: "example": { "_id": "61ddea901311ecaed99afb7c", "email": "hello@agu.edu.tr", - "full_name": "John Doe", - "current_gpa": 4.0, + "first_name": "John", + "last_name": "Doe", + "current_gpa": 3.67, "user_group": "default", "current_semester_id": "61ddea901311ecaed99afb7d", "current_university_id": "61ddea901311ecaed99afb7e", @@ -282,10 +301,18 @@ class Config: class UpdatePasswordModel(BaseModel): - password: str = Field(...) + password: str = Field(..., max_length=32) + + class Config: + schema_extra = {"example": {"password": "123456"}} + + +class UpdateUserNameModel(BaseModel): + first_name: str = Field(..., max_length=32) + last_name: str = Field(..., max_length=32) class Config: - schema_extra = {"example": {"password": "123456",}} + schema_extra = {"example": {"first_name": "John", "last_name": "Doe"}} class UpdateSemesterModel(BaseModel): @@ -296,10 +323,10 @@ class Config: class UpdateEntranceYearModel(BaseModel): - entrance_year: int = Field(...) + entrance_year: int = Field(..., gt=2000) class Config: - schema_extra = {"example": {"entrance_year": 2018,}} + schema_extra = {"example": {"entrance_year": 2018}} class UpdateUniversityModel(BaseModel): @@ -311,6 +338,20 @@ class Config: } +class UpdateCurrentGPAModel(BaseModel): + current_gpa: float = Field(..., ge=0, le=10.0) + + class Config: + schema_extra = {"example": {"current_gpa": 3.67}} + + +class UpdateUserGroupModel(BaseModel): + user_group: str = Field(...) + + class Config: + schema_extra = {"example": {"user_group": "professor",}} + + class MessageCreate(BaseModel): id: str = Field(alias="_id") message: str diff --git a/backend/app/routers/user_routers/semester_routers.py b/backend/app/routers/user_routers/semester_routers.py index 4821a7d..e4cbc2e 100644 --- a/backend/app/routers/user_routers/semester_routers.py +++ b/backend/app/routers/user_routers/semester_routers.py @@ -11,6 +11,7 @@ Message, MessageCreate, SemesterAPIModel, + UpdateSemesterGPAModel, UpdateSemesterModel, UpdateUserSemesterModel, UserModel, @@ -168,7 +169,7 @@ async def update_semester( semester = json.loads(semester.replace("\\", "")) if auth_user["_id"] == uid: - update_result = await request.app.mongodb["users"].update_many( + update_result = await request.app.mongodb["users"].update_one( {"_id": uid, "semesters._id": sid}, { "$set": { @@ -198,6 +199,50 @@ async def update_semester( ) +@router.put( + "/{uid}/semesters/{sid}/semester-gpa", + response_description="Update gpa of a semester", + operation_id="updateSemesterGPA", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def update_semester_gpa( + uid: str, + sid: str, + request: Request, + semester_gpa: UpdateSemesterGPAModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Update gpa of a semester with given userID and semesterID""" + + semester_gpa = jsonable_encoder(semester_gpa) + + if auth_user["_id"] == uid: + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid, "semesters._id": sid}, + {"$set": {"semesters.$.semester_gpa": semester_gpa["semester_gpa"],}}, + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, + content={"message": "Semester GPA updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Semester GPA couldn't be updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + @router.delete( "/{uid}/semesters/{sid}", response_description="Delete semester", diff --git a/backend/app/routers/user_routers/user_routers.py b/backend/app/routers/user_routers/user_routers.py index c23c82b..059c35c 100644 --- a/backend/app/routers/user_routers/user_routers.py +++ b/backend/app/routers/user_routers/user_routers.py @@ -7,10 +7,13 @@ from ...models.user_models import ( Message, MessageCreate, + UpdateCurrentGPAModel, UpdateEntranceYearModel, UpdatePasswordModel, UpdateSemesterModel, UpdateUniversityModel, + UpdateUserGroupModel, + UpdateUserNameModel, UserAPIModel, UserModel, ) @@ -34,10 +37,6 @@ async def create_user(request: Request, user: UserModel = Body(...)): user = jsonable_encoder(user) user["user_group"] = "default" - user["current_semester_id"] = "null" - user["current_university_id"] = "null" - user["entrance_year"] = 0 - user["current_gpa"] = 0.0 if (await request.app.mongodb["users"].find_one({"email": user["email"]})) is None: user["password"] = bcrypt.hash(user["password"]) @@ -89,7 +88,7 @@ async def show_user( if ( user := await request.app.mongodb["users"].find_one({"_id": uid,}) ) is not None: - return auth_user + return user return JSONResponse( status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} @@ -116,30 +115,64 @@ async def update_password( """Update password of a user with given userID""" if auth_user["_id"] == uid: + password = jsonable_encoder(password) - password = {k: v for k, v in password.dict().items() if v is not None} - - if len(password) >= 1: + password["password"] = bcrypt.hash(password["password"]) + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, {"$set": {"password": password["password"]}} + ) - password["password"] = bcrypt.hash(password["password"]) - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, {"$set": {"password": password["password"]}} + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, content={"message": "Password updated"}, ) - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Password updated"}, - ) + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Password couldn't be updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.put( + "/{uid}/change-name", + response_description="Update first and last names of a user", + operation_id="updateName", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def update_user_name( + uid: str, + request: Request, + user_name: UpdateUserNameModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Update first and last names of a user with given userID""" + + if auth_user["_id"] == uid: + user_name = jsonable_encoder(user_name) + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, + {"$set": {"first_name": user_name["first_name"], "last_name": user_name["last_name"]}}, + ) + + if update_result.matched_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Password couldn't be updated"}, + status_code=status.HTTP_200_OK, + content={"message": "Name of given user updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid input"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Name of given user couldn't be updated"}, ) return JSONResponse( @@ -196,36 +229,28 @@ async def delete_user( async def update_current_semester( uid: str, request: Request, - semester: UpdateSemesterModel = Body(...), + current_semester: UpdateSemesterModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update current semester ID of a user with given userID""" if auth_user["_id"] == uid: + current_semester = jsonable_encoder(current_semester) - semester = {k: v for k, v in semester.dict().items() if v is not None} - - if len(semester) >= 1: - - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, - {"$set": {"current_semester_id": semester["current_semester_id"]}}, - ) - - if update_result.matched_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Current semester updated"}, - ) + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, + {"$set": {"current_semester_id": current_semester["current_semester_id"]}}, + ) + if update_result.matched_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Current semester couldn't be updated"}, + status_code=status.HTTP_200_OK, + content={"message": "Current semester updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid semester ID"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Current semester couldn't be updated"}, ) return JSONResponse( @@ -247,40 +272,33 @@ async def update_current_semester( async def update_current_university( uid: str, request: Request, - university: UpdateUniversityModel = Body(...), + current_university: UpdateUniversityModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update current university ID of a user with given userID""" if auth_user["_id"] == uid: - university = {k: v for k, v in university.dict().items() if v is not None} - - if len(university) >= 1: + current_university = jsonable_encoder(current_university) - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, - { - "$set": { - "current_university_id": university["current_university_id"] - } - }, - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Current university ID updated"}, - ) + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, + { + "$set": { + "current_university_id": current_university["current_university_id"] + } + }, + ) + if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "Current university ID couldn't be updated"}, + status_code=status.HTTP_200_OK, + content={"message": "Current university ID updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid university ID"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Current university ID couldn't be updated"}, ) return JSONResponse( @@ -291,7 +309,7 @@ async def update_current_university( @router.put( "/{uid}/entrance-year", response_description="Update entrance year of a user", - operation_id="updateEntranceyear", + operation_id="updateEntranceYear", response_model=Message, responses={ 401: {"model": Message}, @@ -308,30 +326,105 @@ async def update_entrance_year( """Update entrance year of a user with given userID""" if auth_user["_id"] == uid: + entrance_year = jsonable_encoder(entrance_year) - entrance_year = {k: v for k, v in entrance_year.dict().items() if v is not None} + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, {"$set": {"entrance_year": entrance_year["entrance_year"]}}, + ) - if len(entrance_year) >= 1: + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, + content={"message": "User entrance year updated"}, + ) - update_result = await request.app.mongodb["users"].update_one( - {"_id": uid}, - {"$set": {"entrance_year": entrance_year["entrance_year"]}}, + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "User entrance year couldn't be updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + + +@router.put( + "/{uid}/current-gpa", + response_description="Update current gpa of a user", + operation_id="updateCurrentGPA", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def update_current_gpa( + uid: str, + request: Request, + current_gpa: UpdateCurrentGPAModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Update entrance year of a user with given userID""" + + if auth_user["_id"] == uid: + current_gpa = jsonable_encoder(current_gpa) + + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, {"$set": {"current_gpa": current_gpa["current_gpa"]}}, + ) + + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, + content={"message": "User current GPA updated"}, ) - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "User entrance year updated"}, - ) + return JSONResponse( + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "User current GPA couldn't be updated"}, + ) + + return JSONResponse( + status_code=status.HTTP_403_FORBIDDEN, content={"message": "No right to access"} + ) + +@router.put( + "/admin/update-user-group/{uid}", + response_description="Update group of a user", + operation_id="updateUserGroup", + response_model=Message, + responses={ + 401: {"model": Message}, + 403: {"model": Message}, + 404: {"model": Message}, + }, +) +async def update_user_group( + uid: str, + request: Request, + user_group: UpdateUserGroupModel = Body(...), + auth_user: UserModel = Depends(get_current_user), +): + """Update group of a user with given userID""" + + if auth_user["user_group"] == "admin": + user_group = jsonable_encoder(user_group) + + update_result = await request.app.mongodb["users"].update_one( + {"_id": uid}, {"$set": {"user_group": user_group["user_group"]}}, + ) + + if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "User entrance year couldn't be updated"}, + status_code=status.HTTP_200_OK, + content={"message": "Group of given user updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid entrance year"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "Group of given user couldn't be updated"}, ) return JSONResponse( @@ -361,9 +454,6 @@ async def create_professor_user( user = jsonable_encoder(user) user["user_group"] = "professor" - user["current_semester_id"] = "null" - user["current_university_id"] = "null" - user["entrance_year"] = 0 if ( await request.app.mongodb["users"].find_one({"email": user["email"]}) From 26cc8ec64c304b453281b2e2baa015e2aa19c559 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 13:30:08 +0300 Subject: [PATCH 12/21] add router for updating universities with new attributes --- backend/app/models/uni_models.py | 54 +++++++++++++++--- .../routers/university_routers/uni_routers.py | 56 +++++++++++++------ 2 files changed, 85 insertions(+), 25 deletions(-) diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index 99ef404..bb6dea4 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -204,10 +204,12 @@ class Config: class UniversityModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=2, max_length=100) - domain: str = Field(..., min_length=5, max_length=100) + website: str = Field(..., min_length=5, max_length=255) country: str = Field(..., min_length=2, max_length=100) city: str = Field(..., min_length=2, max_length=100) address: str = Field(..., min_length=2, max_length=100) + phone: str = Field(..., min_length=2, max_length=100) + email: str = Field(..., min_length=2, max_length=100) zip_code: str = Field(..., min_length=2, max_length=100) description: str = Field(..., max_length=255) logo: str = Field(..., max_length=255) @@ -222,10 +224,12 @@ class Config: schema_extra = { "example": { "name": "Test University", - "domain": "test.com", + "website": "test.com", "country": "USA", "city": "Los Angeles", "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", "zip_code": "90210", "description": "Test University Description", "logo": "test_logo.png", @@ -237,10 +241,12 @@ class Config: class UniversityAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") name: Optional[str] - domain: Optional[str] + website: Optional[str] country: Optional[str] city: Optional[str] address: Optional[str] + phone: Optional[str] + email: Optional[str] zip_code: Optional[str] description: Optional[str] logo: Optional[str] @@ -249,16 +255,16 @@ class UniversityAPIModel(BaseModel): class Config: allow_population_by_field_name = True - arbitrary_types_allowed = True - json_encoders = {ObjectId: str} schema_extra = { "example": { "_id": "61fc266ae3d749b1d65c17c6", "name": "Test University", - "domain": "test.com", + "website": "test.com", "country": "USA", "city": "Los Angeles", "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", "zip_code": "90210", "description": "Test University Description", "logo": "test_logo.png", @@ -268,9 +274,39 @@ class Config: } -class UpdateUniversityNameModel(BaseModel): - name: str = Field(...) +class UpdateUniversityModel(BaseModel): + name: str = Field(..., min_length=2, max_length=100) + website: str = Field(..., min_length=5, max_length=255) + country: str = Field(..., min_length=2, max_length=100) + city: str = Field(..., min_length=2, max_length=100) + address: str = Field(..., min_length=2, max_length=100) + phone: str = Field(..., min_length=2, max_length=100) + email: str = Field(..., min_length=2, max_length=100) + zip_code: str = Field(..., min_length=2, max_length=100) + description: str = Field(..., max_length=255) + logo: str = Field(..., max_length=255) + cover_photo: str = Field(..., max_length=255) class Config: - schema_extra = {"example": {"name": "AGU",}} + schema_extra = { + "example": { + "name": "Test University", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + } + } + +class UpdateCurrentSemesterModel(BaseModel): + current_semester_id: str = Field(...) + + class Config: + schema_extra = {"example": {"current_semester_id": "61ddea901311ecaed99afb7f"}} diff --git a/backend/app/routers/university_routers/uni_routers.py b/backend/app/routers/university_routers/uni_routers.py index 95a5d03..511dd39 100644 --- a/backend/app/routers/university_routers/uni_routers.py +++ b/backend/app/routers/university_routers/uni_routers.py @@ -9,9 +9,10 @@ UniversityAPIModel, UniversityModel, UniversitySemesterModel, - UpdateUniversityNameModel, + UpdateCurrentSemesterModel, + UpdateUniversityModel, ) -from ...models.user_models import Message, MessageCreate, UpdateSemesterModel, UserModel +from ...models.user_models import Message, MessageCreate, UserModel router = APIRouter() @@ -113,9 +114,9 @@ async def show_university(unid: str, request: Request): @router.put( - "/{unid}/update-name", - response_description="Update a university name", - operation_id="updateUniversityName", + "/{unid}", + response_description="Update university", + operation_id="updateUniversity", response_model=Message, responses={ 404: {"model": Message}, @@ -123,41 +124,64 @@ async def show_university(unid: str, request: Request): 400: {"model": Message}, }, ) -async def update_university_name( +async def update_university( unid: str, request: Request, - university_name: UpdateUniversityNameModel = Body(...), + university: UpdateUniversityModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update name of a university with given universityID""" if auth_user["user_group"] == "professor": - university_name = jsonable_encoder(university_name) + university = jsonable_encoder(university) if ( - await request.app.mongodb["universities"].find_one( - {"name": university_name["name"]} + await ( + request.app.mongodb["universities"] + .find({"_id": unid, "name": university["name"]}) + .to_list(length=None) + ) + == [] + and await ( + request.app.mongodb["universities"] + .find({"name": university["name"]}) + .to_list(length=None) ) - is not None + != [] ): return JSONResponse( status_code=status.HTTP_409_CONFLICT, - content={"message": "University already exists"}, + content={"message": "Given university name already exists"}, ) update_result = await request.app.mongodb["universities"].update_one( - {"_id": unid}, {"$set": {"name": university_name["name"]}} + {"_id": unid}, + { + "$set": { + "name": university["name"], + "website": university["website"], + "country": university["country"], + "city": university["city"], + "address": university["address"], + "phone": university["phone"], + "email": university["email"], + "zip_code": university["zip_code"], + "description": university["description"], + "logo": university["logo"], + "cover_photo": university["cover_photo"], + } + }, ) if update_result.modified_count == 1: return JSONResponse( status_code=status.HTTP_200_OK, - content={"message": "University name updated"}, + content={"message": "University updated"}, ) return JSONResponse( status_code=status.HTTP_404_NOT_FOUND, - content={"message": "University not found"}, + content={"message": "University could not be updated"}, ) return JSONResponse( @@ -179,7 +203,7 @@ async def update_university_name( async def update_university_current_semester( unid: str, request: Request, - current_semester: UpdateSemesterModel = Body(...), + current_semester: UpdateCurrentSemesterModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update current semester of a university with given universityID""" From 92f3570b83f0337f1bed9422984a5f8547f4b9f0 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 18:15:30 +0300 Subject: [PATCH 13/21] update model for admin user --- backend/app/dependencies.py | 8 ++++---- backend/app/models/user_models.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/app/dependencies.py b/backend/app/dependencies.py index 4be11d9..08626e0 100644 --- a/backend/app/dependencies.py +++ b/backend/app/dependencies.py @@ -27,13 +27,13 @@ async def create_admin_user(request: Request): if await request["users"].find_one({"email": settings.ADMIN_USERNAME}) is None: user = UserModel( - email=settings.ADMIN_USERNAME, password=bcrypt.hash(settings.ADMIN_PASSWORD) + email=settings.ADMIN_USERNAME, + password=bcrypt.hash(settings.ADMIN_PASSWORD), + first_name="Admin", + last_name="User", ) user = jsonable_encoder(user) user["user_group"] = "admin" - user["current_semester_id"] = "null" - user["current_university_id"] = "null" - user["entrance_year"] = 0 res = await request["users"].insert_one(user) if res.inserted_id is None: raise HTTPException(status_code=500, detail="Could not create admin user") diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index cf5b4d8..e9a5b12 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -249,7 +249,7 @@ class Config: class UserModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") email: EmailStr = Field(...) - password: str = Field(..., max_length=32) + password: str = Field(...) first_name: str = Field(..., max_length=32) last_name: str = Field(..., max_length=32) current_gpa: float = Field(3.67, ge=0, le=10.0) @@ -301,7 +301,7 @@ class Config: class UpdatePasswordModel(BaseModel): - password: str = Field(..., max_length=32) + password: str = Field(...) class Config: schema_extra = {"example": {"password": "123456"}} From 42a7f6304ad3592010cb973003e000853b33e110 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sun, 13 Mar 2022 20:10:12 +0300 Subject: [PATCH 14/21] update university tests after changing model attributes --- backend/app/models/uni_models.py | 2 +- .../uni_cur_lesson_routers.py | 4 +- .../uni_cur_semester_routers.py | 55 +++-- .../uni_curriculum_routers.py | 59 +++-- backend/app/tests/create_requirements.py | 53 +++-- .../test_uni_cur_lesson_routers.py | 47 ++-- .../test_uni_cur_semester_routers.py | 77 +++---- .../test_uni_curriculum_routers.py | 49 ++-- .../test_uni_department_routers.py | 13 +- .../test_uni_lesson_routers.py | 149 +++--------- .../university_tests/test_uni_routers.py | 218 +++++++++++++++--- .../test_uni_section_routers.py | 169 +++++++++----- .../test_uni_semester_routers.py | 111 ++------- 13 files changed, 536 insertions(+), 470 deletions(-) diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index bb6dea4..bd8a018 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -64,7 +64,7 @@ class Config: class UniversityLessonModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=1, max_length=127) - code: str = Field(..., min_length=1, max_length=10) + code: str = Field(..., min_length=1, max_length=20) ects: float = Field(..., ge=0) absence_limit: int = Field(..., ge=0) sections: List[UniversitySectionAPIModel] = [] diff --git a/backend/app/routers/university_routers/uni_cur_lesson_routers.py b/backend/app/routers/university_routers/uni_cur_lesson_routers.py index 47f9ffc..eeab577 100644 --- a/backend/app/routers/university_routers/uni_cur_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_cur_lesson_routers.py @@ -279,8 +279,8 @@ async def update_curriculum_lesson( "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].code": curriculum_lesson[ "code" ], - "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].lessonType": curriculum_lesson[ - "lessonType" + "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].lesson_type": curriculum_lesson[ + "lesson_type" ], } }, diff --git a/backend/app/routers/university_routers/uni_cur_semester_routers.py b/backend/app/routers/university_routers/uni_cur_semester_routers.py index db0bf52..ca15e5f 100644 --- a/backend/app/routers/university_routers/uni_cur_semester_routers.py +++ b/backend/app/routers/university_routers/uni_cur_semester_routers.py @@ -43,8 +43,8 @@ async def create_curriculum_semester( "_id": unid, "departments._id": depid, "departments.curriculums._id": curid, - "departments.curriculums.semesters.semester": curriculum_semester[ - "semester" + "departments.curriculums.semesters.number": curriculum_semester[ + "number" ], } ) @@ -176,9 +176,7 @@ async def update_curriculum_semester( """Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID""" if auth_user["user_group"] == "professor": - curriculum_semester = { - k: v for k, v in curriculum_semester.dict().items() if v is not None - } + curriculum_semester = jsonable_encoder(curriculum_semester) if ( result := await request.app.mongodb["universities"].find_one( @@ -197,38 +195,37 @@ async def update_curriculum_semester( ) else: semester_name_list = [ - semester["semester"] + semester["number"] for semester in result["departments"][0]["curriculums"][0]["semesters"] ] - if curriculum_semester["semester"] in semester_name_list: + if curriculum_semester["number"] in semester_name_list: return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content={"message": "Curriculum semester already exists"}, ) - if len(curriculum_semester) >= 1: - update_result = await request.app.mongodb["universities"].update_many( - { - "_id": unid, - "departments._id": depid, - "departments.curriculums._id": curid, - "departments.curriculums.semesters._id": cursid, - }, - { - "$set": { - "departments.$[i].curriculums.$[j].semesters.$[k].semester": curriculum_semester[ - "semester" - ], - } - }, - array_filters=[{"i._id": depid}, {"j._id": curid}, {"k._id": cursid}], - ) + update_result = await request.app.mongodb["universities"].update_many( + { + "_id": unid, + "departments._id": depid, + "departments.curriculums._id": curid, + "departments.curriculums.semesters._id": cursid, + }, + { + "$set": { + "departments.$[i].curriculums.$[j].semesters.$[k].number": curriculum_semester[ + "number" + ], + } + }, + array_filters=[{"i._id": depid}, {"j._id": curid}, {"k._id": cursid}], + ) - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Curriculum semester updated"}, - ) + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, + content={"message": "Curriculum semester updated"}, + ) return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, diff --git a/backend/app/routers/university_routers/uni_curriculum_routers.py b/backend/app/routers/university_routers/uni_curriculum_routers.py index a758e88..0892d25 100644 --- a/backend/app/routers/university_routers/uni_curriculum_routers.py +++ b/backend/app/routers/university_routers/uni_curriculum_routers.py @@ -153,9 +153,7 @@ async def update_department_curriculum( """Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID""" if auth_user["user_group"] == "professor": - department_curriculum = { - k: v for k, v in department_curriculum.dict().items() if v is not None - } + department_curriculum = jsonable_encoder(department_curriculum) if ( result := await request.app.mongodb["universities"].find_one( @@ -186,38 +184,37 @@ async def update_department_curriculum( }, ) - if len(department_curriculum) >= 1: - update_result = await request.app.mongodb["universities"].update_many( - { - "_id": unid, - "departments._id": depid, - "departments.curriculums._id": curid, - }, - { - "$set": { - "departments.$[i].curriculums.$[j].name": department_curriculum[ - "name" - ], - "departments.$[i].curriculums.$[j].startYear": department_curriculum[ - "startYear" - ], - "departments.$[i].curriculums.$[j].endYear": department_curriculum[ - "endYear" - ], - } - }, - array_filters=[{"i._id": depid}, {"j._id": curid}], - ) + update_result = await request.app.mongodb["universities"].update_many( + { + "_id": unid, + "departments._id": depid, + "departments.curriculums._id": curid, + }, + { + "$set": { + "departments.$[i].curriculums.$[j].name": department_curriculum[ + "name" + ], + "departments.$[i].curriculums.$[j].start_year": department_curriculum[ + "start_year" + ], + "departments.$[i].curriculums.$[j].end_year": department_curriculum[ + "end_year" + ], + } + }, + array_filters=[{"i._id": depid}, {"j._id": curid}], + ) - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "Curriculum updated"}, - ) + if update_result.modified_count == 1: + return JSONResponse( + status_code=status.HTTP_200_OK, + content={"message": "Curriculum updated"}, + ) return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Curriculum name cannot be empty"}, + content={"message": "Curriculum could not be updated"}, ) return JSONResponse( diff --git a/backend/app/tests/create_requirements.py b/backend/app/tests/create_requirements.py index f756379..5878a01 100644 --- a/backend/app/tests/create_requirements.py +++ b/backend/app/tests/create_requirements.py @@ -1,7 +1,15 @@ -def create_user_and_login(client, email, password): +def create_user_and_login(client, email, password, first_name, last_name): """Create user and login. Return user id, token""" - user = client.post("/users", json={"email": email, "password": password}) + user = client.post( + "/users", + json={ + "email": email, + "password": password, + "first_name": first_name, + "last_name": last_name, + }, + ) assert user.status_code == 201 assert user.json()["message"] == "User created" @@ -33,13 +41,20 @@ def login_admin_user(client, settings): return admin_login.json()["access_token"] -def create_professor_and_login(client, admin_token, email, password): +def create_professor_and_login( + client, admin_token, email, password, first_name, last_name +): """Create professor and login. Return professor id, token""" professor = client.post( "/users/professors", headers={"Authorization": f"Bearer {admin_token}"}, - json={"email": email, "password": password}, + json={ + "email": email, + "password": password, + "first_name": first_name, + "last_name": last_name, + }, ) assert professor.status_code == 201 @@ -61,7 +76,19 @@ def create_university(client, token, university_name): university = client.post( "/universities", headers={"Authorization": f"Bearer {token}"}, - json={"name": university_name}, + json={ + "name": university_name, + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 201 @@ -91,7 +118,7 @@ def create_curriculum(client, token, university_id, department_id, curriculum_na curriculum = client.post( f"/universities/{university_id}/departments/{department_id}/curriculums", headers={"Authorization": f"Bearer {token}"}, - json={"name": curriculum_name, "startYear": 2020, "endYear": 2032,}, + json={"name": curriculum_name, "start_year": 2020, "end_year": 2032,}, ) assert curriculum.status_code == 201 @@ -108,7 +135,7 @@ def create_curriculum_semester( curriculum_semester = client.post( f"/universities/{university_id}/departments/{department_id}/curriculums/{curriculum_id}/semesters", headers={"Authorization": f"Bearer {token}"}, - json={"semester": semester,}, + json={"number": semester,}, ) assert curriculum_semester.status_code == 201 @@ -140,12 +167,12 @@ def create_semester(client, user_id, token): headers={"Authorization": f"Bearer {token}"}, json={ "name": "Test Semester", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00Z", + "end_date": "2022-06-18T00:00:00Z", + "start_hour": {"hour": 8, "minute": 20}, + "duration_esson": 40, + "duration_break": 20, + "slot_count": 12, }, ) diff --git a/backend/app/tests/university_tests/test_uni_cur_lesson_routers.py b/backend/app/tests/university_tests/test_uni_cur_lesson_routers.py index b4e35f8..d5cb796 100644 --- a/backend/app/tests/university_tests/test_uni_cur_lesson_routers.py +++ b/backend/app/tests/university_tests/test_uni_cur_lesson_routers.py @@ -28,7 +28,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_cur_lesson_routers@test.com", "test" + client, + admin_token, + "professor_uni_cur_lesson_routers@test.com", + "test", + "professor_first_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Cur Lesson Routers" @@ -56,7 +61,11 @@ def test_prepare_test_data(): ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_cur@test.com", "test" + client, + "default_user_uni_cur@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_curriculum_lesson(): @@ -68,7 +77,7 @@ def test_create_curriculum_lesson(): json={ "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -89,7 +98,7 @@ def test_get_curriculum_lesson(): "_id": test_user.curriculum_lesson_id, "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", } def test_get_curriculum_lesson_with_default_user(): @@ -105,7 +114,7 @@ def test_get_curriculum_lesson_with_default_user(): "_id": test_user.curriculum_lesson_id, "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", } def test_get_curriculum_lesson_with_invalid_lesson_id(): @@ -128,7 +137,7 @@ def test_create_same_curriculum_lesson(): json={ "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -145,7 +154,7 @@ def test_create_curriculum_lesson_with_invalid_semester_id(): json={ "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -162,7 +171,7 @@ def test_create_curriculum_lesson_with_invalid_university_id(): json={ "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -178,7 +187,7 @@ def test_create_curriculum_lesson_with_default_user(): json={ "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -199,7 +208,7 @@ def test_list_curriculum_lessons(): "_id": test_user.curriculum_lesson_id, "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", } ] @@ -217,7 +226,7 @@ def test_list_curriculum_lessons_with_default_user(): "_id": test_user.curriculum_lesson_id, "name": "Test Curriculum Lesson", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", } ] @@ -254,7 +263,7 @@ def test_update_curriculum_lesson(): json={ "name": "Test Curriculum Lesson Updated", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -270,7 +279,7 @@ def test_create_second_curriculum_lesson(): json={ "name": "Test Curriculum Lesson 2", "code": "TEST_CUR_LESSON_2", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -292,13 +301,13 @@ def test_list_curriculum_lessons_with_two_lessons(): "_id": test_user.curriculum_lesson_id, "name": "Test Curriculum Lesson Updated", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, { "_id": test_user.second_curriculum_lesson_id, "name": "Test Curriculum Lesson 2", "code": "TEST_CUR_LESSON_2", - "lessonType": "default", + "lesson_type": "default", }, ] @@ -312,7 +321,7 @@ def test_update_curriculum_lesson_with_invalid_lesson_id(): json={ "name": "Test Curriculum Lesson Updated 3", "code": "TEST_CUR_LESSON_3", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -331,7 +340,7 @@ def test_update_curriculum_lesson_with_exists_lesson_code(): json={ "name": "Test Curriculum Lesson Updated 4", "code": "TEST_CUR_LESSON_2", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -350,7 +359,7 @@ def test_udpate_curriculum_lesson_with_same_lesson_context(): json={ "name": "Test Curriculum Lesson Updated", "code": "TEST_CUR_LESSON", - "lessonType": "default", + "lesson_type": "default", }, ) @@ -369,7 +378,7 @@ def test_update_curriculum_lesson_with_default_user(): json={ "name": "Test Curriculum Lesson Updated", "code": "TEST_CUR_LESSON_4", - "lessonType": "default", + "lesson_type": "default", }, ) diff --git a/backend/app/tests/university_tests/test_uni_cur_semester_routers.py b/backend/app/tests/university_tests/test_uni_cur_semester_routers.py index 14e83bb..e116784 100644 --- a/backend/app/tests/university_tests/test_uni_cur_semester_routers.py +++ b/backend/app/tests/university_tests/test_uni_cur_semester_routers.py @@ -26,7 +26,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_cur_semester_routers@test.com", "test" + client, + admin_token, + "professor_uni_cur_semester_routers@test.com", + "test", + "professor_first_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Cur Semester Routers" @@ -46,7 +51,11 @@ def test_prepare_test_data(): ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_cur_semester@test.com", "test" + client, + "default_user_uni_cur_semester@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_curriculum_semester(): @@ -55,9 +64,7 @@ def test_create_curriculum_semester(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 201 @@ -75,7 +82,7 @@ def test_get_curriculum_semester(): assert curriculum_semester.status_code == 200 assert curriculum_semester.json() == { "_id": test_user.curriculum_semester_id, - "semester": 1, + "number": 1, "lessons": [], } @@ -90,7 +97,7 @@ def test_get_curriculum_semester_with_default_user(): assert curriculum_semester.status_code == 200 assert curriculum_semester.json() == { "_id": test_user.curriculum_semester_id, - "semester": 1, + "number": 1, "lessons": [], } @@ -111,9 +118,7 @@ def test_create_same_curriculum_semester(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 409 @@ -129,9 +134,7 @@ def test_create_curriculum_semester_with_invalid_university_id(): curriculum_semester = client.post( f"/universities/{university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 404 @@ -147,9 +150,7 @@ def test_create_curriculum_semester_with_invalid_department_id(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 404 @@ -165,9 +166,7 @@ def test_create_curriculum_semester_with_invalid_curriculum_id(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 404 @@ -182,9 +181,7 @@ def test_create_curriculum_semester_with_default_user(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {default_user.token}"}, - json={ - "semester": 1, - }, + json={"number": 1,}, ) assert curriculum_semester.status_code == 403 @@ -200,11 +197,7 @@ def test_list_curriculum_semesters(): assert curriculum_semesters.status_code == 200 assert curriculum_semesters.json() == [ - { - "_id": test_user.curriculum_semester_id, - "semester": 1, - "lessons": [], - } + {"_id": test_user.curriculum_semester_id, "number": 1, "lessons": [],} ] def test_list_curriculum_semesters_with_default_user(): @@ -217,11 +210,7 @@ def test_list_curriculum_semesters_with_default_user(): assert curriculum_semesters.status_code == 200 assert curriculum_semesters.json() == [ - { - "_id": test_user.curriculum_semester_id, - "semester": 1, - "lessons": [], - } + {"_id": test_user.curriculum_semester_id, "number": 1, "lessons": [],} ] def test_list_curriculum_semesters_with_invalid_university_id(): @@ -266,9 +255,7 @@ def test_update_curriculum_semester(): curriculum_semester = client.put( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters/{test_user.curriculum_semester_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 2, - }, + json={"number": 2,}, ) assert curriculum_semester.status_code == 200 @@ -280,9 +267,7 @@ def test_create_second_curriculum_semester(): curriculum_semester = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 3, - }, + json={"number": 3,}, ) assert curriculum_semester.status_code == 201 @@ -299,14 +284,10 @@ def test_list_curriculum_semesters_with_two_semester(): assert curriculum_semesters.status_code == 200 assert curriculum_semesters.json() == [ - { - "_id": test_user.curriculum_semester_id, - "semester": 2, - "lessons": [], - }, + {"_id": test_user.curriculum_semester_id, "number": 2, "lessons": [],}, { "_id": test_user.second_curriculum_semester_id, - "semester": 3, + "number": 3, "lessons": [], }, ] @@ -317,9 +298,7 @@ def test_update_curriculum_semester_with_exists_semester_name(): curriculum_semester = client.put( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters/{test_user.curriculum_semester_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "semester": 3, - }, + json={"number": 3,}, ) assert curriculum_semester.status_code == 400 @@ -334,9 +313,7 @@ def test_update_curriculum_semester_with_default_user(): curriculum_semester = client.put( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}/semesters/{test_user.curriculum_semester_id}", headers={"Authorization": f"Bearer {default_user.token}"}, - json={ - "semester": 4, - }, + json={"number": 4,}, ) assert curriculum_semester.status_code == 403 diff --git a/backend/app/tests/university_tests/test_uni_curriculum_routers.py b/backend/app/tests/university_tests/test_uni_curriculum_routers.py index dc46b52..ae23a7d 100644 --- a/backend/app/tests/university_tests/test_uni_curriculum_routers.py +++ b/backend/app/tests/university_tests/test_uni_curriculum_routers.py @@ -24,7 +24,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_curriculum_routers@test.com", "test" + client, + admin_token, + "professor_uni_curriculum_routers@test.com", + "test", + "professor_first_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Curriculum Routers" @@ -36,7 +41,11 @@ def test_prepare_test_data(): "Test Department for Uni Lesson Routers", ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_curriculum@test.com", "test" + client, + "default_user_uni_curriculum@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_department_curriculum(): @@ -46,8 +55,8 @@ def test_create_department_curriculum(): f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {test_user.token}"}, ) @@ -62,8 +71,8 @@ def test_create_department_curriculum_that_already_exists(): f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {test_user.token}"}, ) @@ -80,8 +89,8 @@ def test_create_department_curriculum_with_invalid_university_id(): f"/universities/{default_user.university_id}/departments/{test_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {test_user.token}"}, ) @@ -95,8 +104,8 @@ def test_create_department_curriculum_with_invalid_department_id(): f"/universities/{test_user.university_id}/departments/{default_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {test_user.token}"}, ) @@ -110,8 +119,8 @@ def test_create_department_curriculum_with_default_user(): f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {default_user.token}"}, ) @@ -125,8 +134,8 @@ def test_create_department_curriculum_without_token(): f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums", json={ "name": "Test Department Curriculum", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, ) assert response.status_code == 401 @@ -136,7 +145,7 @@ def test_create_department_curriculum_without_name(): response = client.post( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums", - json={"name": "", "startYear": 2020, "endYear": 2040,}, + json={"name": "", "start_year": 2020, "end_year": 2040,}, headers={"Authorization": f"Bearer {test_user.token}"}, ) assert response.status_code == 422 @@ -186,7 +195,7 @@ def test_update_department_curriculum(): response = client.put( f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}", - json={"name": "updated_name", "startYear": 2010, "endYear": 2022,}, + json={"name": "updated_name", "start_year": 2010, "end_year": 2022,}, headers={"Authorization": f"Bearer {test_user.token}"}, ) assert response.status_code == 200 @@ -199,8 +208,8 @@ def test_update_department_curriculum_with_invalid_university_id(): f"/universities/{default_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}", json={ "name": "Test Department Curriculum Updated", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {test_user.token}"}, ) @@ -216,8 +225,8 @@ def test_update_departmen_curriculum_with_default_user(): f"/universities/{test_user.university_id}/departments/{test_user.department_id}/curriculums/{test_user.curriculum_id}", json={ "name": "Test Department Curriculum Updated", - "startYear": 2020, - "endYear": 2040, + "start_year": 2020, + "end_year": 2040, }, headers={"Authorization": f"Bearer {default_user.token}"}, ) diff --git a/backend/app/tests/university_tests/test_uni_department_routers.py b/backend/app/tests/university_tests/test_uni_department_routers.py index f635b81..2a0f7c7 100644 --- a/backend/app/tests/university_tests/test_uni_department_routers.py +++ b/backend/app/tests/university_tests/test_uni_department_routers.py @@ -26,7 +26,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_department_routers@test.com", "test" + client, + admin_token, + "professor_uni_department_routers@test.com", + "test", + "professor_first_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University" @@ -35,7 +40,11 @@ def test_prepare_test_data(): client, test_user.token, test_user.university_id, "Test Department", ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_department@test.com", "test" + client, + "default_user_uni_department@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_university_department_that_already_exists(): diff --git a/backend/app/tests/university_tests/test_uni_lesson_routers.py b/backend/app/tests/university_tests/test_uni_lesson_routers.py index 7f66cc0..544a209 100644 --- a/backend/app/tests/university_tests/test_uni_lesson_routers.py +++ b/backend/app/tests/university_tests/test_uni_lesson_routers.py @@ -1,10 +1,10 @@ from app.main import app, settings from app.tests.create_requirements import ( create_professor_and_login, - create_user_and_login, - login_admin_user, create_university, create_university_semester, + create_user_and_login, + login_admin_user, ) from fastapi.testclient import TestClient @@ -16,8 +16,6 @@ class TestUser: university_id = None semester_id = None lesson_id = None - section_id = None - second_section_id = None test_user = TestUser() default_user = TestUser() @@ -25,7 +23,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_lesson_routers@test.com", "test" + client, + admin_token, + "professor_uni_lesson_routers@test.com", + "test", + "professor_first_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Lesson Routers" @@ -39,7 +42,11 @@ def test_prepare_test_data(): ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_lesson@test.com", "test" + client, + "default_user_uni_lesson@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_university_lesson(): @@ -52,15 +59,10 @@ def test_create_university_lesson(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) + assert lesson.status_code == 201 assert lesson.json()["message"] == "University lesson created" test_user.lesson_id = lesson.json()["_id"] @@ -78,17 +80,9 @@ def test_get_university_lesson(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "sections": [ - { - "_id": lesson.json()["sections"][0]["_id"], - "section": "01", - "instructor": "Test University Instructor", - "slots": [[2, 7, 0], [2, 8, 0],], - } - ], + "absence_limit": 12, + "sections": [], } - test_user.section_id = lesson.json()["sections"][0]["_id"] def test_get_university_lesson_with_invalid_lesson_id(): """Test getting university lesson with invalid lesson id""" @@ -122,40 +116,11 @@ def test_create_same_university_lesson(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor 2", - "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert section.status_code == 409 - assert section.json()["message"] == "University lesson section already exists" - - def test_create_university_lesson_section(): - """Test creating university lesson section""" - - section = client.post( - f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Lesson", - "code": "TEST_UNI_LESSON", - "ects": 5, - "absenceLimit": 12, - "section": "02", - "instructor": "Test University Instructor 2", - "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 0}, - ], - }, - ) - assert section.status_code == 201 - assert section.json()["message"] == "University lesson section created" - test_user.second_section_id = section.json()["_id"] + assert section.json()["message"] == "Given lesson code already exists" def test_create_university_lesson_with_invalid_semester_id(): """Test creating university lesson with invalid semester id""" @@ -168,13 +133,7 @@ def test_create_university_lesson_with_invalid_semester_id(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert lesson.status_code == 404 @@ -191,13 +150,7 @@ def test_create_university_lesson_with_invalid_university_id(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert lesson.status_code == 404 @@ -213,13 +166,7 @@ def create_university_lesson_with_default_user(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert lesson.status_code == 403 @@ -239,21 +186,8 @@ def test_list_university_lessons_of_a_semester(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "sections": [ - { - "_id": test_user.section_id, - "section": "01", - "instructor": "Test University Instructor", - "slots": [[2, 7, 0], [2, 8, 0],], - }, - { - "_id": test_user.second_section_id, - "section": "02", - "instructor": "Test University Instructor 2", - "slots": [[3, 5, 0], [3, 6, 0],], - }, - ], + "absence_limit": 12, + "sections": [], } ] @@ -293,21 +227,8 @@ def test_list_university_lessons_of_a_semester_with_default_user(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "sections": [ - { - "_id": test_user.section_id, - "section": "01", - "instructor": "Test University Instructor", - "slots": [[2, 7, 0], [2, 8, 0],], - }, - { - "_id": test_user.second_section_id, - "section": "02", - "instructor": "Test University Instructor 2", - "slots": [[3, 5, 0], [3, 6, 0],], - }, - ], + "absence_limit": 12, + "sections": [], } ] @@ -321,13 +242,7 @@ def test_create_second_university_lesson(): "name": "Test University Lesson 2", "code": "TEST_UNI_LESSON_2", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert lesson.status_code == 201 @@ -343,7 +258,7 @@ def test_update_university_lesson(): "name": "Test University Lesson 3", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, + "absence_limit": 12, }, ) assert lesson.status_code == 200 @@ -359,7 +274,7 @@ def test_update_university_lesson_with_same_lesson_context(): "name": "Test University Lesson 3", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, + "absence_limit": 12, }, ) assert lesson.status_code == 400 @@ -375,7 +290,7 @@ def test_update_university_lesson_with_exists_lesson_code(): "name": "Test University Lesson 3", "code": "TEST_UNI_LESSON_2", "ects": 5, - "absenceLimit": 12, + "absence_limit": 12, }, ) assert lesson.status_code == 409 @@ -395,7 +310,7 @@ def test_update_university_lesson_with_invalid_lesson_id(): "name": "Test University Lesson 3", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, + "absence_limit": 12, }, ) assert lesson.status_code == 409 @@ -414,7 +329,7 @@ def test_update_university_lesson_with_default_user(): "name": "Test University Lesson 3", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, + "absence_limit": 12, }, ) assert lesson.status_code == 403 diff --git a/backend/app/tests/university_tests/test_uni_routers.py b/backend/app/tests/university_tests/test_uni_routers.py index 7c50ba1..5486ff6 100644 --- a/backend/app/tests/university_tests/test_uni_routers.py +++ b/backend/app/tests/university_tests/test_uni_routers.py @@ -22,11 +22,20 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_routers@test.com", "test" + client, + admin_token, + "professor_uni_routers@test.com", + "test", + "professor_first_name", + "professor_test_last_name", ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user@test.com", "test" + client, + "default_user@test.com", + "test", + "default_first_name", + "default_last_name", ) def test_create_university(): @@ -35,7 +44,19 @@ def test_create_university(): university = client.post( "/universities", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test"}, + json={ + "name": "University of Test", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 201 assert university.json()["message"] == "University created" @@ -52,7 +73,17 @@ def test_get_university(): assert university.json() == { "_id": test_user.university_id, "name": "University of Test", - "curSemesterID": "null", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": "null", } def test_get_university_with_invalid_university_id(): @@ -72,7 +103,19 @@ def test_create_same_university(): university = client.post( "/universities", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test"}, + json={ + "name": "University of Test", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 409 assert university.json()["message"] == "University already exists" @@ -83,55 +126,92 @@ def test_create_university_with_default_user(): university = client.post( "/universities", headers={"Authorization": f"Bearer {default_user.token}"}, - json={"name": "University of Test 2"}, + json={ + "name": "University of Test 2", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 403 assert university.json()["message"] == "No right to access" - def test_update_university_name(): - """Test updating university name""" + def test_update_university(): + """Test updating university""" university = client.put( - f"/universities/{test_user.university_id}/update-name", + f"/universities/{test_user.university_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test 3"}, + json={ + "name": "University of Test 3", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 200 - assert university.json()["message"] == "University name updated" + assert university.json()["message"] == "University updated" - def test_update_university_name_with_same_name(): - """Test updating university name with same name""" - - university = client.put( - f"/universities/{test_user.university_id}/update-name", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test 3"}, - ) - assert university.status_code == 409 - assert university.json()["message"] == "University already exists" - - def test_update_university_name_with_default_user(): + def test_update_university_with_default_user(): """Test updating university name with default user""" university = client.put( - f"/universities/{test_user.university_id}/update-name", + f"/universities/{test_user.university_id}", headers={"Authorization": f"Bearer {default_user.token}"}, - json={"name": "University of Test 4"}, + json={ + "name": "University of Test 4", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 403 assert university.json()["message"] == "No right to access" - def test_update_university_name_with_invalid_id(): + def test_update_university_with_invalid_id(): """Test updating university name with invalid id""" university_id = "non_exists_university_id" university = client.put( - f"/universities/{university_id}/update-name", + f"/universities/{university_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test 5"}, + json={ + "name": "University of Test 5", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 404 - assert university.json()["message"] == "University not found" + assert university.json()["message"] == "University could not be updated" def test_list_universities(): """Test listing universities""" @@ -144,7 +224,17 @@ def test_list_universities(): { "_id": test_user.university_id, "name": "University of Test 3", - "curSemesterID": "null", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": "null", } ] @@ -159,7 +249,17 @@ def test_list_universities_with_default_user(): { "_id": test_user.university_id, "name": "University of Test 3", - "curSemesterID": "null", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": "null", } ] @@ -169,7 +269,19 @@ def test_create_second_university(): university = client.post( "/universities", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"name": "University of Test 4"}, + json={ + "name": "University of Test 4", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + }, ) assert university.status_code == 201 assert university.json()["message"] == "University created" @@ -186,12 +298,32 @@ def test_list_lessons_with_two_universities(): { "_id": test_user.university_id, "name": "University of Test 3", - "curSemesterID": "null", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": "null", }, { "_id": test_user.second_university_id, "name": "University of Test 4", - "curSemesterID": "null", + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": "null", }, ] @@ -262,7 +394,7 @@ def test_update_current_semester(): semester = client.put( f"/universities/{test_user.university_id}/current-semester", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"curSemesterID": test_user.second_semester_id}, + json={"current_semester_id": test_user.second_semester_id}, ) assert semester.status_code == 200 @@ -279,7 +411,17 @@ def test_get_updated_university(): assert university.json() == { "_id": test_user.university_id, "name": "University of Test 3", - "curSemesterID": test_user.second_semester_id, + "website": "test.com", + "country": "USA", + "city": "Los Angeles", + "address": "123 Main Street", + "phone": "555-555-5555", + "email": "info@test.com", + "zip_code": "90210", + "description": "Test University Description", + "logo": "test_logo.png", + "cover_photo": "test_cover_photo.png", + "current_semester_id": test_user.second_semester_id, } def test_update_current_semester_with_default_user(): @@ -288,7 +430,7 @@ def test_update_current_semester_with_default_user(): semester = client.put( f"/universities/{test_user.university_id}/current-semester", headers={"Authorization": f"Bearer {default_user.token}"}, - json={"curSemesterID": test_user.second_semester_id}, + json={"current_semester_id": test_user.second_semester_id}, ) assert semester.status_code == 403 @@ -301,7 +443,7 @@ def test_update_current_semester_with_invalid_semester_id(): semester = client.put( f"/universities/{test_user.university_id}/current-semester", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"curSemesterID": semester_id}, + json={"current_semester_id": semester_id}, ) assert semester.status_code == 404 assert ( diff --git a/backend/app/tests/university_tests/test_uni_section_routers.py b/backend/app/tests/university_tests/test_uni_section_routers.py index 5b27148..361e77d 100644 --- a/backend/app/tests/university_tests/test_uni_section_routers.py +++ b/backend/app/tests/university_tests/test_uni_section_routers.py @@ -25,7 +25,12 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_section_routers@test.com", "test" + client, + admin_token, + "professor_uni_section_routers@test.com", + "test", + "professor_fist_name", + "professor_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Section Routers" @@ -39,7 +44,11 @@ def test_prepare_test_data(): ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_section@test.com", "test" + client, + "default_user_uni_section@test.com", + "test", + "default_user_fist_name", + "default_user_last_name", ) def test_create_university_lesson(): @@ -52,13 +61,7 @@ def test_create_university_lesson(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], + "absence_limit": 12, }, ) assert lesson.status_code == 201 @@ -78,34 +81,41 @@ def test_get_university_lesson(): "name": "Test University Lesson", "code": "TEST_UNI_LESSON", "ects": 5, - "absenceLimit": 12, - "sections": [ - { - "_id": lesson.json()["sections"][0]["_id"], - "section": "01", - "instructor": "Test University Instructor", - "slots": [[2, 7, 0], [2, 8, 0],], - } - ], + "absence_limit": 12, + "sections": [], } - test_user.section_id = lesson.json()["sections"][0]["_id"] def test_create_university_lesson_section(): """Test creating university lesson section""" section = client.post( - f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons", + f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test University Lesson", - "code": "TEST_UNI_LESSON", - "ects": 5, - "absenceLimit": 12, - "section": "02", - "instructor": "Test University Instructor 2", + "number": 1, + "instructor": "Test University Instructor", + "slots": [ + {"room": "F0D01", "day": 3, "hour": 5, "is_lab": 0}, + {"room": "F0D01", "day": 3, "hour": 6, "is_lab": 0}, + ], + }, + ) + assert section.status_code == 201 + assert section.json()["message"] == "University lesson section created" + test_user.section_id = section.json()["_id"] + + def test_create_university_second_lesson_section(): + """Test creating university lesson section""" + + section = client.post( + f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={ + "number": 2, + "instructor": "Test University Instructor", "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 0}, + {"room": "F0D01", "day": 3, "hour": 5, "is_lab": 0}, + {"room": "F0D01", "day": 3, "hour": 6, "is_lab": 0}, ], }, ) @@ -120,11 +130,11 @@ def test_update_university_lesson_section(): f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections/{test_user.section_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "section": "01", + "number": 1, "instructor": "Test University Instructor 2", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -138,11 +148,11 @@ def test_update_university_lesson_section_with_exists_section(): f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections/{test_user.section_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "section": "02", + "number": 2, "instructor": "Test University Instructor 2", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -159,11 +169,11 @@ def test_update_university_lesson_section_with_same_section_data(): f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections/{test_user.section_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "section": "01", + "number": 1, "instructor": "Test University Instructor 2", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -180,38 +190,52 @@ def test_update_university_lesson_section_with_default_user(): f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/sections/{test_user.section_id}", headers={"Authorization": f"Bearer {default_user.token}"}, json={ - "section": "01", + "number": 1, "instructor": "Test University Instructor 2", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) assert section.status_code == 403 assert section.json()["message"] == "No right to access" - def test_update_university_lesson_section_with_invalid_semester_id(): - """Test updating university lesson section with invalid semester id""" + def test_list_university_lessons(): + """Test getting university lesson""" - semester_id = "non_exists_semester_id" - section = client.put( - f"/universities/{test_user.university_id}/semesters/{semester_id}/lessons/{test_user.lesson_id}/sections/{test_user.section_id}", + lesson = client.get( + f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "section": "01", - "instructor": "Test University Instructor 3", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], - }, - ) - assert section.status_code == 409 - assert ( - section.json()["message"] - == "University lesson section could not be found or there exists another section with given section number" ) + assert lesson.status_code == 200 + assert lesson.json() == { + "_id": test_user.lesson_id, + "name": "Test University Lesson", + "code": "TEST_UNI_LESSON", + "ects": 5, + "absence_limit": 12, + "sections": [ + { + "_id": test_user.section_id, + "number": 1, + "instructor": "Test University Instructor 2", + "slots": [ + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, + ], + }, + { + "_id": test_user.second_section_id, + "number": 2, + "instructor": "Test University Instructor", + "slots": [ + {"room": "F0D01", "day": 3, "hour": 5, "is_lab": 0}, + {"room": "F0D01", "day": 3, "hour": 6, "is_lab": 0}, + ], + }, + ], + } def test_delete_university_lesson_section(): """Test deleting university lesson section""" @@ -223,6 +247,33 @@ def test_delete_university_lesson_section(): assert section.status_code == 200 assert section.json()["message"] == "University lesson section deleted" + def test_list_university_lessons_after_deletion(): + """Test getting university lesson""" + + lesson = client.get( + f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert lesson.status_code == 200 + assert lesson.json() == { + "_id": test_user.lesson_id, + "name": "Test University Lesson", + "code": "TEST_UNI_LESSON", + "ects": 5, + "absence_limit": 12, + "sections": [ + { + "_id": test_user.second_section_id, + "number": 2, + "instructor": "Test University Instructor", + "slots": [ + {"room": "F0D01", "day": 3, "hour": 5, "is_lab": 0}, + {"room": "F0D01", "day": 3, "hour": 6, "is_lab": 0}, + ], + }, + ], + } + def test_delete_same_university_lesson_section(): """Test deleting same university lesson section""" @@ -233,7 +284,7 @@ def test_delete_same_university_lesson_section(): assert section.status_code == 404 assert section.json()["message"] == "University lesson section not found" - def test_delete_university_lesson_section_with_default_user(): + def test_delete_university_lesson_section_with_default_user(): """Test deleting university lesson section with default user""" section = client.delete( diff --git a/backend/app/tests/university_tests/test_uni_semester_routers.py b/backend/app/tests/university_tests/test_uni_semester_routers.py index fa09316..18ab604 100644 --- a/backend/app/tests/university_tests/test_uni_semester_routers.py +++ b/backend/app/tests/university_tests/test_uni_semester_routers.py @@ -24,14 +24,23 @@ class TestUser: def test_prepare_test_data(): admin_token = login_admin_user(client, settings) test_user.user_id, test_user.token = create_professor_and_login( - client, admin_token, "professor_uni_semester_routers@test.com", "test" + client, + admin_token, + "professor_uni_semester_routers@test.com", + "test", + "professor_first_name", + "professor_test_last_name", ) test_user.university_id = create_university( client, test_user.token, "Test University for Uni Semester Routers" ) default_user.user_id, default_user.token = create_user_and_login( - client, "default_user_uni_semester@test.com", "test" + client, + "default_user_uni_semester@test.com", + "test", + "default_user_first_name", + "default_user_last_name", ) def test_create_university_semester(): @@ -40,9 +49,7 @@ def test_create_university_semester(): semester = client.post( f"/universities/{test_user.university_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester", - }, + json={"name": "Test University Semester",}, ) assert semester.status_code == 201 assert semester.json()["message"] == "University semester created" @@ -92,9 +99,7 @@ def create_same_university_semester(): semester = client.post( f"/universities/{test_user.university_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester", - }, + json={"name": "Test University Semester",}, ) assert semester.status_code == 409 assert ( @@ -108,9 +113,7 @@ def test_create_university_semester_with_invalid_university_id(): semester = client.post( f"/universities/{university_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester", - }, + json={"name": "Test University Semester",}, ) assert semester.status_code == 404 assert semester.json()["message"] == "University not found" @@ -121,9 +124,7 @@ def create_university_semester_with_default_user(): semester = client.post( f"/universities/{test_user.university_id}/semesters", headers={"Authorization": f"Bearer {default_user.token}"}, - json={ - "name": "Test University Semester", - }, + json={"name": "Test University Semester",}, ) assert semester.status_code == 403 assert semester.json()["message"] == "No right to access" @@ -137,11 +138,7 @@ def test_list_semesters_of_a_university(): ) assert semesters.status_code == 200 assert semesters.json() == [ - { - "_id": test_user.semester_id, - "name": "Test University Semester", - "lessons": [], - } + {"_id": test_user.semester_id, "name": "Test University Semester",} ] def test_list_semesters_of_a_university_with_invalid_university_id(): @@ -164,11 +161,7 @@ def test_list_semesters_of_a_university_with_default_user(): ) assert semesters.status_code == 200 assert semesters.json() == [ - { - "_id": test_user.semester_id, - "name": "Test University Semester", - "lessons": [], - } + {"_id": test_user.semester_id, "name": "Test University Semester",} ] def test_create_second_university_semester(): @@ -177,9 +170,7 @@ def test_create_second_university_semester(): semester = client.post( f"/universities/{test_user.university_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester 2", - }, + json={"name": "Test University Semester 2",}, ) assert semester.status_code == 201 assert semester.json()["message"] == "University semester created" @@ -194,74 +185,20 @@ def test_list_all_semesters_of_a_university_if_more_than_one(): ) assert semesters.status_code == 200 assert semesters.json() == [ - { - "_id": test_user.semester_id, - "name": "Test University Semester", - "lessons": [], - }, + {"_id": test_user.semester_id, "name": "Test University Semester",}, { "_id": test_user.second_semester_id, "name": "Test University Semester 2", - "lessons": [], }, ] - def test_create_university_semester_lesson(): - """Test creating a lesson in a semester""" - - lesson = client.post( - f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Lesson", - "code": "TEST_UNI_LESSON", - "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], - }, - ) - assert lesson.status_code == 201 - assert lesson.json()["message"] == "University lesson created" - test_user.lesson_id = lesson.json()["_id"] - - def test_create_second_semester_lesson(): - """Test creating second semester lesson""" - - lesson = client.post( - f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}/lessons", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Lesson 2", - "code": "TEST_UNI_LESSON_2", - "ects": 5, - "absenceLimit": 12, - "section": "01", - "instructor": "Test University Instructor", - "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, - ], - }, - ) - - assert lesson.status_code == 201 - assert lesson.json()["message"] == "University lesson created" - test_user.second_lesson_id = lesson.json()["_id"] - def test_update_university_semester(): """Test updating university semester""" semester = client.put( f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester 3", - }, + json={"name": "Test University Semester 3",}, ) assert semester.status_code == 200 assert semester.json()["message"] == "University semester updated" @@ -272,9 +209,7 @@ def test_update_university_semester_with_same_semester_context(): semester = client.put( f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "name": "Test University Semester 3", - }, + json={"name": "Test University Semester 3",}, ) assert semester.status_code == 400 assert semester.json()["message"] == "University semester already exists" @@ -285,9 +220,7 @@ def test_update_university_semester_with_default_user(): semester = client.put( f"/universities/{test_user.university_id}/semesters/{test_user.semester_id}", headers={"Authorization": f"Bearer {default_user.token}"}, - json={ - "name": "Test University Semester 3", - }, + json={"name": "Test University Semester 3",}, ) assert semester.status_code == 403 assert semester.json()["message"] == "No right to access" From 8d56af030fa1fa77322deb09bc85b92fcbcac9c8 Mon Sep 17 00:00:00 2001 From: shiny-apricot Date: Tue, 15 Mar 2022 01:00:45 +0300 Subject: [PATCH 15/21] add user/semester and user/user router tests --- backend/app/models/user_models.py | 12 +- .../app/routers/user_routers/user_routers.py | 9 +- backend/app/tests/create_requirements.py | 2 +- .../tests/user_tests/test_semester_routers.py | 145 +++++++++-------- .../app/tests/user_tests/test_user_routers.py | 151 ++++++++++++++---- 5 files changed, 215 insertions(+), 104 deletions(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index e9a5b12..35bed30 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -250,14 +250,14 @@ class UserModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") email: EmailStr = Field(...) password: str = Field(...) - first_name: str = Field(..., max_length=32) - last_name: str = Field(..., max_length=32) - current_gpa: float = Field(3.67, ge=0, le=10.0) + first_name: str = Field(..., min_length=3, max_length=127) + last_name: str = Field(..., min_length=3, max_length=127) + current_gpa: float = Field(0, ge=0, le=10.0) current_semester_id: str = "null" current_university_id: str = "null" entrance_year: int = Field(2010, gt=2000) semesters: List[UserSemesterModel] = [] - + class Config: allow_population_by_field_name = True arbitrary_types_allowed = True @@ -308,8 +308,8 @@ class Config: class UpdateUserNameModel(BaseModel): - first_name: str = Field(..., max_length=32) - last_name: str = Field(..., max_length=32) + first_name: str = Field(..., min_length=3, max_length=127) + last_name: str = Field(..., min_length=3, max_length=127) class Config: schema_extra = {"example": {"first_name": "John", "last_name": "Doe"}} diff --git a/backend/app/routers/user_routers/user_routers.py b/backend/app/routers/user_routers/user_routers.py index 059c35c..1f4aaff 100644 --- a/backend/app/routers/user_routers/user_routers.py +++ b/backend/app/routers/user_routers/user_routers.py @@ -161,7 +161,12 @@ async def update_user_name( update_result = await request.app.mongodb["users"].update_one( {"_id": uid}, - {"$set": {"first_name": user_name["first_name"], "last_name": user_name["last_name"]}}, + { + "$set": { + "first_name": user_name["first_name"], + "last_name": user_name["last_name"], + } + }, ) if update_result.matched_count == 1: @@ -349,7 +354,7 @@ async def update_entrance_year( @router.put( - "/{uid}/current-gpa", + "/{uid}/change-gpa", response_description="Update current gpa of a user", operation_id="updateCurrentGPA", response_model=Message, diff --git a/backend/app/tests/create_requirements.py b/backend/app/tests/create_requirements.py index 5878a01..c497c1e 100644 --- a/backend/app/tests/create_requirements.py +++ b/backend/app/tests/create_requirements.py @@ -170,7 +170,7 @@ def create_semester(client, user_id, token): "start_date": "2022-02-18T00:00:00Z", "end_date": "2022-06-18T00:00:00Z", "start_hour": {"hour": 8, "minute": 20}, - "duration_esson": 40, + "duration_lesson": 40, "duration_break": 20, "slot_count": 12, }, diff --git a/backend/app/tests/user_tests/test_semester_routers.py b/backend/app/tests/user_tests/test_semester_routers.py index e125ff0..b99608f 100644 --- a/backend/app/tests/user_tests/test_semester_routers.py +++ b/backend/app/tests/user_tests/test_semester_routers.py @@ -14,7 +14,7 @@ class TestUser: def test_prepare_test_data(): test_user.user_id, test_user.token = create_user_and_login( - client, "semester_routers@test.com", "test" + client, "semester_routers@test.com", "password", "name", "surname" ) def test_create_semester(): @@ -25,12 +25,12 @@ def test_create_semester(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Semester", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, }, ) @@ -48,12 +48,12 @@ def test_create_semester_with_another_user_id(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Semester", - "startDate": "2022-02-18T00:00:00Z", - "endDate": "2022-06-18T00:00:00Z", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, }, ) @@ -68,16 +68,18 @@ def test_get_semester(): headers={"Authorization": f"Bearer {test_user.token}"}, ) + print(semester.json()) assert semester.status_code == 200 assert semester.json() == { "_id": test_user.semester_id, "name": "Test Semester", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": [8, 20], + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, } def test_get_semester_with_another_user_id(): @@ -112,15 +114,17 @@ def test_update_semester(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Semester 2", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, }, ) + print(semester.json()) assert semester.status_code == 200 assert semester.json()["message"] == "Semester updated" @@ -133,12 +137,13 @@ def test_update_semester_with_another_user_id(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Semester 2", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, }, ) @@ -154,15 +159,18 @@ def test_update_semester_with_invalid_semester_id(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Semester 2", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, }, ) + assert semester.status_code == 404 + def test_list_semesters(): """Test listing semesters""" @@ -172,18 +180,19 @@ def test_list_semesters(): ) assert semesters.status_code == 200 - # semesters.json() only includes our last semester that created and updated + # semesters.json() only includes our last semester that is created and updated assert semesters.json() == [ { "_id": test_user.semester_id, "name": "Test Semester 2", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, - } + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": [8, 20], + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, + }, ] def test_list_semesters_with_another_user_id(): @@ -205,13 +214,13 @@ def test_create_second_semester(): f"/users/{test_user.user_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Semester 3", - "startDate": "2023-02-18T00:00:00+00:00", - "endDate": "2023-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "name": "Second Test Semester", + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": {"hour": "8", "minute": "20",}, + "duration_lesson": 50, + "duration_break": 10, + "slot_count": 12, }, ) @@ -226,28 +235,30 @@ def test_list_semesters_with_two_semesters(): f"/users/{test_user.user_id}/semesters", headers={"Authorization": f"Bearer {test_user.token}"}, ) - + print(semesters.json()) assert semesters.status_code == 200 assert semesters.json() == [ { - "_id": semesters.json()[0]["_id"], + "_id": test_user.semester_id, "name": "Test Semester 2", - "startDate": "2022-02-18T00:00:00+00:00", - "endDate": "2022-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": [8, 20], + "duration_lesson": 40, + "duration_break": 20, + "slot_count": 12, + "semester_gpa": 0.0, }, { "_id": semesters.json()[1]["_id"], - "name": "Test Semester 3", - "startDate": "2023-02-18T00:00:00+00:00", - "endDate": "2023-06-18T00:00:00+00:00", - "startHour": "8.20", - "dLesson": 40, - "dBreak": 20, - "slotCount": 12, + "name": "Second Test Semester", + "start_date": "2022-02-18T00:00:00+00:00", + "end_date": "2022-06-18T00:00:00+00:00", + "start_hour": [8, 20], + "duration_lesson": 50, + "duration_break": 10, + "slot_count": 12, + "semester_gpa": 0.0, }, ] diff --git a/backend/app/tests/user_tests/test_user_routers.py b/backend/app/tests/user_tests/test_user_routers.py index f6a429c..b5b27e0 100644 --- a/backend/app/tests/user_tests/test_user_routers.py +++ b/backend/app/tests/user_tests/test_user_routers.py @@ -1,5 +1,9 @@ -from app.main import app -from app.tests.create_requirements import create_semester, create_user_and_login +from app.main import app, settings +from app.tests.create_requirements import ( + create_semester, + create_user_and_login, + login_admin_user, +) from fastapi.testclient import TestClient with TestClient(app) as client: @@ -16,31 +20,49 @@ def test_unauthorized_show_user(): user = client.get(f"/users/{test_user.user_id}") assert user.status_code == 401 + # admin_token = login_admin_user(client, settings) + test_user.user_id, test_user.token = create_user_and_login( - client, "user_routers@test.com", "test" + client, "user_routers@test.com", "password", "name", "surname" ) + test_user.semester_id = create_semester(client, test_user.user_id, test_user.token) def test_create_user(): """Test creating user and recreating with same email""" user = client.post( - "/users", json={"email": "hey@agu.edu.tr", "password": "123456"} + "/users", + json={ + "email": "hey@agu.edu.tr", + "password": "123456", + "first_name": "name", + "last_name": "surname", + }, ) assert user.status_code == 201 assert user.json()["message"] == "User created" user = client.post( - "/users", json={"email": "hey@agu.edu.tr", "password": "123456"} + "/users", + json={ + "email": "hey@agu.edu.tr", + "password": "123456", + "first_name": "name", + "last_name": "surname", + }, ) assert user.status_code == 409 assert user.json()["message"] == "Given email already exists" - def test_get_current(): + def test_get_current_user(): """Test getting the current user""" - assert test_user.user_id is not None - assert test_user.token is not None - assert test_user.semester_id is not None + user = client.get( + f"/users/", headers={"Authorization": f"Bearer {test_user.token}"} + ) + print(user.json()) + assert user.status_code == 200 + assert user.json()["_id"] == test_user.user_id def test_show_user(): """Test showing user""" @@ -52,13 +74,97 @@ def test_show_user(): assert user.json()["_id"] == test_user.user_id + def test_update_password(): + """Test updating password""" + + user = client.put( + f"/users/{test_user.user_id}/change-password", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"password": "test2"}, + ) + + assert user.status_code == 200 + + def test_update_user_name_with_empty_firstname(): + """Test updating username with empty username""" + + user = client.put( + f"/users/{test_user.user_id}/change-name", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"first_name": ""}, + ) + + assert user.status_code == 422 + + def test_update_user_name_with_empty_lastname(): + """Test updating username with empty username""" + + user = client.put( + f"/users/{test_user.user_id}/change-name", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"last_name": ""}, + ) + + assert user.status_code == 422 + + def test_update_user_name_with_long_firstname(): + """Test updating username with long username""" + + user = client.put( + f"/users/{test_user.user_id}/change-name", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"first_name": "a" * 33}, + ) + + assert user.status_code == 422 + + def test_update_first_name_without_token(): + """Test updating first name without token""" + + user = client.put( + f"/users/{test_user.user_id}/change-name", json={"first_name": "test_name"}, + ) + + assert user.status_code == 401 + + def test_update_current_gpa(): + """Test updating current gpa""" + + user = client.put( + f"/users/{test_user.user_id}/change-gpa", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"current_gpa": 3.5}, + ) + + assert user.status_code == 200 + + def test_update_gpa_more_than_10(): + """Test updating gpa more than 10""" + + user = client.put( + f"/users/{test_user.user_id}/change-gpa", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"current_gpa": 11}, + ) + + assert user.status_code == 422 + + def test_update_gpa_without_token(): + """Test updating gpa without token""" + + user = client.put( + f"/users/{test_user.user_id}/change-gpa", json={"current_gpa": 3.5}, + ) + + assert user.status_code == 401 + def test_update_current_semester(): """Test updating current semester""" user = client.put( f"/users/{test_user.user_id}/current-semester", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"curSemesterID": test_user.semester_id}, + json={"current_semester_id": test_user.semester_id}, ) assert user.status_code == 200 @@ -72,7 +178,7 @@ def test_check_updated_semester(): ) assert user.status_code == 200 - assert user.json()["curSemesterID"] == test_user.semester_id + assert user.json()["current_semester_id"] == test_user.semester_id def test_update_current_university(): """Test updating current university""" @@ -80,7 +186,7 @@ def test_update_current_university(): user = client.put( f"/users/{test_user.user_id}/current-university", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"curUniversityID": "5e9f9d9e8f8f8a0a0a0a0a0a"}, + json={"current_university_id": "5e9f9d9e8f8f8a0a0a0a0a0a"}, ) assert user.status_code == 200 @@ -93,7 +199,7 @@ def test_check_updated_current_university(): headers={"Authorization": f"Bearer {test_user.token}"}, ) - assert user.json()["curUniversityID"] == "5e9f9d9e8f8f8a0a0a0a0a0a" + assert user.json()["current_university_id"] == "5e9f9d9e8f8f8a0a0a0a0a0a" def test_update_entrance_year(): """Test updating entrance year""" @@ -101,7 +207,7 @@ def test_update_entrance_year(): user = client.put( f"/users/{test_user.user_id}/entrance-year", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"entranceYear": "2099"}, + json={"entrance_year": "2099"}, ) assert user.status_code == 200 @@ -114,18 +220,7 @@ def test_check_updated_entrance_year(): headers={"Authorization": f"Bearer {test_user.token}"}, ) - assert user.json()["entranceYear"] == 2099 - - def test_update_password(): - """Test updating password""" - - user = client.put( - f"/users/{test_user.user_id}/change-password", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"password": "test2"}, - ) - - assert user.status_code == 200 + assert user.json()["entrance_year"] == 2099 def test_delete_user(): """Test deleting user""" @@ -137,9 +232,9 @@ def test_delete_user(): assert user.status_code == 200 def test_show_deleted_user(): - # Test for a user that does not exist + # Test for a user that is already deleted. user = client.get( f"/users/{test_user.user_id}", headers={"Authorization": f"Bearer {test_user.token}"}, ) - assert user.status_code == 401 #!check here again + assert user.status_code == 401 From cda647a7299346ba8090a1ea09823c73ee4eb0e7 Mon Sep 17 00:00:00 2001 From: shiny-apricot Date: Wed, 16 Mar 2022 01:13:28 +0300 Subject: [PATCH 16/21] Add user/lesson tests. --- backend/Dockerfile.test | 4 +- backend/app/models/user_models.py | 6 +- .../routers/user_routers/lesson_routers.py | 4 +- .../tests/user_tests/test_lesson_routers.py | 387 ++++++++---------- .../app/tests/user_tests/test_slot_routers.py | 0 5 files changed, 176 insertions(+), 225 deletions(-) create mode 100644 backend/app/tests/user_tests/test_slot_routers.py diff --git a/backend/Dockerfile.test b/backend/Dockerfile.test index bd3a407..f392250 100644 --- a/backend/Dockerfile.test +++ b/backend/Dockerfile.test @@ -15,4 +15,6 @@ RUN pip install --no-cache-dir -r requirements.test.txt COPY . . COPY --from=scheduler-builder /tmp/_scheduler.so /tmp/scheduler.py ./ -CMD [ "pytest" ] \ No newline at end of file +# run the tests with verbose + +CMD [ "pytest" ,"-vv"] \ No newline at end of file diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 35bed30..9a5eeee 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -16,8 +16,8 @@ class Config: class SlotModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - room: str = Field(max_length=100) - day: int = Field(..., ge=0, le=4) + room: str = Field(max_length=127) + day: int = Field(..., ge=0, le=4) # TODO: check the value '4' later hour: int = Field(..., ge=0, le=15) is_lab: int = Field(..., ge=0, le=1) absences: List[int] = [] @@ -257,7 +257,7 @@ class UserModel(BaseModel): current_university_id: str = "null" entrance_year: int = Field(2010, gt=2000) semesters: List[UserSemesterModel] = [] - + class Config: allow_population_by_field_name = True arbitrary_types_allowed = True diff --git a/backend/app/routers/user_routers/lesson_routers.py b/backend/app/routers/user_routers/lesson_routers.py index 498e0a6..a5eb49a 100644 --- a/backend/app/routers/user_routers/lesson_routers.py +++ b/backend/app/routers/user_routers/lesson_routers.py @@ -126,6 +126,7 @@ async def list_lessons( {"$match": {"_id": uid}}, {"$unwind": "$semesters"}, {"$match": {"semesters._id": sid}}, + {"$project": {"semesters.lessons.slots._id": 0}}, ] ) .to_list(length=None) @@ -173,7 +174,8 @@ async def show_lesson( {"$unwind": "$semesters"}, {"$match": {"semesters._id": sid}}, {"$unwind": "$semesters.lessons"}, - {"$match": {"semesters.lessons._id": lid,}}, + {"$match": {"semesters.lessons._id": lid}}, + {"$project": {"semesters.lessons.slots._id": 0}}, ] ) .to_list(length=None) diff --git a/backend/app/tests/user_tests/test_lesson_routers.py b/backend/app/tests/user_tests/test_lesson_routers.py index 4dc187d..74addc5 100644 --- a/backend/app/tests/user_tests/test_lesson_routers.py +++ b/backend/app/tests/user_tests/test_lesson_routers.py @@ -9,12 +9,13 @@ class TestUser: token = None semester_id = None lesson_id = None + lesson_id_list = [] test_user = TestUser() def test_prepare_test_data(): test_user.user_id, test_user.token = create_user_and_login( - client, "lesson_routers@test.com", "test" + client, "lesson_routers@test.com", "password", "name", "surname" ) test_user.semester_id = create_semester( client, test_user.user_id, test_user.token @@ -28,11 +29,14 @@ def test_create_lesson(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Lesson", + "code": "TEST", "instructor": "Test Instructor", - "absenceLimit": 0, + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -40,6 +44,7 @@ def test_create_lesson(): assert lesson.status_code == 201 assert lesson.json()["message"] == "Lesson created" test_user.lesson_id = lesson.json()["_id"] + test_user.lesson_id_list.append(lesson.json()["_id"]) def test_create_lesson_with_another_user_id(): """Test creating lesson with a user id other than auth user""" @@ -50,11 +55,14 @@ def test_create_lesson_with_another_user_id(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Lesson", + "code": "TEST", "instructor": "Test Instructor", - "absenceLimit": 0, + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -71,11 +79,14 @@ def test_create_lesson_with_invalid_semester_id(): headers={"Authorization": f"Bearer {test_user.token}"}, json={ "name": "Test Lesson", + "code": "TEST", "instructor": "Test Instructor", - "absenceLimit": 0, + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -91,14 +102,35 @@ def test_get_lesson(): headers={"Authorization": f"Bearer {test_user.token}"}, ) + print(lesson.json()) + print(lesson.json()["slots"]) assert lesson.status_code == 200 assert lesson.json() == { "_id": test_user.lesson_id, "name": "Test Lesson", + "code": "TEST", "instructor": "Test Instructor", - "absenceLimit": 0, - "slots": [[2, 7, 0], [2, 8, 0]], - "absences": [], + "absence_limit": 0, + "grade": 3.0, + "ects": 5, + "slots": [ + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [], + }, + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 8, + "is_lab": 0, + "absences": [], + }, + ], } def test_get_lesson_with_another_user_id(): @@ -144,12 +176,15 @@ def test_update_lesson(): f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 1}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -165,12 +200,15 @@ def test_update_lesson_with_another_user_id(): f"/users/{user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 1}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -186,12 +224,15 @@ def test_update_lesson_with_invalid_semester_id(): f"/users/{test_user.user_id}/semesters/{semester_id}/lessons/{test_user.lesson_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 1}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) @@ -207,18 +248,24 @@ def test_update_lesson_with_invalid_lesson_id(): f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{lesson_id}", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 3, "hour": 5, "isLab": 0}, - {"day": 3, "hour": 6, "isLab": 1}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) - assert lesson.status_code == 404 - assert lesson.json()["message"] == "Lesson not found" + assert lesson.status_code == 409 + assert ( + lesson.json()["message"] + == "Given lesson code already exists or lesson not found" + ) def test_list_lessons(): """Test listing lessons""" @@ -233,12 +280,31 @@ def test_list_lessons(): assert lessons.json() == [ { "_id": test_user.lesson_id, - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, - "slots": [[3, 5, 0], [3, 6, 1]], - "absences": [], - } + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": 3.0, + "slots": [ + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [], + }, + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 8, + "is_lab": 0, + "absences": [], + }, + ], + }, ] def test_list_lessons_with_another_user_id(): @@ -272,18 +338,22 @@ def test_create_second_lesson(): f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons", headers={"Authorization": f"Bearer {test_user.token}"}, json={ - "name": "Test Lesson 3", - "instructor": "Test Instructor 3", - "absenceLimit": 0, + "name": "Test Lesson 2", + "code": "TEST 2", + "instructor": "Test Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", "slots": [ - {"day": 2, "hour": 7, "isLab": 0}, - {"day": 2, "hour": 8, "isLab": 0}, + {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, ], }, ) assert lesson.status_code == 201 assert lesson.json()["message"] == "Lesson created" + test_user.lesson_id_list.append(lesson.json()["_id"]) def test_list_lessons_with_two_lessons(): """Test listing lessons with two lessons""" @@ -296,185 +366,61 @@ def test_list_lessons_with_two_lessons(): assert lessons.status_code == 200 assert lessons.json() == [ { - "_id": lessons.json()[0]["_id"], - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, - "slots": [[3, 5, 0], [3, 6, 1]], - "absences": [], + "_id": test_user.lesson_id, + "name": "Updated Test Lesson", + "code": "TEST", + "instructor": "Updated Instructor", + "ects": 5, + "absence_limit": 0, + "grade": 3.0, + "slots": [ + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [], + }, + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 8, + "is_lab": 0, + "absences": [], + }, + ], }, { - "_id": lessons.json()[1]["_id"], - "name": "Test Lesson 3", - "instructor": "Test Instructor 3", - "absenceLimit": 0, - "slots": [[2, 7, 0], [2, 8, 0]], - "absences": [], + "_id": test_user.lesson_id_list[1], + "name": "Test Lesson 2", + "code": "TEST 2", + "instructor": "Test Instructor", + "ects": 5, + "absence_limit": 0, + "grade": 3.0, + "slots": [ + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 7, + "is_lab": 0, + "absences": [], + }, + { + "_id": None, + "room": "B200", + "day": 2, + "hour": 8, + "is_lab": 0, + "absences": [], + }, + ], }, ] - def test_create_absence(): - """Test creating absence""" - - absence = client.post( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 201 - assert absence.json()["message"] == "Absence created" - - def test_get_lesson_after_adding_absence(): - """Test getting lesson after adding absence""" - - lesson = client.get( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", - headers={"Authorization": f"Bearer {test_user.token}"}, - ) - - assert lesson.status_code == 200 - assert lesson.json() == { - "_id": test_user.lesson_id, - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, - "slots": [[3, 5, 0], [3, 6, 1]], - "absences": [[0, 3, 5, 0]], - } - - def test_create_same_absence(): - """Test creating same absence""" - - absence = client.post( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 400 - assert absence.json()["message"] == "Absence already exists" - - def test_create_absence_with_another_user_id(): - """Test creating absence with a user id other than auth user""" - - user_id = "non_exists_user_id" - absence = client.post( - f"/users/{user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 403 - assert absence.json()["message"] == "No right to access" - - def test_create_absence_with_invalid_semester_id(): - """Test creating absence with an invalid semester id""" - - semester_id = "non_exists_semester_id" - absence = client.post( - f"/users/{test_user.user_id}/semesters/{semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 404 - assert absence.json()["message"] == "Absence could not be created" - - def test_create_absence_with_invalid_lesson_id(): - """Test creating absence with an invalid lesson id""" - - lesson_id = "non_exists_lesson_id" - absence = client.post( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 404 - assert absence.json()["message"] == "Absence could not be created" - - def test_delete_absence(): - """Test deleting absence""" - - absence = client.delete( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 200 - assert absence.json()["message"] == "Absence deleted" - - def test_get_lesson_after_deleting_absence(): - """Test getting lesson after deleting absence""" - - lesson = client.get( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}", - headers={"Authorization": f"Bearer {test_user.token}"}, - ) - - assert lesson.status_code == 200 - assert lesson.json() == { - "_id": test_user.lesson_id, - "name": "Test Lesson 2", - "instructor": "Test Instructor 2", - "absenceLimit": 0, - "slots": [[3, 5, 0], [3, 6, 1]], - "absences": [], - } - - def test_delete_same_absence(): - """Test deleting same absence""" - - absence = client.delete( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 404 - assert absence.json()["message"] == "Absence not found" - - def test_delete_absence_with_another_user_id(): - """Test deleting absence with a user id other than auth user""" - - user_id = "non_exists_user_id" - absence = client.delete( - f"/users/{user_id}/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 403 - assert absence.json()["message"] == "No right to access" - - def test_delete_absence_with_invalid_semester_id(): - """Test deleting absence with an invalid semester id""" - - semester_id = "non_exists_semester_id" - absence = client.delete( - f"/users/{test_user.user_id}/semesters/{semester_id}/lessons/{test_user.lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 404 - assert absence.json()["message"] == "Absence not found" - - def test_delete_absence_with_invalid_lesson_id(): - """Test deleting absence with an invalid lesson id""" - - lesson_id = "non_exists_lesson_id" - absence = client.delete( - f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons/{lesson_id}/absences", - headers={"Authorization": f"Bearer {test_user.token}"}, - json={"absence": {"week": 0, "day": 3, "hour": 5, "isLab": 0}}, - ) - - assert absence.status_code == 404 - assert absence.json()["message"] == "Absence not found" - def test_delete_lesson(): """Test deleting lesson""" @@ -532,3 +478,4 @@ def test_delete_lesson_with_invalid_lesson_id(): assert lesson.status_code == 404 assert lesson.json()["message"] == "Lesson not found" + diff --git a/backend/app/tests/user_tests/test_slot_routers.py b/backend/app/tests/user_tests/test_slot_routers.py new file mode 100644 index 0000000..e69de29 From f8d043b645cd20a49d7be75daf208fe0b5601264 Mon Sep 17 00:00:00 2001 From: shiny-apricot Date: Thu, 17 Mar 2022 00:29:55 +0300 Subject: [PATCH 17/21] Add user/slot_routers tests. --- backend/app/models/user_models.py | 2 +- .../app/tests/user_tests/test_slot_routers.py | 386 ++++++++++++++++++ 2 files changed, 387 insertions(+), 1 deletion(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 9a5eeee..dc27689 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -16,7 +16,7 @@ class Config: class SlotModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - room: str = Field(max_length=127) + room: str = Field(min_length=1, max_length=127) day: int = Field(..., ge=0, le=4) # TODO: check the value '4' later hour: int = Field(..., ge=0, le=15) is_lab: int = Field(..., ge=0, le=1) diff --git a/backend/app/tests/user_tests/test_slot_routers.py b/backend/app/tests/user_tests/test_slot_routers.py index e69de29..03a2aa8 100644 --- a/backend/app/tests/user_tests/test_slot_routers.py +++ b/backend/app/tests/user_tests/test_slot_routers.py @@ -0,0 +1,386 @@ +from re import M +from unittest.mock import Mock +from app.main import app +from app.tests.create_requirements import create_semester, create_user_and_login +from fastapi.testclient import TestClient + +with TestClient(app) as client: + + class TestUser: + user_id = None + token = None + semester_id = None + lesson_id = None + lesson_id_list = [] + slot_id = None + slot_id_list = [] + absence = None + absence_list = [] + + test_user = TestUser() + + def test_prepare_test_data(): + test_user.user_id, test_user.token = create_user_and_login( + client, "slot_routers@test.com", "password", "name", "surname" + ) + test_user.semester_id = create_semester( + client, test_user.user_id, test_user.token + ) + + def test_create_lesson(): + """Test creating lesson""" + + lesson = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}/lessons", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={ + "name": "Test Lesson", + "code": "TEST", + "instructor": "Test Instructor", + "ects": 5, + "absence_limit": 0, + "grade": "3.0", + "slots": [{"room": "B200", "day": 2, "hour": 7, "is_lab": 0},], + }, + ) + + assert lesson.status_code == 201 + assert lesson.json()["message"] == "Lesson created" + test_user.lesson_id = lesson.json()["_id"] + test_user.lesson_id_list.append(lesson.json()["_id"]) + + def test_create_slot(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "F0D01", "day": 1, "hour": 7, "is_lab": 0, "absences": []}, + ) + assert response.status_code == 201 + test_user.slot_id = response.json()["_id"] + test_user.slot_id_list.append(test_user.slot_id) + + def test_create_slot_that_already_exists(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "F0D01", "day": 1, "hour": 7, "is_lab": 0, "absences": []}, + ) + assert response.status_code == 409 + assert response.json()["message"] == "Given slot already exists" + + def test_create_slot_with_invalid_day(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "F0D01", "day": 7, "hour": 7, "is_lab": 0}, + ) + assert response.status_code == 422 + + def test_create_slot_with_invalid_hour(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "F0D01", "day": 2, "hour": 17, "is_lab": 0}, + ) + assert response.status_code == 422 + + def test_create_slot_with_invalid_room(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "", "day": 2, "hour": 7, "is_lab": 0}, + ) + assert response.status_code == 422 + + def test_create_slot_with_invalid_is_lab(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "F0D01", "day": 2, "hour": 7, "is_lab": 3}, + ) + assert response.status_code == 422 + + ####### * UPDATE SLOT SECTION * ####### + + def test_update_slot(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={ + "room": "updated_room", + "day": 3, + "hour": 7, + "is_lab": 1, + "absences": [], + }, + ) + + assert response.status_code == 200 + + def test_update_slot_with_invalid_day(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 7, "hour": 7, "is_lab": 1}, + ) + assert response.status_code == 422 + + def test_update_slot_with_invalid_hour(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 3, "hour": 25, "is_lab": 1}, + ) + assert response.status_code == 422 + + def test_update_slot_with_invalid_is_lab(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 3, "hour": 7, "is_lab": 3}, + ) + assert response.status_code == 422 + + def test_update_slot_with_invalid_lesson_id(): + mock_lesson_id = 44 + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{mock_lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 3, "hour": 7, "is_lab": 1}, + ) + assert response.status_code == 404 + + def test_update_slot_with_invalid_semester_id(): + mock_semester_id = 44 + response = client.put( + f"/users/{test_user.user_id}/semesters/{mock_semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 3, "hour": 7, "is_lab": 1}, + ) + assert response.status_code == 404 + + def test_update_slot_with_invalid_user_id(): + mock_user_id = 44 + response = client.put( + f"/users/{mock_user_id}" + + f"/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "updated_room", "day": 3, "hour": 7, "is_lab": 1}, + ) + assert response.status_code == 403 + + def test_create_second_slot(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "second_room", "day": 4, "hour": 7, "is_lab": 0}, + ) + assert response.status_code == 201 + test_user.slot_id_list.append(response.json()["_id"]) + + def test_update_slot_with_duplicate_slot(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"room": "duplicate second_room", "day": 4, "hour": 7, "is_lab": 0}, + ) + assert response.status_code == 409 + + ######## * CREATE ABSENCE SECTION * ######## + + def test_create_absence(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 201 + test_user.absence = 1 + test_user.absence_list.append(1) + + def test_create_absence_with_invalid_week(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 0}, + ) + assert response.status_code == 422 + + def test_create_absence_with_invalid_lesson_id(): + mock_lesson_id = 44 + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{mock_lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 404 + + def test_create_absence_with_invalid_semester_id(): + mock_semester_id = 44 + response = client.post( + f"/users/{test_user.user_id}/semesters/{mock_semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 404 + + def test_create_absence_with_invalid_user_id(): + mock_user_id = 44 + response = client.post( + f"/users/{mock_user_id}" + + f"/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 403 + + def test_create_absence_with_duplicate_absence(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 400 + + def test_create_second_absence(): + response = client.post( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 201 + test_user.absence_list.append(44) + + ######## * DELETE ABSENCE SECTION * ######## + + def test_delete_absence(): + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 1}, + ) + assert response.status_code == 200 + + def test_delete_absence_with_invalid_lesson_id(): + mock_lesson_id = 44 + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{mock_lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 404 + + def test_delete_absence_with_invalid_semester_id(): + mock_semester_id = 44 + response = client.delete( + f"/users/{test_user.user_id}/semesters/{mock_semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 404 + + def test_delete_absence_with_invalid_user_id(): + mock_user_id = 44 + response = client.delete( + f"/users/{mock_user_id}" + + f"/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 403 + + def test_delete_absence_with_invalid_absence_id(): + mock_absence_id = 44 + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{mock_absence_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 404 + + def test_delete_second_absence(): + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/absences/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"week": 44}, + ) + assert response.status_code == 200 + test_user.absence_list.remove(44) + + ######## * DELETE SLOT SECTION * ######## + def test_delete_slot(): + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert response.status_code == 200 + + def test_delete_slot_with_invalid_lesson_id(): + mock_lesson_id = 44 + response = client.delete( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{mock_lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert response.status_code == 404 + + def test_delete_slot_with_invalid_semester_id(): + mock_semester_id = 44 + response = client.delete( + f"/users/{test_user.user_id}/semesters/{mock_semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert response.status_code == 404 + + def test_delete_slot_with_invalid_user_id(): + mock_user_id = 44 + response = client.delete( + f"/users/{mock_user_id}" + + f"/semesters/{test_user.semester_id}/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert response.status_code == 403 + + def test_delete_user(): + """Test deleting user""" + + user = client.delete( + f"/users/{test_user.user_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert user.status_code == 200 + + def test_show_deleted_user(): + # Test for a user that is already deleted. + user = client.get( + f"/users/{test_user.user_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + ) + assert user.status_code == 401 From 88a3d55f08ac5bcfc96aab70c31a7c001394f59f Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Thu, 17 Mar 2022 12:52:29 +0300 Subject: [PATCH 18/21] let empty room for slots --- backend/app/models/user_models.py | 4 ++-- backend/app/tests/user_tests/test_slot_routers.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index dc27689..9dff7c4 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -16,8 +16,8 @@ class Config: class SlotModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - room: str = Field(min_length=1, max_length=127) - day: int = Field(..., ge=0, le=4) # TODO: check the value '4' later + room: str = Field(max_length=127) + day: int = Field(..., ge=0, le=4) # TODO: check the value '4' later hour: int = Field(..., ge=0, le=15) is_lab: int = Field(..., ge=0, le=1) absences: List[int] = [] diff --git a/backend/app/tests/user_tests/test_slot_routers.py b/backend/app/tests/user_tests/test_slot_routers.py index 03a2aa8..dbdc4d7 100644 --- a/backend/app/tests/user_tests/test_slot_routers.py +++ b/backend/app/tests/user_tests/test_slot_routers.py @@ -88,14 +88,14 @@ def test_create_slot_with_invalid_hour(): ) assert response.status_code == 422 - def test_create_slot_with_invalid_room(): + def test_create_slot_with_empty_room(): response = client.post( f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + f"/lessons/{test_user.lesson_id}/slots", headers={"Authorization": f"Bearer {test_user.token}"}, - json={"room": "", "day": 2, "hour": 7, "is_lab": 0}, + json={"room": "", "day": 0, "hour": 7, "is_lab": 0}, ) - assert response.status_code == 422 + assert response.status_code == 201 def test_create_slot_with_invalid_is_lab(): response = client.post( @@ -367,7 +367,7 @@ def test_delete_slot_with_invalid_user_id(): headers={"Authorization": f"Bearer {test_user.token}"}, ) assert response.status_code == 403 - + def test_delete_user(): """Test deleting user""" From eefa6ec4295434800923ad798b348b8fc868cec1 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Thu, 17 Mar 2022 09:56:45 +0000 Subject: [PATCH 19/21] Generate openapi.json --- openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi.json b/openapi.json index edba0ee..8f6895d 100644 --- a/openapi.json +++ b/openapi.json @@ -1 +1 @@ -{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/token":{"post":{"tags":["token"],"summary":"Login For Access Token","operationId":"login_for_access_token_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_for_access_token_token_post"}}},"required":true},"responses":{"200":{"description":"Get token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users":{"get":{"tags":["users"],"summary":"Get Current","operationId":"getCurrentUser","responses":{"200":{"description":"Get current user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["users"],"summary":"Create User","description":"Create a user","operationId":"createUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{uid}":{"get":{"tags":["users"],"summary":"Show User","description":"Get a single user with given userID","operationId":"getSingleUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Get a single user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["users"],"summary":"Delete User","description":"Delete a user with given userID","operationId":"deleteUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Delete user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-password":{"put":{"tags":["users"],"summary":"Update Password","description":"Update password of a user with given userID","operationId":"updatePassword","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePasswordModel"}}},"required":true},"responses":{"200":{"description":"Update password of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-semester":{"put":{"tags":["users"],"summary":"Update Current Semester","description":"Update current semester ID of a user with given userID","operationId":"updateCurrentSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-university":{"put":{"tags":["users"],"summary":"Update Current University","description":"Update current university ID of a user with given userID","operationId":"updateCurrentUniversity","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update current university ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/entrance-year":{"put":{"tags":["users"],"summary":"Update Entrance Year","description":"Update entrance year of a user with given userID","operationId":"updateEntranceyear","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEntranceYearModel"}}},"required":true},"responses":{"200":{"description":"Update entrance year of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/professors":{"post":{"tags":["users"],"summary":"Create Professor User","description":"Create a professor user","operationId":"createProfessorUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new professor user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters":{"get":{"tags":["semesters"],"summary":"List Semesters","description":"list all semesters of a user with given userID","operationId":"listSemestersOfUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"List all semesters","content":{"application/json":{"schema":{"title":"Response List Semesters Users Uid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/SemesterAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["semesters"],"summary":"Create Semester","description":"Create a semester for a user with given userID","operationId":"createSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}":{"get":{"tags":["semesters"],"summary":"Show Semester","description":"Get a single semester with given userID and semesterID","operationId":"getSingleSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Get a single semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemesterAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["semesters"],"summary":"Update Semester","description":"Update a semester with given userID and semesterID","operationId":"updateSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["semesters"],"summary":"Delete Semester","description":"Delete a semester with given userID and semesterID","operationId":"deleteSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Delete semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons":{"get":{"tags":["lessons"],"summary":"List Lessons","description":"List all lessons of a semester with given userID, semesterID","operationId":"listLessonsOfSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"List all lessons of a semester","content":{"application/json":{"schema":{"title":"Response List Lessons Users Uid Semesters Sid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/LessonAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["lessons"],"summary":"Create Lesson","description":"Create a lessons for a semester with given userID, semesterID","operationId":"createLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonModel"}}},"required":true},"responses":{"200":{"description":"Add new lesson into a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}":{"get":{"tags":["lessons"],"summary":"Show Lesson","description":"Get a single lesson with given userID, semesterID and lessonID","operationId":"getSingleLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Get a single lesson of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["lessons"],"summary":"Update Lesson","description":"Update a lesson with given userID, semesterID and lessonID","operationId":"updateLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["lessons"],"summary":"Delete Lesson","description":"Delete a lesson with given userID, semesterID and lessonID","operationId":"deleteLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Delete lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/absences":{"post":{"tags":["lessons"],"summary":"Create Absence","description":"Create an absence for a lesson with given userID, semesterID and lessonID","operationId":"createAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAbsenceModel"}}},"required":true},"responses":{"200":{"description":"Add absence into a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["lessons"],"summary":"Delete Absence","description":"Delete an absence from a lesson with given userID, semesterID and lessonID","operationId":"deleteAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAbsenceModel"}}},"required":true},"responses":{"200":{"description":"Delete absence into a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities":{"get":{"tags":["universities"],"summary":"List Universities","description":"list all universities","operationId":"listUniversities","responses":{"200":{"description":"List all universities","content":{"application/json":{"schema":{"title":"Response List Universities Universities Get","type":"array","items":{"$ref":"#/components/schemas/UniversityAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}}},"post":{"tags":["universities"],"summary":"Create University","description":"Create a university","operationId":"createUniversity","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityModel"}}},"required":true},"responses":{"200":{"description":"Add new university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}":{"get":{"tags":["universities"],"summary":"Show University","description":"Get a single university with given universityID","operationId":"getSingleUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get a single university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["universities"],"summary":"Delete University","description":"Delete a university with given universityID","operationId":"deleteUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Delete university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/update-name":{"put":{"tags":["universities"],"summary":"Update University Name","description":"Update name of a university with given universityID","operationId":"updateUniversityName","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUniversityNameModel"}}},"required":true},"responses":{"200":{"description":"Update a university name","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/current-semester":{"get":{"tags":["universities"],"summary":"Show University Current Semester","description":"Get current semester of a university with given universityID","operationId":"getCurrentUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University Current Semester","description":"Update current semester of a university with given universityID","operationId":"updateUniversityCurrentSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters":{"get":{"tags":["university semesters"],"summary":"List University Semesters","description":"list all semesters of a university with given universityID","operationId":"listUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university semeseters","content":{"application/json":{"schema":{"title":"Response List University Semesters Universities Unid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university semesters"],"summary":"Create University Semester","description":"Create semester for a university with given universityID","operationId":"createUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}":{"get":{"tags":["university semesters"],"summary":"Show University Semester","description":"Get a single semester of a university with given universityID and universitySemesterID","operationId":"getSingleUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List a university semeseters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university semesters"],"summary":"Update University Semester","description":"Update university of a semester with given universityID and universitySemesterID","operationId":"updateUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university semesters"],"summary":"Delete University Semester","description":"Delete a university semester with given universityID and universitySemesterID","operationId":"deleteUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"Delete university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons":{"get":{"tags":["university lessons"],"summary":"List University Lessons","description":"list all lessons for a semesters of a university with given universityID and universitySemesterID","operationId":"listUniversitySemesterLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List all lessons of a university semester","content":{"application/json":{"schema":{"title":"Response List University Lessons Universities Unid Semesters Unisid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university lessons"],"summary":"Create University Lesson","description":"Create a lesson for a semester of a university with given universityID and universitySemesterID","operationId":"createUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/current-semester/lessons/find-code":{"get":{"tags":["university lessons"],"summary":"Show Lesson With Code","description":"Get a single lesson of a university semester with given universityID and Lesson Code","operationId":"getSingleLessonWithCode","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Code","type":"string"},"name":"code","in":"query"}],"responses":{"200":{"description":"Get a single lessons with code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}":{"get":{"tags":["university lessons"],"summary":"Show University Lesson","description":"Get a single lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"getSingleUniversitySemesterLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Get a single lessons of a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university lessons"],"summary":"Update University Lesson","description":"Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"updateUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}},"required":true},"responses":{"200":{"description":"Update a university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university lessons"],"summary":"Delete University Lesson","description":"Delete a university lesson with given universityID, universitySemesterID and universityLessonID","operationId":"deleteUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Delete university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections/{secid}":{"put":{"tags":["university sections"],"summary":"Update Lesson Section","description":"Update section of a lesson with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"updateLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university sections"],"summary":"Delete Lesson Section","description":"Delete a lesson section with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"deleteLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"responses":{"200":{"description":"Delete a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments":{"get":{"tags":["departments"],"summary":"List University Departments","description":"list all departments of a university with given universityID","operationId":"listUniversityDepartments","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university departments","content":{"application/json":{"schema":{"title":"Response List University Departments Universities Unid Departments Get","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["departments"],"summary":"Create University Department","description":"Create department for a university with given universityID","operationId":"createUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Add new university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}":{"get":{"tags":["departments"],"summary":"Show University Department","description":"Get a single semester of a university with given universityID and universityDepartmentID","operationId":"getSingleUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Show a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["departments"],"summary":"Update University Department","description":"Update department of a university with given universityID and universityDepartmentID","operationId":"updateUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Update a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["departments"],"summary":"Delete University Department","description":"Delete a university department with given universityID and universitySemesterID","operationId":"deleteUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Delete university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums":{"get":{"tags":["curriculums"],"summary":"List Department Curriculums","description":"list all curriculums of a department of a university with given universityID and universityDepartmentID","operationId":"listUniversityDepartmentCurriculums","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"List all university curriculums","content":{"application/json":{"schema":{"title":"Response List Department Curriculums Universities Unid Departments Depid Curriculums Get","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculums"],"summary":"Create Department Curriculum","description":"Create department for a university with given universityID and universityDepartmentID","operationId":"createUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Add new university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}":{"get":{"tags":["curriculums"],"summary":"Show Department Curriculum","description":"Get a single semester of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"getSingleUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Show a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculums"],"summary":"Update Department Curriculum","description":"Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"updateUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Update a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculums"],"summary":"Delete Department Curriculum","description":"Delete a university department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"deleteUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Delete university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters":{"get":{"tags":["curriculum semesters"],"summary":"List Curriculum Semesters","description":"list all semesters of a curriculum of a department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"listCurriculumSemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"List all curriculum semesters","content":{"application/json":{"schema":{"title":"Response List Curriculum Semesters Universities Unid Departments Depid Curriculums Curid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum semesters"],"summary":"Create Curriculum Semester","description":"Create semester for a curriculum with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"createCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}":{"get":{"tags":["curriculum semesters"],"summary":"Show Curriculum Semester","description":"Get a single semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"getSingleCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Show a university curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum semesters"],"summary":"Update Curriculum Semester","description":"Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"updateCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum semesters"],"summary":"Delete Curriculum Semester","description":"Delete a university department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"deleteCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Delete curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons":{"get":{"tags":["curriculum lessons"],"summary":"List Curriculum Lessons","description":"list all lessons of a curriculum semester of a department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"listCurriculumLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"List all curriculum lessons","content":{"application/json":{"schema":{"title":"Response List Curriculum Lessons Universities Unid Departments Depid Curriculums Curid Semesters Cursid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum lessons"],"summary":"Create Curriculum Lesson","description":"Create lesson for a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"createCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons/{curlid}":{"get":{"tags":["curriculum lessons"],"summary":"Show Curriculum Lesson","description":"Get a single lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"getSingleCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Show a curriculum semester lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum lessons"],"summary":"Update Curriculum Lesson","description":"Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"updateCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum lessons"],"summary":"Delete Curriculum Lesson","description":"Delete a lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"deleteCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Delete curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/schedule":{"post":{"tags":["scheduler"],"summary":"Create Schedule","description":"Create schedules for given lessons","operationId":"createSchedule","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"title":"Lesson Codes","type":"array","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"Create schedules for given lessons","content":{"application/json":{"schema":{"title":"Response Create Schedule Universities Unid Schedule Post","type":"array","items":{"type":"object","additionalProperties":{"type":"integer"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AbsenceModel":{"title":"AbsenceModel","required":["week","day","hour","isLab"],"type":"object","properties":{"week":{"title":"Week","minimum":0.0,"type":"integer"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"isLab":{"title":"Islab","maximum":1.0,"minimum":0.0,"type":"integer"}}},"Body_login_for_access_token_token_post":{"title":"Body_login_for_access_token_token_post","required":["username","password"],"type":"object","properties":{"grant_type":{"title":"Grant Type","pattern":"password","type":"string"},"username":{"title":"Username","type":"string"},"password":{"title":"Password","type":"string"},"scope":{"title":"Scope","type":"string","default":""},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}}},"CurriculumLessonModel":{"title":"CurriculumLessonModel","required":["name","code","lessonType"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"lessonType":{"title":"Lessontype","type":"string"}},"example":{"name":"PHYSICS I","code":"PHYS101","lessonType":"science"}},"CurriculumSemesterModel":{"title":"CurriculumSemesterModel","required":["semester"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"semester":{"title":"Semester","exclusiveMaximum":9.0,"exclusiveMinimum":0.0,"type":"integer"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"},"default":[]}},"example":{"semester":1}},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"LessonAPIModel":{"title":"LessonAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"instructor":{"title":"Instructor","type":"string"},"absenceLimit":{"title":"Absencelimit","type":"integer"},"slots":{"title":"Slots","type":"array","items":{"type":"array","items":{"type":"integer"}}},"absences":{"title":"Absences","type":"array","items":{"type":"array","items":{"type":"integer"}}}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"Algebra","instructor":"Jack Joe","absenceLimit":21,"slots":[[2,7,0],[2,8,0]],"absences":[[0,2,7,0],[0,2,8,0]]}},"LessonAbsenceModel":{"title":"LessonAbsenceModel","required":["absence"],"type":"object","properties":{"absence":{"$ref":"#/components/schemas/AbsenceModel"}},"example":{"absence":{"week":0,"day":2,"hour":7,"isLab":0}}},"LessonModel":{"title":"LessonModel","required":["name","instructor","absenceLimit","slots"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"instructor":{"title":"Instructor","minLength":1,"type":"string"},"absenceLimit":{"title":"Absencelimit","minimum":0.0,"type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotModel"}},"absences":{"title":"Absences","type":"array","items":{"$ref":"#/components/schemas/AbsenceModel"},"default":[]}},"example":{"name":"Algebra","instructor":"Jack Joe","absenceLimit":21,"slots":[{"day":2,"hour":7,"isLab":0},{"day":2,"hour":8,"isLab":0}],"absences":[{"week":0,"day":2,"hour":7,"isLab":0},{"week":0,"day":2,"hour":8,"isLab":0}]}},"Message":{"title":"Message","required":["message"],"type":"object","properties":{"message":{"title":"Message","type":"string"}}},"MessageCreate":{"title":"MessageCreate","required":["_id","message"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"message":{"title":"Message","type":"string"}},"example":{"_id":"61ddea901311ecaed99afb7c","message":"string"}},"SemesterAPIModel":{"title":"SemesterAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"startDate":{"title":"Startdate","type":"string","format":"date-time"},"endDate":{"title":"Enddate","type":"string","format":"date-time"},"startHour":{"title":"Starthour","type":"string"},"dLesson":{"title":"Dlesson","type":"integer"},"dBreak":{"title":"Dbreak","type":"integer"},"slotCount":{"title":"Slotcount","type":"integer"}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"2020-21 Spring","startDate":"2022-02-18T00:00:00Z","endDate":"2022-06-18T00:00:00Z","startHour":"8.10","dLesson":50,"dBreak":10,"slotCount":12}},"SlotModel":{"title":"SlotModel","required":["day","hour","isLab"],"type":"object","properties":{"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"isLab":{"title":"Islab","maximum":1.0,"minimum":0.0,"type":"integer"}}},"Token":{"title":"Token","required":["access_token","token_type"],"type":"object","properties":{"access_token":{"title":"Access Token","type":"string"},"token_type":{"title":"Token Type","type":"string"}}},"UniversityAPIModel":{"title":"UniversityAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"curSemesterID":{"title":"Cursemesterid","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"AGU","curSemesterID":"61fc266ae3d749b1d65c17c7"}},"UniversityCurriculumModel":{"title":"UniversityCurriculumModel","required":["name","startYear","endYear"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"startYear":{"title":"Startyear","type":"integer"},"endYear":{"title":"Endyear","type":"integer"},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"},"default":[]}},"example":{"name":"2016 Later","startYear":2016,"endYear":2100}},"UniversityDepartmentModel":{"title":"UniversityDepartmentModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"curriculums":{"title":"Curriculums","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"},"default":[]}},"example":{"name":"COMP"}},"UniversityLessonAPIModel":{"title":"UniversityLessonAPIModel","required":["name","code","ects","absenceLimit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absenceLimit":{"title":"Absencelimit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absenceLimit":0}},"UniversityLessonModel":{"title":"UniversityLessonModel","required":["name","code","ects","absenceLimit","section","instructor","slots"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absenceLimit":{"title":"Absencelimit","minimum":0.0,"type":"integer"},"section":{"title":"Section","type":"string"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absenceLimit":8,"section":"01","instructor":"JACK JOE","slots":[{"day":2,"hour":7,"isLab":0},{"day":2,"hour":8,"isLab":0}]}},"UniversityModel":{"title":"UniversityModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"departments":{"title":"Departments","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"},"default":[]},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterModel"},"default":[]}},"example":{"name":"AGU"}},"UniversitySectionAPIModel":{"title":"UniversitySectionAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"section":{"title":"Section","type":"string"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"type":"array","items":{"type":"integer"}}}},"example":{"section":"01","instructor":"JACK JOE","slots":[[2,7,0],[2,8,0]]}},"UniversitySectionModel":{"title":"UniversitySectionModel","required":["section","instructor","slots"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"section":{"title":"Section","type":"string"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"section":"01","instructor":"JACK JOE","slots":[{"day":2,"hour":7,"isLab":0},{"day":2,"hour":8,"isLab":0}]}},"UniversitySemesterModel":{"title":"UniversitySemesterModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"},"default":[]}},"example":{"name":"20-21 Spring"}},"UniversitySlotModel":{"title":"UniversitySlotModel","required":["day","hour","isLab"],"type":"object","properties":{"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"isLab":{"title":"Islab","maximum":1.0,"minimum":0.0,"type":"integer"}}},"UpdateEntranceYearModel":{"title":"UpdateEntranceYearModel","required":["entranceYear"],"type":"object","properties":{"entranceYear":{"title":"Entranceyear","type":"integer"}},"example":{"entranceYear":2018}},"UpdateLessonModel":{"title":"UpdateLessonModel","required":["name","instructor","absenceLimit","slots"],"type":"object","properties":{"name":{"title":"Name","type":"string"},"instructor":{"title":"Instructor","type":"string"},"absenceLimit":{"title":"Absencelimit","minimum":0.0,"type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotModel"}}},"example":{"name":"Algebra","instructor":"Jack Joe","absenceLimit":21,"slots":[{"day":2,"hour":7,"isLab":0},{"day":2,"hour":8,"isLab":0}]}},"UpdatePasswordModel":{"title":"UpdatePasswordModel","required":["password"],"type":"object","properties":{"password":{"title":"Password","type":"string"}},"example":{"password":"123456"}},"UpdateSemesterModel":{"title":"UpdateSemesterModel","required":["curSemesterID"],"type":"object","properties":{"curSemesterID":{"title":"Cursemesterid","type":"string"}},"example":{"curSemesterID":"61ddea901311ecaed99afb7f"}},"UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["curUniversityID"],"type":"object","properties":{"curUniversityID":{"title":"Curuniversityid","type":"string"}},"example":{"curUniversityID":"61ddea901311ecaed99afb7g"}},"UpdateUniversityNameModel":{"title":"UpdateUniversityNameModel","required":["name"],"type":"object","properties":{"name":{"title":"Name","type":"string"}},"example":{"name":"AGU"}},"UpdateUserSemesterModel":{"title":"UpdateUserSemesterModel","required":["name","startDate","endDate","startHour","dLesson","dBreak","slotCount"],"type":"object","properties":{"name":{"title":"Name","type":"string"},"startDate":{"title":"Startdate","type":"string","format":"date-time"},"endDate":{"title":"Enddate","type":"string","format":"date-time"},"startHour":{"title":"Starthour","type":"string"},"dLesson":{"title":"Dlesson","exclusiveMinimum":0.0,"type":"integer"},"dBreak":{"title":"Dbreak","exclusiveMinimum":0.0,"type":"integer"},"slotCount":{"title":"Slotcount","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"}},"example":{"name":"2020-21 Spring","startDate":"2022-02-18T00:00:00Z","endDate":"2022-06-18T00:00:00Z","startHour":"8.10","dLesson":50,"dBreak":10,"slotCount":12}},"UserAPIModel":{"title":"UserAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"userGroup":{"title":"Usergroup","type":"string"},"curSemesterID":{"title":"Cursemesterid","type":"string"},"curUniversityID":{"title":"Curuniversityid","type":"string"},"entranceYear":{"title":"Entranceyear","type":"integer"}},"example":{"_id":"61ddea901311ecaed99afb7c","email":"hello@agu.edu.tr","userGroup":"default","curSemesterID":"61ddea901311ecaed99afb7d","curUniversityID":"61ddea901311ecaed99afb7e","entranceYear":2018}},"UserModel":{"title":"UserModel","required":["email","password"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"password":{"title":"Password","type":"string"},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UserSemesterModel"},"default":[]}},"example":{"email":"hello@agu.edu.tr","password":"123456"}},"UserSemesterModel":{"title":"UserSemesterModel","required":["name","startDate","endDate","startHour","dLesson","dBreak","slotCount"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"startDate":{"title":"Startdate","type":"string","format":"date-time"},"endDate":{"title":"Enddate","type":"string","format":"date-time"},"startHour":{"title":"Starthour","type":"string"},"dLesson":{"title":"Dlesson","exclusiveMinimum":0.0,"type":"integer"},"dBreak":{"title":"Dbreak","exclusiveMinimum":0.0,"type":"integer"},"slotCount":{"title":"Slotcount","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/LessonModel"},"default":[]}},"example":{"name":"2020-21 Spring","startDate":"2022-02-18T00:00:00Z","endDate":"2022-06-18T00:00:00Z","startHour":"8.10","dLesson":50,"dBreak":10,"slotCount":12}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} \ No newline at end of file +{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/token":{"post":{"tags":["token"],"summary":"Login For Access Token","operationId":"login_for_access_token_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_for_access_token_token_post"}}},"required":true},"responses":{"200":{"description":"Get token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users":{"get":{"tags":["users"],"summary":"Get Current","operationId":"getCurrentUser","responses":{"200":{"description":"Get current user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["users"],"summary":"Create User","description":"Create a user","operationId":"createUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{uid}":{"get":{"tags":["users"],"summary":"Show User","description":"Get a single user with given userID","operationId":"getSingleUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Get a single user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["users"],"summary":"Delete User","description":"Delete a user with given userID","operationId":"deleteUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Delete user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-password":{"put":{"tags":["users"],"summary":"Update Password","description":"Update password of a user with given userID","operationId":"updatePassword","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePasswordModel"}}},"required":true},"responses":{"200":{"description":"Update password of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-name":{"put":{"tags":["users"],"summary":"Update User Name","description":"Update first and last names of a user with given userID","operationId":"updateName","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserNameModel"}}},"required":true},"responses":{"200":{"description":"Update first and last names of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-semester":{"put":{"tags":["users"],"summary":"Update Current Semester","description":"Update current semester ID of a user with given userID","operationId":"updateCurrentSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-university":{"put":{"tags":["users"],"summary":"Update Current University","description":"Update current university ID of a user with given userID","operationId":"updateCurrentUniversity","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__user_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update current university ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/entrance-year":{"put":{"tags":["users"],"summary":"Update Entrance Year","description":"Update entrance year of a user with given userID","operationId":"updateEntranceYear","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEntranceYearModel"}}},"required":true},"responses":{"200":{"description":"Update entrance year of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-gpa":{"put":{"tags":["users"],"summary":"Update Current Gpa","description":"Update entrance year of a user with given userID","operationId":"updateCurrentGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentGPAModel"}}},"required":true},"responses":{"200":{"description":"Update current gpa of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/admin/update-user-group/{uid}":{"put":{"tags":["users"],"summary":"Update User Group","description":"Update group of a user with given userID","operationId":"updateUserGroup","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserGroupModel"}}},"required":true},"responses":{"200":{"description":"Update group of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/professors":{"post":{"tags":["users"],"summary":"Create Professor User","description":"Create a professor user","operationId":"createProfessorUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new professor user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters":{"get":{"tags":["semesters"],"summary":"List Semesters","description":"list all semesters of a user with given userID","operationId":"listSemestersOfUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"List all semesters","content":{"application/json":{"schema":{"title":"Response List Semesters Users Uid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/SemesterAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["semesters"],"summary":"Create Semester","description":"Create a semester for a user with given userID","operationId":"createSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}":{"get":{"tags":["semesters"],"summary":"Show Semester","description":"Get a single semester with given userID and semesterID","operationId":"getSingleSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Get a single semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemesterAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["semesters"],"summary":"Update Semester","description":"Update a semester with given userID and semesterID","operationId":"updateSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["semesters"],"summary":"Delete Semester","description":"Delete a semester with given userID and semesterID","operationId":"deleteSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Delete semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/semester-gpa":{"put":{"tags":["semesters"],"summary":"Update Semester Gpa","description":"Update gpa of a semester with given userID and semesterID","operationId":"updateSemesterGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterGPAModel"}}},"required":true},"responses":{"200":{"description":"Update gpa of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons":{"get":{"tags":["lessons"],"summary":"List Lessons","description":"List all lessons of a semester with given userID, semesterID","operationId":"listLessonsOfSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"List all lessons of a semester","content":{"application/json":{"schema":{"title":"Response List Lessons Users Uid Semesters Sid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/LessonAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["lessons"],"summary":"Create Lesson","description":"Create a lessons for a semester with given userID, semesterID","operationId":"createLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonModel"}}},"required":true},"responses":{"200":{"description":"Add new lesson into a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}":{"get":{"tags":["lessons"],"summary":"Show Lesson","description":"Get a single lesson with given userID, semesterID and lessonID","operationId":"getSingleLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Get a single lesson of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["lessons"],"summary":"Update Lesson","description":"Update a lesson with given userID, semesterID and lessonID","operationId":"updateLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["lessons"],"summary":"Delete Lesson","description":"Delete a lesson with given userID, semesterID and lessonID","operationId":"deleteLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Delete lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots":{"post":{"tags":["slots"],"summary":"Create Slot","description":"Create a slot for a lesson","operationId":"createSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotModel"}}},"required":true},"responses":{"200":{"description":"Add new slot into a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots/{slid}":{"put":{"tags":["slots"],"summary":"Update Slot","description":"Update a slot of a lesson","operationId":"updateSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotModel"}}},"required":true},"responses":{"200":{"description":"Update a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Slot","description":"Delete a slot of a lesson","operationId":"deleteSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"responses":{"200":{"description":"Delete a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/absences/{slid}":{"post":{"tags":["slots"],"summary":"Create Absence","description":"Create an absence for a slot","operationId":"createAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Add absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Absence","description":"Delete an absence from a slot","operationId":"deleteAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Delete absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities":{"get":{"tags":["universities"],"summary":"List Universities","description":"list all universities","operationId":"listUniversities","responses":{"200":{"description":"List all universities","content":{"application/json":{"schema":{"title":"Response List Universities Universities Get","type":"array","items":{"$ref":"#/components/schemas/UniversityAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}}},"post":{"tags":["universities"],"summary":"Create University","description":"Create a university","operationId":"createUniversity","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityModel"}}},"required":true},"responses":{"200":{"description":"Add new university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}":{"get":{"tags":["universities"],"summary":"Show University","description":"Get a single university with given universityID","operationId":"getSingleUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get a single university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University","description":"Update name of a university with given universityID","operationId":"updateUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__uni_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["universities"],"summary":"Delete University","description":"Delete a university with given universityID","operationId":"deleteUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Delete university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/current-semester":{"get":{"tags":["universities"],"summary":"Show University Current Semester","description":"Get current semester of a university with given universityID","operationId":"getCurrentUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University Current Semester","description":"Update current semester of a university with given universityID","operationId":"updateUniversityCurrentSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters":{"get":{"tags":["university semesters"],"summary":"List University Semesters","description":"list all semesters of a university with given universityID","operationId":"listUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university semeseters","content":{"application/json":{"schema":{"title":"Response List University Semesters Universities Unid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university semesters"],"summary":"Create University Semester","description":"Create semester for a university with given universityID","operationId":"createUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}":{"get":{"tags":["university semesters"],"summary":"Show University Semester","description":"Get a single semester of a university with given universityID and universitySemesterID","operationId":"getSingleUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List a university semeseters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university semesters"],"summary":"Update University Semester","description":"Update university of a semester with given universityID and universitySemesterID","operationId":"updateUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university semesters"],"summary":"Delete University Semester","description":"Delete a university semester with given universityID and universitySemesterID","operationId":"deleteUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"Delete university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons":{"get":{"tags":["university lessons"],"summary":"List University Lessons","description":"list all lessons for a semesters of a university with given universityID and universitySemesterID","operationId":"listUniversitySemesterLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List all lessons of a university semester","content":{"application/json":{"schema":{"title":"Response List University Lessons Universities Unid Semesters Unisid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university lessons"],"summary":"Create University Lesson","description":"Create a lesson for a semester of a university with given universityID and universitySemesterID","operationId":"createUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/current-semester/lessons/find-code":{"get":{"tags":["university lessons"],"summary":"Show Lesson With Code","description":"Get a single lesson of a university semester with given universityID and Lesson Code","operationId":"getSingleLessonWithCode","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Code","type":"string"},"name":"code","in":"query"}],"responses":{"200":{"description":"Get a single lessons with code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}":{"get":{"tags":["university lessons"],"summary":"Show University Lesson","description":"Get a single lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"getSingleUniversitySemesterLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Get a single lessons of a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university lessons"],"summary":"Update University Lesson","description":"Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"updateUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university lessons"],"summary":"Delete University Lesson","description":"Delete a university lesson with given universityID, universitySemesterID and universityLessonID","operationId":"deleteUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Delete university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections":{"post":{"tags":["university sections"],"summary":"Create Lesson Section","description":"Create a university section","operationId":"addLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Add a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections/{secid}":{"put":{"tags":["university sections"],"summary":"Update Lesson Section","description":"Update section of a lesson with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"updateLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university sections"],"summary":"Delete Lesson Section","description":"Delete a lesson section with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"deleteLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"responses":{"200":{"description":"Delete a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments":{"get":{"tags":["departments"],"summary":"List University Departments","description":"list all departments of a university with given universityID","operationId":"listUniversityDepartments","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university departments","content":{"application/json":{"schema":{"title":"Response List University Departments Universities Unid Departments Get","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["departments"],"summary":"Create University Department","description":"Create department for a university with given universityID","operationId":"createUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Add new university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}":{"get":{"tags":["departments"],"summary":"Show University Department","description":"Get a single semester of a university with given universityID and universityDepartmentID","operationId":"getSingleUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Show a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["departments"],"summary":"Update University Department","description":"Update department of a university with given universityID and universityDepartmentID","operationId":"updateUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Update a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["departments"],"summary":"Delete University Department","description":"Delete a university department with given universityID and universitySemesterID","operationId":"deleteUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Delete university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums":{"get":{"tags":["curriculums"],"summary":"List Department Curriculums","description":"list all curriculums of a department of a university with given universityID and universityDepartmentID","operationId":"listUniversityDepartmentCurriculums","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"List all university curriculums","content":{"application/json":{"schema":{"title":"Response List Department Curriculums Universities Unid Departments Depid Curriculums Get","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculums"],"summary":"Create Department Curriculum","description":"Create department for a university with given universityID and universityDepartmentID","operationId":"createUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Add new university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}":{"get":{"tags":["curriculums"],"summary":"Show Department Curriculum","description":"Get a single semester of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"getSingleUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Show a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculums"],"summary":"Update Department Curriculum","description":"Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"updateUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Update a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculums"],"summary":"Delete Department Curriculum","description":"Delete a university department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"deleteUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Delete university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters":{"get":{"tags":["curriculum semesters"],"summary":"List Curriculum Semesters","description":"list all semesters of a curriculum of a department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"listCurriculumSemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"List all curriculum semesters","content":{"application/json":{"schema":{"title":"Response List Curriculum Semesters Universities Unid Departments Depid Curriculums Curid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum semesters"],"summary":"Create Curriculum Semester","description":"Create semester for a curriculum with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"createCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}":{"get":{"tags":["curriculum semesters"],"summary":"Show Curriculum Semester","description":"Get a single semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"getSingleCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Show a university curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum semesters"],"summary":"Update Curriculum Semester","description":"Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"updateCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum semesters"],"summary":"Delete Curriculum Semester","description":"Delete a university department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"deleteCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Delete curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons":{"get":{"tags":["curriculum lessons"],"summary":"List Curriculum Lessons","description":"list all lessons of a curriculum semester of a department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"listCurriculumLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"List all curriculum lessons","content":{"application/json":{"schema":{"title":"Response List Curriculum Lessons Universities Unid Departments Depid Curriculums Curid Semesters Cursid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum lessons"],"summary":"Create Curriculum Lesson","description":"Create lesson for a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"createCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons/{curlid}":{"get":{"tags":["curriculum lessons"],"summary":"Show Curriculum Lesson","description":"Get a single lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"getSingleCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Show a curriculum semester lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum lessons"],"summary":"Update Curriculum Lesson","description":"Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"updateCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum lessons"],"summary":"Delete Curriculum Lesson","description":"Delete a lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"deleteCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Delete curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/schedule":{"post":{"tags":["scheduler"],"summary":"Create Schedule","description":"Create schedules for given lessons","operationId":"createSchedule","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"title":"Lesson Codes","type":"array","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"Create schedules for given lessons","content":{"application/json":{"schema":{"title":"Response Create Schedule Universities Unid Schedule Post","type":"array","items":{"type":"object","additionalProperties":{"type":"integer"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AbsenceModel":{"title":"AbsenceModel","required":["week"],"type":"object","properties":{"week":{"title":"Week","minimum":1.0,"type":"integer"}},"example":{"week":1}},"Body_login_for_access_token_token_post":{"title":"Body_login_for_access_token_token_post","required":["username","password"],"type":"object","properties":{"grant_type":{"title":"Grant Type","pattern":"password","type":"string"},"username":{"title":"Username","type":"string"},"password":{"title":"Password","type":"string"},"scope":{"title":"Scope","type":"string","default":""},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}}},"CurriculumLessonModel":{"title":"CurriculumLessonModel","required":["name","code","lesson_type"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":100,"minLength":1,"type":"string"},"lesson_type":{"title":"Lesson Type","maxLength":30,"minLength":1,"type":"string"}},"example":{"name":"PHYSICS I","code":"PHYS101","lesson_type":"science"}},"CurriculumSemesterModel":{"title":"CurriculumSemesterModel","required":["number"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","exclusiveMaximum":20.0,"exclusiveMinimum":0.0,"type":"integer"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"},"default":[]}},"example":{"number":1}},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"LessonAPIModel":{"title":"LessonAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"instructor":{"title":"Instructor","type":"string"},"ects":{"title":"Ects","type":"integer"},"grade":{"title":"Grade","type":"number"},"absence_limit":{"title":"Absence Limit","type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotAPIModel"}}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1]},{"room":"F0D01","day":2,"hour":8,"is_lab":0,"absences":[2]}]}},"LessonModel":{"title":"LessonModel","required":["name","code","instructor","ects","grade","absence_limit","slots"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"code":{"title":"Code","minLength":1,"type":"string"},"instructor":{"title":"Instructor","minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotModel"}}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"Message":{"title":"Message","required":["message"],"type":"object","properties":{"message":{"title":"Message","type":"string"}}},"MessageCreate":{"title":"MessageCreate","required":["_id","message"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"message":{"title":"Message","type":"string"}},"example":{"_id":"61ddea901311ecaed99afb7c","message":"string"}},"SemesterAPIModel":{"title":"SemesterAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"title":"Start Hour","type":"array","items":{"type":"integer"}},"duration_lesson":{"title":"Duration Lesson","type":"integer"},"duration_break":{"title":"Duration Break","type":"integer"},"slot_count":{"title":"Slot Count","type":"integer"},"semester_gpa":{"title":"Semester Gpa","type":"number"}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":[8,20],"duration_lesson":50,"duration_break":10,"slot_count":12,"semester_gpa":3.67}},"SlotAPIModel":{"title":"SlotAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","type":"string"},"day":{"title":"Day","type":"integer"},"hour":{"title":"Hour","type":"integer"},"is_lab":{"title":"Is Lab","type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"}}},"example":{"_id":"61ddea901311ecaed99afb7c","room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1,2]}},"SlotModel":{"title":"SlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","maxLength":127,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"},"default":[]}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"StartHourModel":{"title":"StartHourModel","required":["hour","minute"],"type":"object","properties":{"hour":{"title":"Hour","maximum":23.0,"minimum":0.0,"type":"integer"},"minute":{"title":"Minute","maximum":59.0,"minimum":0.0,"type":"integer"}}},"Token":{"title":"Token","required":["access_token","token_type"],"type":"object","properties":{"access_token":{"title":"Access Token","type":"string"},"token_type":{"title":"Token Type","type":"string"}}},"UniversityAPIModel":{"title":"UniversityAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"website":{"title":"Website","type":"string"},"country":{"title":"Country","type":"string"},"city":{"title":"City","type":"string"},"address":{"title":"Address","type":"string"},"phone":{"title":"Phone","type":"string"},"email":{"title":"Email","type":"string"},"zip_code":{"title":"Zip Code","type":"string"},"description":{"title":"Description","type":"string"},"logo":{"title":"Logo","type":"string"},"cover_photo":{"title":"Cover Photo","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png","current_semester_id":"61fc266ae3d749b1d65c17c7"}},"UniversityCurriculumModel":{"title":"UniversityCurriculumModel","required":["name","start_year","end_year"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"start_year":{"title":"Start Year","type":"integer"},"end_year":{"title":"End Year","type":"integer"},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"},"default":[]}},"example":{"name":"2016 Later","start_year":2016,"end_year":2100}},"UniversityDepartmentModel":{"title":"UniversityDepartmentModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"curriculums":{"title":"Curriculums","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"},"default":[]}},"example":{"name":"COMP"}},"UniversityLessonAPIModel":{"title":"UniversityLessonAPIModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":0,"sections":[{"_id":"61ddea901311ecaed99afb7c","number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}]}},"UniversityLessonModel":{"title":"UniversityLessonModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":20,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":8}},"UniversityModel":{"title":"UniversityModel","required":["name","website","country","city","address","phone","email","zip_code","description","logo","cover_photo"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"},"departments":{"title":"Departments","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"},"default":[]},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterModel"},"default":[]}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"UniversitySectionAPIModel":{"title":"UniversitySectionAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","type":"integer"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySectionModel":{"title":"UniversitySectionModel","required":["number","instructor"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","minimum":0.0,"type":"integer"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"},"default":[]}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySemesterAPIModel":{"title":"UniversitySemesterAPIModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"20-21 Spring"}},"UniversitySemesterModel":{"title":"UniversitySemesterModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"},"default":[]}},"example":{"name":"20-21 Spring"}},"UniversitySlotModel":{"title":"UniversitySlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"room":{"title":"Room","maxLength":100,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"UpdateCurrentGPAModel":{"title":"UpdateCurrentGPAModel","required":["current_gpa"],"type":"object","properties":{"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"current_gpa":3.67}},"UpdateCurrentSemesterModel":{"title":"UpdateCurrentSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateEntranceYearModel":{"title":"UpdateEntranceYearModel","required":["entrance_year"],"type":"object","properties":{"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer"}},"example":{"entrance_year":2018}},"UpdateLessonModel":{"title":"UpdateLessonModel","required":["name","code","instructor","ects","grade","absence_limit"],"type":"object","properties":{"name":{"title":"Name","minLength":1,"type":"string"},"code":{"title":"Code","minLength":1,"type":"string"},"instructor":{"title":"Instructor","minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21}},"UpdatePasswordModel":{"title":"UpdatePasswordModel","required":["password"],"type":"object","properties":{"password":{"title":"Password","type":"string"}},"example":{"password":"123456"}},"UpdateSemesterGPAModel":{"title":"UpdateSemesterGPAModel","required":["semester_gpa"],"type":"object","properties":{"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"semester_gpa":3.67}},"UpdateSemesterModel":{"title":"UpdateSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateUserGroupModel":{"title":"UpdateUserGroupModel","required":["user_group"],"type":"object","properties":{"user_group":{"title":"User Group","type":"string"}},"example":{"user_group":"professor"}},"UpdateUserNameModel":{"title":"UpdateUserNameModel","required":["first_name","last_name"],"type":"object","properties":{"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"}},"example":{"first_name":"John","last_name":"Doe"}},"UpdateUserSemesterModel":{"title":"UpdateUserSemesterModel","required":["name","start_date","end_date","start_hour","duration_lesson","duration_break","slot_count","semester_gpa"],"type":"object","properties":{"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"UserAPIModel":{"title":"UserAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"first_name":{"title":"First Name","type":"string"},"last_name":{"title":"Last Name","type":"string"},"current_gpa":{"title":"Current Gpa","type":"number"},"user_group":{"title":"User Group","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"},"current_university_id":{"title":"Current University Id","type":"string"},"entrance_year":{"title":"Entrance Year","type":"integer"}},"example":{"_id":"61ddea901311ecaed99afb7c","email":"hello@agu.edu.tr","first_name":"John","last_name":"Doe","current_gpa":3.67,"user_group":"default","current_semester_id":"61ddea901311ecaed99afb7d","current_university_id":"61ddea901311ecaed99afb7e","entrance_year":2018}},"UserModel":{"title":"UserModel","required":["email","password","first_name","last_name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"password":{"title":"Password","type":"string"},"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"},"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0},"current_semester_id":{"title":"Current Semester Id","type":"string","default":"null"},"current_university_id":{"title":"Current University Id","type":"string","default":"null"},"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer","default":2010},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UserSemesterModel"},"default":[]}},"example":{"email":"hello@agu.edu.tr","password":"123456","first_name":"John","last_name":"Doe"}},"UserSemesterModel":{"title":"UserSemesterModel","required":["name","start_date","end_date","start_hour","duration_lesson","duration_break","slot_count"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0.0},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/LessonModel"},"default":[]}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}},"app__models__uni_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["name","website","country","city","address","phone","email","zip_code","description","logo","cover_photo"],"type":"object","properties":{"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"app__models__user_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["current_university_id"],"type":"object","properties":{"current_university_id":{"title":"Current University Id","type":"string"}},"example":{"current_university_id":"61ddea901311ecaed99afb7g"}}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} \ No newline at end of file From 0e20779cb5934657988f4430ac794fbefb02f6af Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 19 Mar 2022 17:17:21 +0300 Subject: [PATCH 20/21] let fields in update models optional in update model, fields are optional anymore. thus, it is not required to give old values to update a model --- backend/app/models/uni_models.py | 89 ++++++++++++++++--- backend/app/models/user_models.py | 52 ++++++----- .../uni_cur_lesson_routers.py | 29 +++--- .../uni_curriculum_routers.py | 32 +++---- .../uni_department_routers.py | 4 +- .../university_routers/uni_lesson_routers.py | 24 +++-- .../routers/university_routers/uni_routers.py | 22 ++--- .../university_routers/uni_section_routers.py | 33 ++++--- .../uni_semester_routers.py | 28 +++--- .../routers/user_routers/lesson_routers.py | 20 ++--- .../routers/user_routers/semester_routers.py | 24 ++--- .../app/routers/user_routers/slot_routers.py | 19 ++-- .../tests/user_tests/test_lesson_routers.py | 20 ++--- .../app/tests/user_tests/test_slot_routers.py | 18 ++-- 14 files changed, 226 insertions(+), 188 deletions(-) diff --git a/backend/app/models/uni_models.py b/backend/app/models/uni_models.py index bd8a018..4095307 100644 --- a/backend/app/models/uni_models.py +++ b/backend/app/models/uni_models.py @@ -41,6 +41,24 @@ class Config: } +class UpdateUniversitySectionModel(BaseModel): + number: Optional[int] = Field(ge=0) + instructor: Optional[str] = Field(min_length=1, max_length=127) + slots: List[UniversitySlotModel] = None + + class Config: + schema_extra = { + "example": { + "number": 1, + "instructor": "Jack Joe", + "slots": [ + {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}, + {"room": "F0D01", "day": 2, "hour": 8, "is_lab": 0}, + ], + } + } + + class UniversitySectionAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") number: Optional[int] @@ -83,6 +101,23 @@ class Config: } +class UpdateUniversityLessonModel(BaseModel): + name: Optional[str] = Field(min_length=1, max_length=127) + code: Optional[str] = Field(min_length=1, max_length=20) + ects: Optional[float] = Field(ge=0) + absence_limit: Optional[int] = Field(ge=0) + + class Config: + schema_extra = { + "example": { + "name": "ART OF COMPUTING", + "code": "COMP101", + "ects": 6, + "absence_limit": 8, + } + } + + class UniversityLessonAPIModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(...) @@ -161,6 +196,21 @@ class Config: } +class UpdateCurriculumLessonModel(BaseModel): + name: Optional[str] = Field(min_length=1, max_length=100) + code: Optional[str] = Field(min_length=1, max_length=100) + lesson_type: Optional[str] = Field(min_length=1, max_length=30) + + class Config: + schema_extra = { + "example": { + "name": "PHYSICS I", + "code": "PHYS101", + "lesson_type": "science", + } + } + + class CurriculumSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") number: int = Field(..., gt=0, lt=20) @@ -176,8 +226,8 @@ class Config: class UniversityCurriculumModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=1) - start_year: int = Field(...) - end_year: int = Field(...) + start_year: int = Field(ge=2000, lt=2100) + end_year: int = Field(ge=2000, lt=2100) semesters: List[CurriculumSemesterModel] = [] class Config: @@ -189,6 +239,17 @@ class Config: } +class UpdateUniversityCurriculumModel(BaseModel): + name: Optional[str] = Field(min_length=1) + start_year: Optional[int] = Field(ge=2000, lt=2100) + end_year: Optional[int] = Field(ge=2000, lt=2100) + + class Config: + schema_extra = { + "example": {"name": "2016 Later", "start_year": 2016, "end_year": 2100} + } + + class UniversityDepartmentModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") name: str = Field(..., min_length=2, max_length=100) @@ -198,7 +259,7 @@ class Config: allow_population_by_field_name = True arbitrary_types_allowed = True json_encoders = {ObjectId: str} - schema_extra = {"example": {"name": "COMP",}} + schema_extra = {"example": {"name": "COMP"}} class UniversityModel(BaseModel): @@ -275,17 +336,17 @@ class Config: class UpdateUniversityModel(BaseModel): - name: str = Field(..., min_length=2, max_length=100) - website: str = Field(..., min_length=5, max_length=255) - country: str = Field(..., min_length=2, max_length=100) - city: str = Field(..., min_length=2, max_length=100) - address: str = Field(..., min_length=2, max_length=100) - phone: str = Field(..., min_length=2, max_length=100) - email: str = Field(..., min_length=2, max_length=100) - zip_code: str = Field(..., min_length=2, max_length=100) - description: str = Field(..., max_length=255) - logo: str = Field(..., max_length=255) - cover_photo: str = Field(..., max_length=255) + name: Optional[str] = Field(min_length=2, max_length=100) + website: Optional[str] = Field(min_length=5, max_length=255) + country: Optional[str] = Field(min_length=2, max_length=100) + city: Optional[str] = Field(min_length=2, max_length=100) + address: Optional[str] = Field(min_length=2, max_length=100) + phone: Optional[str] = Field(min_length=2, max_length=100) + email: Optional[str] = Field(min_length=2, max_length=100) + zip_code: Optional[str] = Field(min_length=2, max_length=100) + description: Optional[str] = Field(max_length=255) + logo: Optional[str] = Field(max_length=255) + cover_photo: Optional[str] = Field(max_length=255) class Config: schema_extra = { diff --git a/backend/app/models/user_models.py b/backend/app/models/user_models.py index 9dff7c4..85dad66 100644 --- a/backend/app/models/user_models.py +++ b/backend/app/models/user_models.py @@ -29,6 +29,16 @@ class Config: schema_extra = {"example": {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}} +class UpdateSlotModel(BaseModel): + room: Optional[str] = Field(max_length=127) + day: Optional[int] = Field(ge=0, le=4) # TODO: check the value '4' later + hour: Optional[int] = Field(ge=0, le=15) + is_lab: Optional[int] = Field(ge=0, le=1) + + class Config: + schema_extra = {"example": {"room": "F0D01", "day": 2, "hour": 7, "is_lab": 0}} + + class SlotAPIModel(BaseModel): id: Optional[str] = Field(alias="_id") room: Optional[str] @@ -53,13 +63,13 @@ class Config: class LessonModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(..., min_length=1) - code: str = Field(..., min_length=1) - instructor: str = Field(..., min_length=1) + name: str = Field(..., min_length=1, max_length=127) + code: str = Field(..., min_length=1, max_length=127) + instructor: str = Field(..., min_length=1, max_length=127) ects: int = Field(..., ge=0) - grade: float = Field(ge=0, le=10) - absence_limit: int = Field(..., ge=0) - slots: List[SlotModel] = Field() + grade: Optional[float] = Field(ge=0, le=10) + absence_limit: Optional[int] = Field(ge=0) + slots: List[SlotModel] = [] class Config: allow_population_by_field_name = True @@ -123,12 +133,12 @@ class Config: class UpdateLessonModel(BaseModel): - name: str = Field(..., min_length=1) - code: str = Field(..., min_length=1) - instructor: str = Field(..., min_length=1) - ects: int = Field(..., ge=0) - grade: float = Field(ge=0, le=10) - absence_limit: int = Field(..., ge=0) + name: Optional[str] = Field(min_length=1, max_length=127) + code: Optional[str] = Field(min_length=1, max_length=127) + instructor: Optional[str] = Field(min_length=1, max_length=127) + ects: Optional[int] = Field(ge=0) + grade: Optional[float] = Field(ge=0, le=10) + absence_limit: Optional[int] = Field(ge=0) class Config: schema_extra = { @@ -160,7 +170,7 @@ class Config: class UserSemesterModel(BaseModel): id: PyObjectId = Field(default_factory=PyObjectId, alias="_id") - name: str = Field(...) + name: str = Field(..., min_length=1, max_length=127) start_date: datetime = Field(...) end_date: datetime = Field(...) start_hour: StartHourModel = Field(...) @@ -191,14 +201,14 @@ class Config: class UpdateUserSemesterModel(BaseModel): - name: str = Field(...) - start_date: datetime = Field(...) - end_date: datetime = Field(...) - start_hour: StartHourModel = Field(...) - duration_lesson: int = Field(..., gt=0) - duration_break: int = Field(..., gt=0) - slot_count: int = Field(..., gt=3, lt=16) - semester_gpa: float = Field(..., ge=0, le=10) + name: Optional[str] = Field(min_length=1, max_length=127) + start_date: Optional[datetime] + end_date: Optional[datetime] + start_hour: Optional[StartHourModel] + duration_lesson: Optional[int] = Field(gt=0) + duration_break: Optional[int] = Field(gt=0) + slot_count: Optional[int] = Field(gt=3, lt=16) + semester_gpa: Optional[float] = Field(ge=0, le=10) class Config: arbitrary_types_allowed = True diff --git a/backend/app/routers/university_routers/uni_cur_lesson_routers.py b/backend/app/routers/university_routers/uni_cur_lesson_routers.py index eeab577..0f4d599 100644 --- a/backend/app/routers/university_routers/uni_cur_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_cur_lesson_routers.py @@ -5,7 +5,7 @@ from fastapi.responses import JSONResponse from ...dependencies import get_current_user -from ...models.uni_models import CurriculumLessonModel +from ...models.uni_models import CurriculumLessonModel, UpdateCurriculumLessonModel from ...models.user_models import Message, MessageCreate, UserModel router = APIRouter() @@ -190,7 +190,7 @@ async def update_curriculum_lesson( cursid: str, curlid: str, request: Request, - curriculum_lesson: CurriculumLessonModel = Body(...), + curriculum_lesson: UpdateCurriculumLessonModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID""" @@ -263,6 +263,17 @@ async def update_curriculum_lesson( }, ) + updated_features = {} + for key in curriculum_lesson: + if curriculum_lesson[key] is not None: + updated_features.update( + { + f"departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].{key}": curriculum_lesson[ + key + ] + } + ) + update_result = await request.app.mongodb["universities"].update_many( { "_id": unid, @@ -271,19 +282,7 @@ async def update_curriculum_lesson( "departments.curriculums.semesters._id": cursid, "departments.curriculums.semesters.lessons._id": curlid, }, - { - "$set": { - "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].name": curriculum_lesson[ - "name" - ], - "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].code": curriculum_lesson[ - "code" - ], - "departments.$[i].curriculums.$[j].semesters.$[k].lessons.$[l].lesson_type": curriculum_lesson[ - "lesson_type" - ], - } - }, + {"$set": updated_features}, array_filters=[ {"i._id": depid}, {"j._id": curid}, diff --git a/backend/app/routers/university_routers/uni_curriculum_routers.py b/backend/app/routers/university_routers/uni_curriculum_routers.py index 0892d25..694db32 100644 --- a/backend/app/routers/university_routers/uni_curriculum_routers.py +++ b/backend/app/routers/university_routers/uni_curriculum_routers.py @@ -5,7 +5,10 @@ from fastapi.responses import JSONResponse from ...dependencies import get_current_user -from ...models.uni_models import UniversityCurriculumModel +from ...models.uni_models import ( + UniversityCurriculumModel, + UpdateUniversityCurriculumModel, +) from ...models.user_models import Message, MessageCreate, UserModel router = APIRouter() @@ -147,7 +150,7 @@ async def update_department_curriculum( depid: str, curid: str, request: Request, - department_curriculum: UniversityCurriculumModel = Body(...), + department_curriculum: UpdateUniversityCurriculumModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID""" @@ -184,25 +187,24 @@ async def update_department_curriculum( }, ) + updated_features = {} + for key in department_curriculum: + if department_curriculum[key] is not None: + updated_features.update( + { + f"departments.$[i].curriculums.$[j].{key}": department_curriculum[ + key + ] + } + ) + update_result = await request.app.mongodb["universities"].update_many( { "_id": unid, "departments._id": depid, "departments.curriculums._id": curid, }, - { - "$set": { - "departments.$[i].curriculums.$[j].name": department_curriculum[ - "name" - ], - "departments.$[i].curriculums.$[j].start_year": department_curriculum[ - "start_year" - ], - "departments.$[i].curriculums.$[j].end_year": department_curriculum[ - "end_year" - ], - } - }, + {"$set": updated_features}, array_filters=[{"i._id": depid}, {"j._id": curid}], ) diff --git a/backend/app/routers/university_routers/uni_department_routers.py b/backend/app/routers/university_routers/uni_department_routers.py index 39d3638..789dc68 100644 --- a/backend/app/routers/university_routers/uni_department_routers.py +++ b/backend/app/routers/university_routers/uni_department_routers.py @@ -141,9 +141,7 @@ async def update_university_department( """Update department of a university with given universityID and universityDepartmentID""" if auth_user["user_group"] == "professor": - university_department = { - k: v for k, v in university_department.dict().items() if v is not None - } + university_department = jsonable_encoder(university_department) if ( existing_university := await request.app.mongodb["universities"].find_one( diff --git a/backend/app/routers/university_routers/uni_lesson_routers.py b/backend/app/routers/university_routers/uni_lesson_routers.py index 0124fbb..bf1c03a 100644 --- a/backend/app/routers/university_routers/uni_lesson_routers.py +++ b/backend/app/routers/university_routers/uni_lesson_routers.py @@ -9,6 +9,7 @@ from ...models.uni_models import ( UniversityLessonAPIModel, UniversityLessonModel, + UpdateUniversityLessonModel, ) from ...models.user_models import Message, MessageCreate, UserModel @@ -196,14 +197,13 @@ async def update_university_lesson( unisid: str, unilid: str, request: Request, - university_lesson: UniversityLessonModel = Body(...), + university_lesson: UpdateUniversityLessonModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID""" if auth_user["user_group"] == "professor": - university_lesson = university_lesson.json(by_alias=True, models_as_dict=False) - university_lesson = json.loads(university_lesson.replace("\\", "")) + university_lesson = jsonable_encoder(university_lesson) if ( ( @@ -250,18 +250,16 @@ async def update_university_lesson( }, ) + updated_features = {} + for key in university_lesson: + if university_lesson[key] is not None: + updated_features.update( + {f"semesters.$[i].lessons.$[j].{key}": university_lesson[key]} + ) + update_result = await request.app.mongodb["universities"].update_one( {"_id": unid, "semesters._id": unisid, "semesters.lessons._id": unilid,}, - { - "$set": { - "semesters.$[i].lessons.$[j].name": university_lesson["name"], - "semesters.$[i].lessons.$[j].code": university_lesson["code"], - "semesters.$[i].lessons.$[j].ects": university_lesson["ects"], - "semesters.$[i].lessons.$[j].absence_limit": university_lesson[ - "absence_limit" - ], - } - }, + {"$set": updated_features}, array_filters=[{"i._id": unisid}, {"j._id": unilid}], ) diff --git a/backend/app/routers/university_routers/uni_routers.py b/backend/app/routers/university_routers/uni_routers.py index 511dd39..759bde3 100644 --- a/backend/app/routers/university_routers/uni_routers.py +++ b/backend/app/routers/university_routers/uni_routers.py @@ -154,23 +154,13 @@ async def update_university( content={"message": "Given university name already exists"}, ) + updated_features = {} + for key in university: + if university[key] is not None: + updated_features.update({key: university[key]}) + update_result = await request.app.mongodb["universities"].update_one( - {"_id": unid}, - { - "$set": { - "name": university["name"], - "website": university["website"], - "country": university["country"], - "city": university["city"], - "address": university["address"], - "phone": university["phone"], - "email": university["email"], - "zip_code": university["zip_code"], - "description": university["description"], - "logo": university["logo"], - "cover_photo": university["cover_photo"], - } - }, + {"_id": unid}, {"$set": updated_features} ) if update_result.modified_count == 1: diff --git a/backend/app/routers/university_routers/uni_section_routers.py b/backend/app/routers/university_routers/uni_section_routers.py index f835096..362daba 100644 --- a/backend/app/routers/university_routers/uni_section_routers.py +++ b/backend/app/routers/university_routers/uni_section_routers.py @@ -5,7 +5,7 @@ from fastapi.responses import JSONResponse from ...dependencies import get_current_user -from ...models.uni_models import UniversitySectionModel +from ...models.uni_models import UniversitySectionModel, UpdateUniversitySectionModel from ...models.user_models import Message, MessageCreate, UserModel router = APIRouter() @@ -136,15 +136,13 @@ async def update_lesson_section( unilid: str, secid: str, request: Request, - new_section: UniversitySectionModel = Body(...), + new_section: UpdateUniversitySectionModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update section of a lesson with given universityID, universitySemesterID, universityLessonID and sectionID""" - new_section = new_section.json(by_alias=True, models_as_dict=False) - new_section = json.loads(new_section.replace("\\", "")) - if auth_user["user_group"] == "professor": + new_section = jsonable_encoder(new_section) if ( await ( @@ -209,6 +207,17 @@ async def update_lesson_section( }, ) + updated_features = {} + for key in new_section: + if new_section[key] is not None: + updated_features.update( + { + f"semesters.$[i].lessons.$[j].sections.$[k].{key}": new_section[ + key + ] + } + ) + update_result = await request.app.mongodb["universities"].update_many( { "_id": unid, @@ -216,19 +225,7 @@ async def update_lesson_section( "semesters.lessons._id": unilid, "semesters.lessons.sections._id": secid, }, - { - "$set": { - "semesters.$[i].lessons.$[j].sections.$[k].number": new_section[ - "number" - ], - "semesters.$[i].lessons.$[j].sections.$[k].instructor": new_section[ - "instructor" - ], - "semesters.$[i].lessons.$[j].sections.$[k].slots": new_section[ - "slots" - ], - } - }, + {"$set": updated_features}, array_filters=[{"i._id": unisid}, {"j._id": unilid}, {"k._id": secid}], ) diff --git a/backend/app/routers/university_routers/uni_semester_routers.py b/backend/app/routers/university_routers/uni_semester_routers.py index c6b957a..f86fa71 100644 --- a/backend/app/routers/university_routers/uni_semester_routers.py +++ b/backend/app/routers/university_routers/uni_semester_routers.py @@ -152,9 +152,7 @@ async def update_university_semester( """Update university of a semester with given universityID and universitySemesterID""" if auth_user["user_group"] == "professor": - university_semester = { - k: v for k, v in university_semester.dict().items() if v is not None - } + university_semester = jsonable_encoder(university_semester) if ( existing_university := await request.app.mongodb["universities"].find_one( @@ -173,26 +171,20 @@ async def update_university_semester( content={"message": "University semester already exists"}, ) - if len(university_semester) >= 1: - update_result = await request.app.mongodb["universities"].update_many( - {"_id": unid, "semesters._id": unisid}, - {"$set": {"semesters.$.name": university_semester["name"]}}, - ) - - if update_result.modified_count == 1: - return JSONResponse( - status_code=status.HTTP_200_OK, - content={"message": "University semester updated"}, - ) + update_result = await request.app.mongodb["universities"].update_many( + {"_id": unid, "semesters._id": unisid}, + {"$set": {"semesters.$.name": university_semester["name"]}}, + ) + if update_result.modified_count == 1: return JSONResponse( - status_code=status.HTTP_404_NOT_FOUND, - content={"message": "University semester not found"}, + status_code=status.HTTP_200_OK, + content={"message": "University semester updated"}, ) return JSONResponse( - status_code=status.HTTP_400_BAD_REQUEST, - content={"message": "Invalid input"}, + status_code=status.HTTP_404_NOT_FOUND, + content={"message": "University semester not found"}, ) return JSONResponse( diff --git a/backend/app/routers/user_routers/lesson_routers.py b/backend/app/routers/user_routers/lesson_routers.py index a5eb49a..2e79253 100644 --- a/backend/app/routers/user_routers/lesson_routers.py +++ b/backend/app/routers/user_routers/lesson_routers.py @@ -253,20 +253,16 @@ async def update_lesson( }, ) + updated_features = {} + for key in lesson: + if lesson[key] is not None: + updated_features.update( + {f"semesters.$[i].lessons.$[j].{key}": lesson[key]} + ) + update_result = await request.app.mongodb["users"].update_one( {"_id": uid, "semesters._id": sid, "semesters.lessons._id": lid,}, - { - "$set": { - "semesters.$[i].lessons.$[j].name": lesson["name"], - "semesters.$[i].lessons.$[j].code": lesson["code"], - "semesters.$[i].lessons.$[j].instructor": lesson["instructor"], - "semesters.$[i].lessons.$[j].ects": lesson["ects"], - "semesters.$[i].lessons.$[j].grade": lesson["grade"], - "semesters.$[i].lessons.$[j].absence_limit": lesson[ - "absence_limit" - ], - } - }, + {"$set": updated_features}, array_filters=[{"i._id": sid}, {"j._id": lid}], ) diff --git a/backend/app/routers/user_routers/semester_routers.py b/backend/app/routers/user_routers/semester_routers.py index e4cbc2e..ba5370e 100644 --- a/backend/app/routers/user_routers/semester_routers.py +++ b/backend/app/routers/user_routers/semester_routers.py @@ -165,23 +165,17 @@ async def update_semester( ): """Update a semester with given userID and semesterID""" - semester = semester.json(by_alias=True, models_as_dict=False) - semester = json.loads(semester.replace("\\", "")) - if auth_user["_id"] == uid: + semester = semester.json(by_alias=True, models_as_dict=False) + semester = json.loads(semester.replace("\\", "")) + + updated_features = {} + for key in semester: + if semester[key] is not None: + updated_features.update({f"semesters.$.{key}": semester[key]}) + update_result = await request.app.mongodb["users"].update_one( - {"_id": uid, "semesters._id": sid}, - { - "$set": { - "semesters.$.name": semester["name"], - "semesters.$.start_date": semester["start_date"], - "semesters.$.end_date": semester["end_date"], - "semesters.$.start_hour": semester["start_hour"], - "semesters.$.duration_lesson": semester["duration_lesson"], - "semesters.$.duration_break": semester["duration_break"], - "semesters.$.slot_count": semester["slot_count"], - } - }, + {"_id": uid, "semesters._id": sid}, {"$set": updated_features}, ) if update_result.modified_count == 1: diff --git a/backend/app/routers/user_routers/slot_routers.py b/backend/app/routers/user_routers/slot_routers.py index e7244dd..5721f95 100644 --- a/backend/app/routers/user_routers/slot_routers.py +++ b/backend/app/routers/user_routers/slot_routers.py @@ -8,6 +8,7 @@ Message, MessageCreate, SlotModel, + UpdateSlotModel, UserModel, ) @@ -109,7 +110,7 @@ async def update_slot( lid: str, slid: str, request: Request, - slot: SlotModel = Body(...), + slot: UpdateSlotModel = Body(...), auth_user: UserModel = Depends(get_current_user), ): """Update a slot of a lesson""" @@ -158,6 +159,13 @@ async def update_slot( content={"message": "Given slot already exists or slot not found"}, ) + updated_features = {} + for key in slot: + if slot[key] is not None: + updated_features.update( + {f"semesters.$[i].lessons.$[j].slots.$[k].{key}": slot[key]} + ) + update_result = await request.app.mongodb["users"].update_one( { "_id": uid, @@ -165,14 +173,7 @@ async def update_slot( "semesters.lessons._id": lid, "semesters.lessons.slots._id": slid, }, - { - "$set": { - "semesters.$[i].lessons.$[j].slots.$[k].room": slot["room"], - "semesters.$[i].lessons.$[j].slots.$[k].day": slot["day"], - "semesters.$[i].lessons.$[j].slots.$[k].hour": slot["hour"], - "semesters.$[i].lessons.$[j].slots.$[k].is_lab": slot["is_lab"], - } - }, + {"$set": updated_features}, array_filters=[{"i._id": sid}, {"j._id": lid}, {"k._id": slid},], ) diff --git a/backend/app/tests/user_tests/test_lesson_routers.py b/backend/app/tests/user_tests/test_lesson_routers.py index 74addc5..7e7403a 100644 --- a/backend/app/tests/user_tests/test_lesson_routers.py +++ b/backend/app/tests/user_tests/test_lesson_routers.py @@ -33,7 +33,7 @@ def test_create_lesson(): "instructor": "Test Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, @@ -59,7 +59,7 @@ def test_create_lesson_with_another_user_id(): "instructor": "Test Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, @@ -83,7 +83,7 @@ def test_create_lesson_with_invalid_semester_id(): "instructor": "Test Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, @@ -181,11 +181,7 @@ def test_update_lesson(): "instructor": "Updated Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", - "slots": [ - {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, - {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, - ], + "grade": 3.0, }, ) @@ -205,7 +201,7 @@ def test_update_lesson_with_another_user_id(): "instructor": "Updated Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, @@ -229,7 +225,7 @@ def test_update_lesson_with_invalid_semester_id(): "instructor": "Updated Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, @@ -253,7 +249,7 @@ def test_update_lesson_with_invalid_lesson_id(): "instructor": "Updated Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B201", "day": 2, "hour": 8, "is_lab": 0}, @@ -343,7 +339,7 @@ def test_create_second_lesson(): "instructor": "Test Instructor", "ects": 5, "absence_limit": 0, - "grade": "3.0", + "grade": 3.0, "slots": [ {"room": "B200", "day": 2, "hour": 7, "is_lab": 0}, {"room": "B200", "day": 2, "hour": 8, "is_lab": 0}, diff --git a/backend/app/tests/user_tests/test_slot_routers.py b/backend/app/tests/user_tests/test_slot_routers.py index dbdc4d7..b477cd9 100644 --- a/backend/app/tests/user_tests/test_slot_routers.py +++ b/backend/app/tests/user_tests/test_slot_routers.py @@ -108,18 +108,22 @@ def test_create_slot_with_invalid_is_lab(): ####### * UPDATE SLOT SECTION * ####### + def test_update_slot_without_room(): + response = client.put( + f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", + headers={"Authorization": f"Bearer {test_user.token}"}, + json={"day": 3, "hour": 7, "is_lab": 1,}, + ) + + assert response.status_code == 200 + def test_update_slot(): response = client.put( f"/users/{test_user.user_id}/semesters/{test_user.semester_id}" + f"/lessons/{test_user.lesson_id}/slots/{test_user.slot_id}", headers={"Authorization": f"Bearer {test_user.token}"}, - json={ - "room": "updated_room", - "day": 3, - "hour": 7, - "is_lab": 1, - "absences": [], - }, + json={"room": "updated_room", "day": 3, "hour": 7, "is_lab": 1,}, ) assert response.status_code == 200 From c451494ed605980818a5068eef438f4cd9e5c892 Mon Sep 17 00:00:00 2001 From: emrdagkusu Date: Sat, 19 Mar 2022 14:20:27 +0000 Subject: [PATCH 21/21] Generate openapi.json --- openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi.json b/openapi.json index 8f6895d..e2cb4bf 100644 --- a/openapi.json +++ b/openapi.json @@ -1 +1 @@ -{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/token":{"post":{"tags":["token"],"summary":"Login For Access Token","operationId":"login_for_access_token_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_for_access_token_token_post"}}},"required":true},"responses":{"200":{"description":"Get token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users":{"get":{"tags":["users"],"summary":"Get Current","operationId":"getCurrentUser","responses":{"200":{"description":"Get current user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["users"],"summary":"Create User","description":"Create a user","operationId":"createUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{uid}":{"get":{"tags":["users"],"summary":"Show User","description":"Get a single user with given userID","operationId":"getSingleUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Get a single user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["users"],"summary":"Delete User","description":"Delete a user with given userID","operationId":"deleteUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Delete user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-password":{"put":{"tags":["users"],"summary":"Update Password","description":"Update password of a user with given userID","operationId":"updatePassword","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePasswordModel"}}},"required":true},"responses":{"200":{"description":"Update password of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-name":{"put":{"tags":["users"],"summary":"Update User Name","description":"Update first and last names of a user with given userID","operationId":"updateName","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserNameModel"}}},"required":true},"responses":{"200":{"description":"Update first and last names of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-semester":{"put":{"tags":["users"],"summary":"Update Current Semester","description":"Update current semester ID of a user with given userID","operationId":"updateCurrentSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-university":{"put":{"tags":["users"],"summary":"Update Current University","description":"Update current university ID of a user with given userID","operationId":"updateCurrentUniversity","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__user_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update current university ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/entrance-year":{"put":{"tags":["users"],"summary":"Update Entrance Year","description":"Update entrance year of a user with given userID","operationId":"updateEntranceYear","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEntranceYearModel"}}},"required":true},"responses":{"200":{"description":"Update entrance year of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-gpa":{"put":{"tags":["users"],"summary":"Update Current Gpa","description":"Update entrance year of a user with given userID","operationId":"updateCurrentGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentGPAModel"}}},"required":true},"responses":{"200":{"description":"Update current gpa of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/admin/update-user-group/{uid}":{"put":{"tags":["users"],"summary":"Update User Group","description":"Update group of a user with given userID","operationId":"updateUserGroup","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserGroupModel"}}},"required":true},"responses":{"200":{"description":"Update group of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/professors":{"post":{"tags":["users"],"summary":"Create Professor User","description":"Create a professor user","operationId":"createProfessorUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new professor user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters":{"get":{"tags":["semesters"],"summary":"List Semesters","description":"list all semesters of a user with given userID","operationId":"listSemestersOfUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"List all semesters","content":{"application/json":{"schema":{"title":"Response List Semesters Users Uid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/SemesterAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["semesters"],"summary":"Create Semester","description":"Create a semester for a user with given userID","operationId":"createSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}":{"get":{"tags":["semesters"],"summary":"Show Semester","description":"Get a single semester with given userID and semesterID","operationId":"getSingleSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Get a single semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemesterAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["semesters"],"summary":"Update Semester","description":"Update a semester with given userID and semesterID","operationId":"updateSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["semesters"],"summary":"Delete Semester","description":"Delete a semester with given userID and semesterID","operationId":"deleteSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Delete semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/semester-gpa":{"put":{"tags":["semesters"],"summary":"Update Semester Gpa","description":"Update gpa of a semester with given userID and semesterID","operationId":"updateSemesterGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterGPAModel"}}},"required":true},"responses":{"200":{"description":"Update gpa of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons":{"get":{"tags":["lessons"],"summary":"List Lessons","description":"List all lessons of a semester with given userID, semesterID","operationId":"listLessonsOfSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"List all lessons of a semester","content":{"application/json":{"schema":{"title":"Response List Lessons Users Uid Semesters Sid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/LessonAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["lessons"],"summary":"Create Lesson","description":"Create a lessons for a semester with given userID, semesterID","operationId":"createLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonModel"}}},"required":true},"responses":{"200":{"description":"Add new lesson into a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}":{"get":{"tags":["lessons"],"summary":"Show Lesson","description":"Get a single lesson with given userID, semesterID and lessonID","operationId":"getSingleLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Get a single lesson of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["lessons"],"summary":"Update Lesson","description":"Update a lesson with given userID, semesterID and lessonID","operationId":"updateLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["lessons"],"summary":"Delete Lesson","description":"Delete a lesson with given userID, semesterID and lessonID","operationId":"deleteLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Delete lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots":{"post":{"tags":["slots"],"summary":"Create Slot","description":"Create a slot for a lesson","operationId":"createSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotModel"}}},"required":true},"responses":{"200":{"description":"Add new slot into a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots/{slid}":{"put":{"tags":["slots"],"summary":"Update Slot","description":"Update a slot of a lesson","operationId":"updateSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotModel"}}},"required":true},"responses":{"200":{"description":"Update a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Slot","description":"Delete a slot of a lesson","operationId":"deleteSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"responses":{"200":{"description":"Delete a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/absences/{slid}":{"post":{"tags":["slots"],"summary":"Create Absence","description":"Create an absence for a slot","operationId":"createAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Add absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Absence","description":"Delete an absence from a slot","operationId":"deleteAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Delete absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities":{"get":{"tags":["universities"],"summary":"List Universities","description":"list all universities","operationId":"listUniversities","responses":{"200":{"description":"List all universities","content":{"application/json":{"schema":{"title":"Response List Universities Universities Get","type":"array","items":{"$ref":"#/components/schemas/UniversityAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}}},"post":{"tags":["universities"],"summary":"Create University","description":"Create a university","operationId":"createUniversity","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityModel"}}},"required":true},"responses":{"200":{"description":"Add new university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}":{"get":{"tags":["universities"],"summary":"Show University","description":"Get a single university with given universityID","operationId":"getSingleUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get a single university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University","description":"Update name of a university with given universityID","operationId":"updateUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__uni_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["universities"],"summary":"Delete University","description":"Delete a university with given universityID","operationId":"deleteUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Delete university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/current-semester":{"get":{"tags":["universities"],"summary":"Show University Current Semester","description":"Get current semester of a university with given universityID","operationId":"getCurrentUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University Current Semester","description":"Update current semester of a university with given universityID","operationId":"updateUniversityCurrentSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters":{"get":{"tags":["university semesters"],"summary":"List University Semesters","description":"list all semesters of a university with given universityID","operationId":"listUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university semeseters","content":{"application/json":{"schema":{"title":"Response List University Semesters Universities Unid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university semesters"],"summary":"Create University Semester","description":"Create semester for a university with given universityID","operationId":"createUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}":{"get":{"tags":["university semesters"],"summary":"Show University Semester","description":"Get a single semester of a university with given universityID and universitySemesterID","operationId":"getSingleUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List a university semeseters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university semesters"],"summary":"Update University Semester","description":"Update university of a semester with given universityID and universitySemesterID","operationId":"updateUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university semesters"],"summary":"Delete University Semester","description":"Delete a university semester with given universityID and universitySemesterID","operationId":"deleteUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"Delete university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons":{"get":{"tags":["university lessons"],"summary":"List University Lessons","description":"list all lessons for a semesters of a university with given universityID and universitySemesterID","operationId":"listUniversitySemesterLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List all lessons of a university semester","content":{"application/json":{"schema":{"title":"Response List University Lessons Universities Unid Semesters Unisid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university lessons"],"summary":"Create University Lesson","description":"Create a lesson for a semester of a university with given universityID and universitySemesterID","operationId":"createUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/current-semester/lessons/find-code":{"get":{"tags":["university lessons"],"summary":"Show Lesson With Code","description":"Get a single lesson of a university semester with given universityID and Lesson Code","operationId":"getSingleLessonWithCode","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Code","type":"string"},"name":"code","in":"query"}],"responses":{"200":{"description":"Get a single lessons with code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}":{"get":{"tags":["university lessons"],"summary":"Show University Lesson","description":"Get a single lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"getSingleUniversitySemesterLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Get a single lessons of a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university lessons"],"summary":"Update University Lesson","description":"Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"updateUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university lessons"],"summary":"Delete University Lesson","description":"Delete a university lesson with given universityID, universitySemesterID and universityLessonID","operationId":"deleteUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Delete university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections":{"post":{"tags":["university sections"],"summary":"Create Lesson Section","description":"Create a university section","operationId":"addLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Add a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections/{secid}":{"put":{"tags":["university sections"],"summary":"Update Lesson Section","description":"Update section of a lesson with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"updateLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university sections"],"summary":"Delete Lesson Section","description":"Delete a lesson section with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"deleteLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"responses":{"200":{"description":"Delete a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments":{"get":{"tags":["departments"],"summary":"List University Departments","description":"list all departments of a university with given universityID","operationId":"listUniversityDepartments","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university departments","content":{"application/json":{"schema":{"title":"Response List University Departments Universities Unid Departments Get","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["departments"],"summary":"Create University Department","description":"Create department for a university with given universityID","operationId":"createUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Add new university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}":{"get":{"tags":["departments"],"summary":"Show University Department","description":"Get a single semester of a university with given universityID and universityDepartmentID","operationId":"getSingleUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Show a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["departments"],"summary":"Update University Department","description":"Update department of a university with given universityID and universityDepartmentID","operationId":"updateUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Update a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["departments"],"summary":"Delete University Department","description":"Delete a university department with given universityID and universitySemesterID","operationId":"deleteUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Delete university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums":{"get":{"tags":["curriculums"],"summary":"List Department Curriculums","description":"list all curriculums of a department of a university with given universityID and universityDepartmentID","operationId":"listUniversityDepartmentCurriculums","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"List all university curriculums","content":{"application/json":{"schema":{"title":"Response List Department Curriculums Universities Unid Departments Depid Curriculums Get","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculums"],"summary":"Create Department Curriculum","description":"Create department for a university with given universityID and universityDepartmentID","operationId":"createUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Add new university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}":{"get":{"tags":["curriculums"],"summary":"Show Department Curriculum","description":"Get a single semester of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"getSingleUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Show a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculums"],"summary":"Update Department Curriculum","description":"Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"updateUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Update a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculums"],"summary":"Delete Department Curriculum","description":"Delete a university department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"deleteUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Delete university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters":{"get":{"tags":["curriculum semesters"],"summary":"List Curriculum Semesters","description":"list all semesters of a curriculum of a department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"listCurriculumSemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"List all curriculum semesters","content":{"application/json":{"schema":{"title":"Response List Curriculum Semesters Universities Unid Departments Depid Curriculums Curid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum semesters"],"summary":"Create Curriculum Semester","description":"Create semester for a curriculum with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"createCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}":{"get":{"tags":["curriculum semesters"],"summary":"Show Curriculum Semester","description":"Get a single semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"getSingleCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Show a university curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum semesters"],"summary":"Update Curriculum Semester","description":"Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"updateCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum semesters"],"summary":"Delete Curriculum Semester","description":"Delete a university department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"deleteCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Delete curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons":{"get":{"tags":["curriculum lessons"],"summary":"List Curriculum Lessons","description":"list all lessons of a curriculum semester of a department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"listCurriculumLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"List all curriculum lessons","content":{"application/json":{"schema":{"title":"Response List Curriculum Lessons Universities Unid Departments Depid Curriculums Curid Semesters Cursid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum lessons"],"summary":"Create Curriculum Lesson","description":"Create lesson for a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"createCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons/{curlid}":{"get":{"tags":["curriculum lessons"],"summary":"Show Curriculum Lesson","description":"Get a single lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"getSingleCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Show a curriculum semester lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum lessons"],"summary":"Update Curriculum Lesson","description":"Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"updateCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum lessons"],"summary":"Delete Curriculum Lesson","description":"Delete a lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"deleteCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Delete curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/schedule":{"post":{"tags":["scheduler"],"summary":"Create Schedule","description":"Create schedules for given lessons","operationId":"createSchedule","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"title":"Lesson Codes","type":"array","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"Create schedules for given lessons","content":{"application/json":{"schema":{"title":"Response Create Schedule Universities Unid Schedule Post","type":"array","items":{"type":"object","additionalProperties":{"type":"integer"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AbsenceModel":{"title":"AbsenceModel","required":["week"],"type":"object","properties":{"week":{"title":"Week","minimum":1.0,"type":"integer"}},"example":{"week":1}},"Body_login_for_access_token_token_post":{"title":"Body_login_for_access_token_token_post","required":["username","password"],"type":"object","properties":{"grant_type":{"title":"Grant Type","pattern":"password","type":"string"},"username":{"title":"Username","type":"string"},"password":{"title":"Password","type":"string"},"scope":{"title":"Scope","type":"string","default":""},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}}},"CurriculumLessonModel":{"title":"CurriculumLessonModel","required":["name","code","lesson_type"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":100,"minLength":1,"type":"string"},"lesson_type":{"title":"Lesson Type","maxLength":30,"minLength":1,"type":"string"}},"example":{"name":"PHYSICS I","code":"PHYS101","lesson_type":"science"}},"CurriculumSemesterModel":{"title":"CurriculumSemesterModel","required":["number"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","exclusiveMaximum":20.0,"exclusiveMinimum":0.0,"type":"integer"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"},"default":[]}},"example":{"number":1}},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"LessonAPIModel":{"title":"LessonAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"instructor":{"title":"Instructor","type":"string"},"ects":{"title":"Ects","type":"integer"},"grade":{"title":"Grade","type":"number"},"absence_limit":{"title":"Absence Limit","type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotAPIModel"}}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1]},{"room":"F0D01","day":2,"hour":8,"is_lab":0,"absences":[2]}]}},"LessonModel":{"title":"LessonModel","required":["name","code","instructor","ects","grade","absence_limit","slots"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"code":{"title":"Code","minLength":1,"type":"string"},"instructor":{"title":"Instructor","minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotModel"}}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"Message":{"title":"Message","required":["message"],"type":"object","properties":{"message":{"title":"Message","type":"string"}}},"MessageCreate":{"title":"MessageCreate","required":["_id","message"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"message":{"title":"Message","type":"string"}},"example":{"_id":"61ddea901311ecaed99afb7c","message":"string"}},"SemesterAPIModel":{"title":"SemesterAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"title":"Start Hour","type":"array","items":{"type":"integer"}},"duration_lesson":{"title":"Duration Lesson","type":"integer"},"duration_break":{"title":"Duration Break","type":"integer"},"slot_count":{"title":"Slot Count","type":"integer"},"semester_gpa":{"title":"Semester Gpa","type":"number"}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":[8,20],"duration_lesson":50,"duration_break":10,"slot_count":12,"semester_gpa":3.67}},"SlotAPIModel":{"title":"SlotAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","type":"string"},"day":{"title":"Day","type":"integer"},"hour":{"title":"Hour","type":"integer"},"is_lab":{"title":"Is Lab","type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"}}},"example":{"_id":"61ddea901311ecaed99afb7c","room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1,2]}},"SlotModel":{"title":"SlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","maxLength":127,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"},"default":[]}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"StartHourModel":{"title":"StartHourModel","required":["hour","minute"],"type":"object","properties":{"hour":{"title":"Hour","maximum":23.0,"minimum":0.0,"type":"integer"},"minute":{"title":"Minute","maximum":59.0,"minimum":0.0,"type":"integer"}}},"Token":{"title":"Token","required":["access_token","token_type"],"type":"object","properties":{"access_token":{"title":"Access Token","type":"string"},"token_type":{"title":"Token Type","type":"string"}}},"UniversityAPIModel":{"title":"UniversityAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"website":{"title":"Website","type":"string"},"country":{"title":"Country","type":"string"},"city":{"title":"City","type":"string"},"address":{"title":"Address","type":"string"},"phone":{"title":"Phone","type":"string"},"email":{"title":"Email","type":"string"},"zip_code":{"title":"Zip Code","type":"string"},"description":{"title":"Description","type":"string"},"logo":{"title":"Logo","type":"string"},"cover_photo":{"title":"Cover Photo","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png","current_semester_id":"61fc266ae3d749b1d65c17c7"}},"UniversityCurriculumModel":{"title":"UniversityCurriculumModel","required":["name","start_year","end_year"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"start_year":{"title":"Start Year","type":"integer"},"end_year":{"title":"End Year","type":"integer"},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"},"default":[]}},"example":{"name":"2016 Later","start_year":2016,"end_year":2100}},"UniversityDepartmentModel":{"title":"UniversityDepartmentModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"curriculums":{"title":"Curriculums","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"},"default":[]}},"example":{"name":"COMP"}},"UniversityLessonAPIModel":{"title":"UniversityLessonAPIModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":0,"sections":[{"_id":"61ddea901311ecaed99afb7c","number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}]}},"UniversityLessonModel":{"title":"UniversityLessonModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":20,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":8}},"UniversityModel":{"title":"UniversityModel","required":["name","website","country","city","address","phone","email","zip_code","description","logo","cover_photo"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"},"departments":{"title":"Departments","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"},"default":[]},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterModel"},"default":[]}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"UniversitySectionAPIModel":{"title":"UniversitySectionAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","type":"integer"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySectionModel":{"title":"UniversitySectionModel","required":["number","instructor"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","minimum":0.0,"type":"integer"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"},"default":[]}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySemesterAPIModel":{"title":"UniversitySemesterAPIModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"20-21 Spring"}},"UniversitySemesterModel":{"title":"UniversitySemesterModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"},"default":[]}},"example":{"name":"20-21 Spring"}},"UniversitySlotModel":{"title":"UniversitySlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"room":{"title":"Room","maxLength":100,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"UpdateCurrentGPAModel":{"title":"UpdateCurrentGPAModel","required":["current_gpa"],"type":"object","properties":{"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"current_gpa":3.67}},"UpdateCurrentSemesterModel":{"title":"UpdateCurrentSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateEntranceYearModel":{"title":"UpdateEntranceYearModel","required":["entrance_year"],"type":"object","properties":{"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer"}},"example":{"entrance_year":2018}},"UpdateLessonModel":{"title":"UpdateLessonModel","required":["name","code","instructor","ects","grade","absence_limit"],"type":"object","properties":{"name":{"title":"Name","minLength":1,"type":"string"},"code":{"title":"Code","minLength":1,"type":"string"},"instructor":{"title":"Instructor","minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21}},"UpdatePasswordModel":{"title":"UpdatePasswordModel","required":["password"],"type":"object","properties":{"password":{"title":"Password","type":"string"}},"example":{"password":"123456"}},"UpdateSemesterGPAModel":{"title":"UpdateSemesterGPAModel","required":["semester_gpa"],"type":"object","properties":{"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"semester_gpa":3.67}},"UpdateSemesterModel":{"title":"UpdateSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateUserGroupModel":{"title":"UpdateUserGroupModel","required":["user_group"],"type":"object","properties":{"user_group":{"title":"User Group","type":"string"}},"example":{"user_group":"professor"}},"UpdateUserNameModel":{"title":"UpdateUserNameModel","required":["first_name","last_name"],"type":"object","properties":{"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"}},"example":{"first_name":"John","last_name":"Doe"}},"UpdateUserSemesterModel":{"title":"UpdateUserSemesterModel","required":["name","start_date","end_date","start_hour","duration_lesson","duration_break","slot_count","semester_gpa"],"type":"object","properties":{"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"UserAPIModel":{"title":"UserAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"first_name":{"title":"First Name","type":"string"},"last_name":{"title":"Last Name","type":"string"},"current_gpa":{"title":"Current Gpa","type":"number"},"user_group":{"title":"User Group","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"},"current_university_id":{"title":"Current University Id","type":"string"},"entrance_year":{"title":"Entrance Year","type":"integer"}},"example":{"_id":"61ddea901311ecaed99afb7c","email":"hello@agu.edu.tr","first_name":"John","last_name":"Doe","current_gpa":3.67,"user_group":"default","current_semester_id":"61ddea901311ecaed99afb7d","current_university_id":"61ddea901311ecaed99afb7e","entrance_year":2018}},"UserModel":{"title":"UserModel","required":["email","password","first_name","last_name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"password":{"title":"Password","type":"string"},"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"},"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0},"current_semester_id":{"title":"Current Semester Id","type":"string","default":"null"},"current_university_id":{"title":"Current University Id","type":"string","default":"null"},"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer","default":2010},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UserSemesterModel"},"default":[]}},"example":{"email":"hello@agu.edu.tr","password":"123456","first_name":"John","last_name":"Doe"}},"UserSemesterModel":{"title":"UserSemesterModel","required":["name","start_date","end_date","start_hour","duration_lesson","duration_break","slot_count"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0.0},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/LessonModel"},"default":[]}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}},"app__models__uni_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["name","website","country","city","address","phone","email","zip_code","description","logo","cover_photo"],"type":"object","properties":{"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"app__models__user_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["current_university_id"],"type":"object","properties":{"current_university_id":{"title":"Current University Id","type":"string"}},"example":{"current_university_id":"61ddea901311ecaed99afb7g"}}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} \ No newline at end of file +{"openapi":"3.0.2","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/token":{"post":{"tags":["token"],"summary":"Login For Access Token","operationId":"login_for_access_token_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_for_access_token_token_post"}}},"required":true},"responses":{"200":{"description":"Get token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users":{"get":{"tags":["users"],"summary":"Get Current","operationId":"getCurrentUser","responses":{"200":{"description":"Get current user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["users"],"summary":"Create User","description":"Create a user","operationId":"createUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/users/{uid}":{"get":{"tags":["users"],"summary":"Show User","description":"Get a single user with given userID","operationId":"getSingleUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Get a single user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["users"],"summary":"Delete User","description":"Delete a user with given userID","operationId":"deleteUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"Delete user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-password":{"put":{"tags":["users"],"summary":"Update Password","description":"Update password of a user with given userID","operationId":"updatePassword","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePasswordModel"}}},"required":true},"responses":{"200":{"description":"Update password of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-name":{"put":{"tags":["users"],"summary":"Update User Name","description":"Update first and last names of a user with given userID","operationId":"updateName","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserNameModel"}}},"required":true},"responses":{"200":{"description":"Update first and last names of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-semester":{"put":{"tags":["users"],"summary":"Update Current Semester","description":"Update current semester ID of a user with given userID","operationId":"updateCurrentSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/current-university":{"put":{"tags":["users"],"summary":"Update Current University","description":"Update current university ID of a user with given userID","operationId":"updateCurrentUniversity","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__user_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update current university ID of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/entrance-year":{"put":{"tags":["users"],"summary":"Update Entrance Year","description":"Update entrance year of a user with given userID","operationId":"updateEntranceYear","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEntranceYearModel"}}},"required":true},"responses":{"200":{"description":"Update entrance year of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/change-gpa":{"put":{"tags":["users"],"summary":"Update Current Gpa","description":"Update entrance year of a user with given userID","operationId":"updateCurrentGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentGPAModel"}}},"required":true},"responses":{"200":{"description":"Update current gpa of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/admin/update-user-group/{uid}":{"put":{"tags":["users"],"summary":"Update User Group","description":"Update group of a user with given userID","operationId":"updateUserGroup","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserGroupModel"}}},"required":true},"responses":{"200":{"description":"Update group of a user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/professors":{"post":{"tags":["users"],"summary":"Create Professor User","description":"Create a professor user","operationId":"createProfessorUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserModel"}}},"required":true},"responses":{"200":{"description":"Add new professor user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters":{"get":{"tags":["semesters"],"summary":"List Semesters","description":"list all semesters of a user with given userID","operationId":"listSemestersOfUser","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"responses":{"200":{"description":"List all semesters","content":{"application/json":{"schema":{"title":"Response List Semesters Users Uid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/SemesterAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["semesters"],"summary":"Create Semester","description":"Create a semester for a user with given userID","operationId":"createSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}":{"get":{"tags":["semesters"],"summary":"Show Semester","description":"Get a single semester with given userID and semesterID","operationId":"getSingleSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Get a single semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemesterAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["semesters"],"summary":"Update Semester","description":"Update a semester with given userID and semesterID","operationId":"updateSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["semesters"],"summary":"Delete Semester","description":"Delete a semester with given userID and semesterID","operationId":"deleteSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"Delete semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/semester-gpa":{"put":{"tags":["semesters"],"summary":"Update Semester Gpa","description":"Update gpa of a semester with given userID and semesterID","operationId":"updateSemesterGPA","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSemesterGPAModel"}}},"required":true},"responses":{"200":{"description":"Update gpa of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons":{"get":{"tags":["lessons"],"summary":"List Lessons","description":"List all lessons of a semester with given userID, semesterID","operationId":"listLessonsOfSemester","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"responses":{"200":{"description":"List all lessons of a semester","content":{"application/json":{"schema":{"title":"Response List Lessons Users Uid Semesters Sid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/LessonAPIModel"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"post":{"tags":["lessons"],"summary":"Create Lesson","description":"Create a lessons for a semester with given userID, semesterID","operationId":"createLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonModel"}}},"required":true},"responses":{"200":{"description":"Add new lesson into a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}":{"get":{"tags":["lessons"],"summary":"Show Lesson","description":"Get a single lesson with given userID, semesterID and lessonID","operationId":"getSingleLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Get a single lesson of a semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LessonAPIModel"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["lessons"],"summary":"Update Lesson","description":"Update a lesson with given userID, semesterID and lessonID","operationId":"updateLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["lessons"],"summary":"Delete Lesson","description":"Delete a lesson with given userID, semesterID and lessonID","operationId":"deleteLesson","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"responses":{"200":{"description":"Delete lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots":{"post":{"tags":["slots"],"summary":"Create Slot","description":"Create a slot for a lesson","operationId":"createSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotModel"}}},"required":true},"responses":{"200":{"description":"Add new slot into a lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/slots/{slid}":{"put":{"tags":["slots"],"summary":"Update Slot","description":"Update a slot of a lesson","operationId":"updateSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSlotModel"}}},"required":true},"responses":{"200":{"description":"Update a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Slot","description":"Delete a slot of a lesson","operationId":"deleteSlot","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"responses":{"200":{"description":"Delete a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/users/{uid}/semesters/{sid}/lessons/{lid}/absences/{slid}":{"post":{"tags":["slots"],"summary":"Create Absence","description":"Create an absence for a slot","operationId":"createAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Add absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["slots"],"summary":"Delete Absence","description":"Delete an absence from a slot","operationId":"deleteAbsence","parameters":[{"required":true,"schema":{"title":"Uid","type":"string"},"name":"uid","in":"path"},{"required":true,"schema":{"title":"Sid","type":"string"},"name":"sid","in":"path"},{"required":true,"schema":{"title":"Lid","type":"string"},"name":"lid","in":"path"},{"required":true,"schema":{"title":"Slid","type":"string"},"name":"slid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbsenceModel"}}},"required":true},"responses":{"200":{"description":"Delete absence into a slot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities":{"get":{"tags":["universities"],"summary":"List Universities","description":"list all universities","operationId":"listUniversities","responses":{"200":{"description":"List all universities","content":{"application/json":{"schema":{"title":"Response List Universities Universities Get","type":"array","items":{"$ref":"#/components/schemas/UniversityAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}}},"post":{"tags":["universities"],"summary":"Create University","description":"Create a university","operationId":"createUniversity","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityModel"}}},"required":true},"responses":{"200":{"description":"Add new university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}":{"get":{"tags":["universities"],"summary":"Show University","description":"Get a single university with given universityID","operationId":"getSingleUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get a single university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University","description":"Update name of a university with given universityID","operationId":"updateUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__models__uni_models__UpdateUniversityModel"}}},"required":true},"responses":{"200":{"description":"Update university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["universities"],"summary":"Delete University","description":"Delete a university with given universityID","operationId":"deleteUniversity","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Delete university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/current-semester":{"get":{"tags":["universities"],"summary":"Show University Current Semester","description":"Get current semester of a university with given universityID","operationId":"getCurrentUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"Get current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["universities"],"summary":"Update University Current Semester","description":"Update current semester of a university with given universityID","operationId":"updateUniversityCurrentSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurrentSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update current semester of a university","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters":{"get":{"tags":["university semesters"],"summary":"List University Semesters","description":"list all semesters of a university with given universityID","operationId":"listUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university semeseters","content":{"application/json":{"schema":{"title":"Response List University Semesters Universities Unid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university semesters"],"summary":"Create University Semester","description":"Create semester for a university with given universityID","operationId":"createUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}":{"get":{"tags":["university semesters"],"summary":"Show University Semester","description":"Get a single semester of a university with given universityID and universitySemesterID","operationId":"getSingleUniversitySemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List a university semeseters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university semesters"],"summary":"Update University Semester","description":"Update university of a semester with given universityID and universitySemesterID","operationId":"updateUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university semesters"],"summary":"Delete University Semester","description":"Delete a university semester with given universityID and universitySemesterID","operationId":"deleteUniversitySemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"Delete university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons":{"get":{"tags":["university lessons"],"summary":"List University Lessons","description":"list all lessons for a semesters of a university with given universityID and universitySemesterID","operationId":"listUniversitySemesterLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"responses":{"200":{"description":"List all lessons of a university semester","content":{"application/json":{"schema":{"title":"Response List University Lessons Universities Unid Semesters Unisid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["university lessons"],"summary":"Create University Lesson","description":"Create a lesson for a semester of a university with given universityID and universitySemesterID","operationId":"createUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/current-semester/lessons/find-code":{"get":{"tags":["university lessons"],"summary":"Show Lesson With Code","description":"Get a single lesson of a university semester with given universityID and Lesson Code","operationId":"getSingleLessonWithCode","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Code","type":"string"},"name":"code","in":"query"}],"responses":{"200":{"description":"Get a single lessons with code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}":{"get":{"tags":["university lessons"],"summary":"Show University Lesson","description":"Get a single lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"getSingleUniversitySemesterLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Get a single lessons of a university semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityLessonAPIModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["university lessons"],"summary":"Update University Lesson","description":"Update lesson of a university semester with given universityID, universitySemesterID and universityLessonID","operationId":"updateUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUniversityLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university lessons"],"summary":"Delete University Lesson","description":"Delete a university lesson with given universityID, universitySemesterID and universityLessonID","operationId":"deleteUniversityLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"responses":{"200":{"description":"Delete university lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections":{"post":{"tags":["university sections"],"summary":"Create Lesson Section","description":"Create a university section","operationId":"addLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Add a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/semesters/{unisid}/lessons/{unilid}/sections/{secid}":{"put":{"tags":["university sections"],"summary":"Update Lesson Section","description":"Update section of a lesson with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"updateLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUniversitySectionModel"}}},"required":true},"responses":{"200":{"description":"Update a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["university sections"],"summary":"Delete Lesson Section","description":"Delete a lesson section with given universityID, universitySemesterID, universityLessonID and sectionID","operationId":"deleteLessonSection","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Unisid","type":"string"},"name":"unisid","in":"path"},{"required":true,"schema":{"title":"Unilid","type":"string"},"name":"unilid","in":"path"},{"required":true,"schema":{"title":"Secid","type":"string"},"name":"secid","in":"path"}],"responses":{"200":{"description":"Delete a lesson section","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments":{"get":{"tags":["departments"],"summary":"List University Departments","description":"list all departments of a university with given universityID","operationId":"listUniversityDepartments","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"responses":{"200":{"description":"List all university departments","content":{"application/json":{"schema":{"title":"Response List University Departments Universities Unid Departments Get","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["departments"],"summary":"Create University Department","description":"Create department for a university with given universityID","operationId":"createUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Add new university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}":{"get":{"tags":["departments"],"summary":"Show University Department","description":"Get a single semester of a university with given universityID and universityDepartmentID","operationId":"getSingleUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Show a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["departments"],"summary":"Update University Department","description":"Update department of a university with given universityID and universityDepartmentID","operationId":"updateUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityDepartmentModel"}}},"required":true},"responses":{"200":{"description":"Update a university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["departments"],"summary":"Delete University Department","description":"Delete a university department with given universityID and universitySemesterID","operationId":"deleteUniversityDepartment","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"Delete university department","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums":{"get":{"tags":["curriculums"],"summary":"List Department Curriculums","description":"list all curriculums of a department of a university with given universityID and universityDepartmentID","operationId":"listUniversityDepartmentCurriculums","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"responses":{"200":{"description":"List all university curriculums","content":{"application/json":{"schema":{"title":"Response List Department Curriculums Universities Unid Departments Depid Curriculums Get","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculums"],"summary":"Create Department Curriculum","description":"Create department for a university with given universityID and universityDepartmentID","operationId":"createUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Add new university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}":{"get":{"tags":["curriculums"],"summary":"Show Department Curriculum","description":"Get a single semester of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"getSingleUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Show a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UniversityCurriculumModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculums"],"summary":"Update Department Curriculum","description":"Update department of a university with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"updateUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUniversityCurriculumModel"}}},"required":true},"responses":{"200":{"description":"Update a university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculums"],"summary":"Delete Department Curriculum","description":"Delete a university department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"deleteUniversityDepartmentCurriculum","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"Delete university department curriculum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters":{"get":{"tags":["curriculum semesters"],"summary":"List Curriculum Semesters","description":"list all semesters of a curriculum of a department with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"listCurriculumSemesters","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"responses":{"200":{"description":"List all curriculum semesters","content":{"application/json":{"schema":{"title":"Response List Curriculum Semesters Universities Unid Departments Depid Curriculums Curid Semesters Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum semesters"],"summary":"Create Curriculum Semester","description":"Create semester for a curriculum with given universityID, universityDepartmentID and departmentCurriculumID","operationId":"createCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}":{"get":{"tags":["curriculum semesters"],"summary":"Show Curriculum Semester","description":"Get a single semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"getSingleCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Show a university curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum semesters"],"summary":"Update Curriculum Semester","description":"Update semester of a curriculum with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"updateCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumSemesterModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum semesters"],"summary":"Delete Curriculum Semester","description":"Delete a university department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"deleteCurriculumSemester","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"Delete curriculum semester","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons":{"get":{"tags":["curriculum lessons"],"summary":"List Curriculum Lessons","description":"list all lessons of a curriculum semester of a department with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"listCurriculumLessons","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"responses":{"200":{"description":"List all curriculum lessons","content":{"application/json":{"schema":{"title":"Response List Curriculum Lessons Universities Unid Departments Depid Curriculums Curid Semesters Cursid Lessons Get","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["curriculum lessons"],"summary":"Create Curriculum Lesson","description":"Create lesson for a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID and curriculumSemesterID","operationId":"createCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Add new curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/departments/{depid}/curriculums/{curid}/semesters/{cursid}/lessons/{curlid}":{"get":{"tags":["curriculum lessons"],"summary":"Show Curriculum Lesson","description":"Get a single lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"getSingleCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Show a curriculum semester lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurriculumLessonModel"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["curriculum lessons"],"summary":"Update Curriculum Lesson","description":"Update lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"updateCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCurriculumLessonModel"}}},"required":true},"responses":{"200":{"description":"Update a curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"delete":{"tags":["curriculum lessons"],"summary":"Delete Curriculum Lesson","description":"Delete a lesson of a curriculum semester with given universityID, universityDepartmentID, departmentCurriculumID, curriculumSemesterID and curriculumLessonID","operationId":"deleteCurriculumLesson","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"},{"required":true,"schema":{"title":"Depid","type":"string"},"name":"depid","in":"path"},{"required":true,"schema":{"title":"Curid","type":"string"},"name":"curid","in":"path"},{"required":true,"schema":{"title":"Cursid","type":"string"},"name":"cursid","in":"path"},{"required":true,"schema":{"title":"Curlid","type":"string"},"name":"curlid","in":"path"}],"responses":{"200":{"description":"Delete curriculum lesson","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/universities/{unid}/schedule":{"post":{"tags":["scheduler"],"summary":"Create Schedule","description":"Create schedules for given lessons","operationId":"createSchedule","parameters":[{"required":true,"schema":{"title":"Unid","type":"string"},"name":"unid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"title":"Lesson Codes","type":"array","items":{"type":"string"}}}},"required":true},"responses":{"200":{"description":"Create schedules for given lessons","content":{"application/json":{"schema":{"title":"Response Create Schedule Universities Unid Schedule Post","type":"array","items":{"type":"object","additionalProperties":{"type":"integer"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AbsenceModel":{"title":"AbsenceModel","required":["week"],"type":"object","properties":{"week":{"title":"Week","minimum":1.0,"type":"integer"}},"example":{"week":1}},"Body_login_for_access_token_token_post":{"title":"Body_login_for_access_token_token_post","required":["username","password"],"type":"object","properties":{"grant_type":{"title":"Grant Type","pattern":"password","type":"string"},"username":{"title":"Username","type":"string"},"password":{"title":"Password","type":"string"},"scope":{"title":"Scope","type":"string","default":""},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}}},"CurriculumLessonModel":{"title":"CurriculumLessonModel","required":["name","code","lesson_type"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":100,"minLength":1,"type":"string"},"lesson_type":{"title":"Lesson Type","maxLength":30,"minLength":1,"type":"string"}},"example":{"name":"PHYSICS I","code":"PHYS101","lesson_type":"science"}},"CurriculumSemesterModel":{"title":"CurriculumSemesterModel","required":["number"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","exclusiveMaximum":20.0,"exclusiveMinimum":0.0,"type":"integer"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/CurriculumLessonModel"},"default":[]}},"example":{"number":1}},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"LessonAPIModel":{"title":"LessonAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"instructor":{"title":"Instructor","type":"string"},"ects":{"title":"Ects","type":"integer"},"grade":{"title":"Grade","type":"number"},"absence_limit":{"title":"Absence Limit","type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotAPIModel"}}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1]},{"room":"F0D01","day":2,"hour":8,"is_lab":0,"absences":[2]}]}},"LessonModel":{"title":"LessonModel","required":["name","code","instructor","ects"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":127,"minLength":1,"type":"string"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/SlotModel"},"default":[]}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21,"slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"Message":{"title":"Message","required":["message"],"type":"object","properties":{"message":{"title":"Message","type":"string"}}},"MessageCreate":{"title":"MessageCreate","required":["_id","message"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"message":{"title":"Message","type":"string"}},"example":{"_id":"61ddea901311ecaed99afb7c","message":"string"}},"SemesterAPIModel":{"title":"SemesterAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"title":"Start Hour","type":"array","items":{"type":"integer"}},"duration_lesson":{"title":"Duration Lesson","type":"integer"},"duration_break":{"title":"Duration Break","type":"integer"},"slot_count":{"title":"Slot Count","type":"integer"},"semester_gpa":{"title":"Semester Gpa","type":"number"}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":[8,20],"duration_lesson":50,"duration_break":10,"slot_count":12,"semester_gpa":3.67}},"SlotAPIModel":{"title":"SlotAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","type":"string"},"day":{"title":"Day","type":"integer"},"hour":{"title":"Hour","type":"integer"},"is_lab":{"title":"Is Lab","type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"}}},"example":{"_id":"61ddea901311ecaed99afb7c","room":"F0D01","day":2,"hour":7,"is_lab":0,"absences":[1,2]}},"SlotModel":{"title":"SlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"room":{"title":"Room","maxLength":127,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"},"absences":{"title":"Absences","type":"array","items":{"type":"integer"},"default":[]}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"StartHourModel":{"title":"StartHourModel","required":["hour","minute"],"type":"object","properties":{"hour":{"title":"Hour","maximum":23.0,"minimum":0.0,"type":"integer"},"minute":{"title":"Minute","maximum":59.0,"minimum":0.0,"type":"integer"}}},"Token":{"title":"Token","required":["access_token","token_type"],"type":"object","properties":{"access_token":{"title":"Access Token","type":"string"},"token_type":{"title":"Token Type","type":"string"}}},"UniversityAPIModel":{"title":"UniversityAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"website":{"title":"Website","type":"string"},"country":{"title":"Country","type":"string"},"city":{"title":"City","type":"string"},"address":{"title":"Address","type":"string"},"phone":{"title":"Phone","type":"string"},"email":{"title":"Email","type":"string"},"zip_code":{"title":"Zip Code","type":"string"},"description":{"title":"Description","type":"string"},"logo":{"title":"Logo","type":"string"},"cover_photo":{"title":"Cover Photo","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png","current_semester_id":"61fc266ae3d749b1d65c17c7"}},"UniversityCurriculumModel":{"title":"UniversityCurriculumModel","required":["name","start_year","end_year"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","minLength":1,"type":"string"},"start_year":{"title":"Start Year","exclusiveMaximum":2100.0,"minimum":2000.0,"type":"integer"},"end_year":{"title":"End Year","exclusiveMaximum":2100.0,"minimum":2000.0,"type":"integer"},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/CurriculumSemesterModel"},"default":[]}},"example":{"name":"2016 Later","start_year":2016,"end_year":2100}},"UniversityDepartmentModel":{"title":"UniversityDepartmentModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"curriculums":{"title":"Curriculums","type":"array","items":{"$ref":"#/components/schemas/UniversityCurriculumModel"},"default":[]}},"example":{"name":"COMP"}},"UniversityLessonAPIModel":{"title":"UniversityLessonAPIModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"code":{"title":"Code","type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"_id":"61ddea901311ecaed99afb7c","name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":0,"sections":[{"_id":"61ddea901311ecaed99afb7c","number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}]}},"UniversityLessonModel":{"title":"UniversityLessonModel","required":["name","code","ects","absence_limit"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":20,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"},"sections":{"title":"Sections","type":"array","items":{"$ref":"#/components/schemas/UniversitySectionAPIModel"},"default":[]}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":8}},"UniversityModel":{"title":"UniversityModel","required":["name","website","country","city","address","phone","email","zip_code","description","logo","cover_photo"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"},"departments":{"title":"Departments","type":"array","items":{"$ref":"#/components/schemas/UniversityDepartmentModel"},"default":[]},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UniversitySemesterModel"},"default":[]}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"UniversitySectionAPIModel":{"title":"UniversitySectionAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","type":"integer"},"instructor":{"title":"Instructor","type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySectionModel":{"title":"UniversitySectionModel","required":["number","instructor"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"number":{"title":"Number","minimum":0.0,"type":"integer"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"},"default":[]}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UniversitySemesterAPIModel":{"title":"UniversitySemesterAPIModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"}},"example":{"_id":"61fc266ae3d749b1d65c17c6","name":"20-21 Spring"}},"UniversitySemesterModel":{"title":"UniversitySemesterModel","required":["name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","type":"string"},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/UniversityLessonAPIModel"},"default":[]}},"example":{"name":"20-21 Spring"}},"UniversitySlotModel":{"title":"UniversitySlotModel","required":["room","day","hour","is_lab"],"type":"object","properties":{"room":{"title":"Room","maxLength":100,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"UpdateCurrentGPAModel":{"title":"UpdateCurrentGPAModel","required":["current_gpa"],"type":"object","properties":{"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"current_gpa":3.67}},"UpdateCurrentSemesterModel":{"title":"UpdateCurrentSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateCurriculumLessonModel":{"title":"UpdateCurriculumLessonModel","type":"object","properties":{"name":{"title":"Name","maxLength":100,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":100,"minLength":1,"type":"string"},"lesson_type":{"title":"Lesson Type","maxLength":30,"minLength":1,"type":"string"}},"example":{"name":"PHYSICS I","code":"PHYS101","lesson_type":"science"}},"UpdateEntranceYearModel":{"title":"UpdateEntranceYearModel","required":["entrance_year"],"type":"object","properties":{"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer"}},"example":{"entrance_year":2018}},"UpdateLessonModel":{"title":"UpdateLessonModel","type":"object","properties":{"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":127,"minLength":1,"type":"string"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"integer"},"grade":{"title":"Grade","maximum":10.0,"minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"}},"example":{"name":"Algebra","code":"ALG","instructor":"Jack Joe","ects":5,"grade":3.67,"absence_limit":21}},"UpdatePasswordModel":{"title":"UpdatePasswordModel","required":["password"],"type":"object","properties":{"password":{"title":"Password","type":"string"}},"example":{"password":"123456"}},"UpdateSemesterGPAModel":{"title":"UpdateSemesterGPAModel","required":["semester_gpa"],"type":"object","properties":{"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"semester_gpa":3.67}},"UpdateSemesterModel":{"title":"UpdateSemesterModel","required":["current_semester_id"],"type":"object","properties":{"current_semester_id":{"title":"Current Semester Id","type":"string"}},"example":{"current_semester_id":"61ddea901311ecaed99afb7f"}},"UpdateSlotModel":{"title":"UpdateSlotModel","type":"object","properties":{"room":{"title":"Room","maxLength":127,"type":"string"},"day":{"title":"Day","maximum":4.0,"minimum":0.0,"type":"integer"},"hour":{"title":"Hour","maximum":15.0,"minimum":0.0,"type":"integer"},"is_lab":{"title":"Is Lab","maximum":1.0,"minimum":0.0,"type":"integer"}},"example":{"room":"F0D01","day":2,"hour":7,"is_lab":0}},"UpdateUniversityCurriculumModel":{"title":"UpdateUniversityCurriculumModel","type":"object","properties":{"name":{"title":"Name","minLength":1,"type":"string"},"start_year":{"title":"Start Year","exclusiveMaximum":2100.0,"minimum":2000.0,"type":"integer"},"end_year":{"title":"End Year","exclusiveMaximum":2100.0,"minimum":2000.0,"type":"integer"}},"example":{"name":"2016 Later","start_year":2016,"end_year":2100}},"UpdateUniversityLessonModel":{"title":"UpdateUniversityLessonModel","type":"object","properties":{"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"code":{"title":"Code","maxLength":20,"minLength":1,"type":"string"},"ects":{"title":"Ects","minimum":0.0,"type":"number"},"absence_limit":{"title":"Absence Limit","minimum":0.0,"type":"integer"}},"example":{"name":"ART OF COMPUTING","code":"COMP101","ects":6,"absence_limit":8}},"UpdateUniversitySectionModel":{"title":"UpdateUniversitySectionModel","type":"object","properties":{"number":{"title":"Number","minimum":0.0,"type":"integer"},"instructor":{"title":"Instructor","maxLength":127,"minLength":1,"type":"string"},"slots":{"title":"Slots","type":"array","items":{"$ref":"#/components/schemas/UniversitySlotModel"}}},"example":{"number":1,"instructor":"Jack Joe","slots":[{"room":"F0D01","day":2,"hour":7,"is_lab":0},{"room":"F0D01","day":2,"hour":8,"is_lab":0}]}},"UpdateUserGroupModel":{"title":"UpdateUserGroupModel","required":["user_group"],"type":"object","properties":{"user_group":{"title":"User Group","type":"string"}},"example":{"user_group":"professor"}},"UpdateUserNameModel":{"title":"UpdateUserNameModel","required":["first_name","last_name"],"type":"object","properties":{"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"}},"example":{"first_name":"John","last_name":"Doe"}},"UpdateUserSemesterModel":{"title":"UpdateUserSemesterModel","type":"object","properties":{"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number"}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"UserAPIModel":{"title":"UserAPIModel","type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"first_name":{"title":"First Name","type":"string"},"last_name":{"title":"Last Name","type":"string"},"current_gpa":{"title":"Current Gpa","type":"number"},"user_group":{"title":"User Group","type":"string"},"current_semester_id":{"title":"Current Semester Id","type":"string"},"current_university_id":{"title":"Current University Id","type":"string"},"entrance_year":{"title":"Entrance Year","type":"integer"}},"example":{"_id":"61ddea901311ecaed99afb7c","email":"hello@agu.edu.tr","first_name":"John","last_name":"Doe","current_gpa":3.67,"user_group":"default","current_semester_id":"61ddea901311ecaed99afb7d","current_university_id":"61ddea901311ecaed99afb7e","entrance_year":2018}},"UserModel":{"title":"UserModel","required":["email","password","first_name","last_name"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"email":{"title":"Email","type":"string","format":"email"},"password":{"title":"Password","type":"string"},"first_name":{"title":"First Name","maxLength":127,"minLength":3,"type":"string"},"last_name":{"title":"Last Name","maxLength":127,"minLength":3,"type":"string"},"current_gpa":{"title":"Current Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0},"current_semester_id":{"title":"Current Semester Id","type":"string","default":"null"},"current_university_id":{"title":"Current University Id","type":"string","default":"null"},"entrance_year":{"title":"Entrance Year","exclusiveMinimum":2000.0,"type":"integer","default":2010},"semesters":{"title":"Semesters","type":"array","items":{"$ref":"#/components/schemas/UserSemesterModel"},"default":[]}},"example":{"email":"hello@agu.edu.tr","password":"123456","first_name":"John","last_name":"Doe"}},"UserSemesterModel":{"title":"UserSemesterModel","required":["name","start_date","end_date","start_hour","duration_lesson","duration_break","slot_count"],"type":"object","properties":{"_id":{"title":" Id","type":"string"},"name":{"title":"Name","maxLength":127,"minLength":1,"type":"string"},"start_date":{"title":"Start Date","type":"string","format":"date-time"},"end_date":{"title":"End Date","type":"string","format":"date-time"},"start_hour":{"$ref":"#/components/schemas/StartHourModel"},"duration_lesson":{"title":"Duration Lesson","exclusiveMinimum":0.0,"type":"integer"},"duration_break":{"title":"Duration Break","exclusiveMinimum":0.0,"type":"integer"},"slot_count":{"title":"Slot Count","exclusiveMaximum":16.0,"exclusiveMinimum":3.0,"type":"integer"},"semester_gpa":{"title":"Semester Gpa","maximum":10.0,"minimum":0.0,"type":"number","default":0.0},"lessons":{"title":"Lessons","type":"array","items":{"$ref":"#/components/schemas/LessonModel"},"default":[]}},"example":{"name":"2020-21 Spring","start_date":"2022-02-18T00:00:00Z","end_date":"2022-06-18T00:00:00Z","start_hour":{"hour":8,"minute":20},"duration_lesson":50,"duration_break":10,"slot_count":12}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}},"app__models__uni_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","type":"object","properties":{"name":{"title":"Name","maxLength":100,"minLength":2,"type":"string"},"website":{"title":"Website","maxLength":255,"minLength":5,"type":"string"},"country":{"title":"Country","maxLength":100,"minLength":2,"type":"string"},"city":{"title":"City","maxLength":100,"minLength":2,"type":"string"},"address":{"title":"Address","maxLength":100,"minLength":2,"type":"string"},"phone":{"title":"Phone","maxLength":100,"minLength":2,"type":"string"},"email":{"title":"Email","maxLength":100,"minLength":2,"type":"string"},"zip_code":{"title":"Zip Code","maxLength":100,"minLength":2,"type":"string"},"description":{"title":"Description","maxLength":255,"type":"string"},"logo":{"title":"Logo","maxLength":255,"type":"string"},"cover_photo":{"title":"Cover Photo","maxLength":255,"type":"string"}},"example":{"name":"Test University","website":"test.com","country":"USA","city":"Los Angeles","address":"123 Main Street","phone":"555-555-5555","email":"info@test.com","zip_code":"90210","description":"Test University Description","logo":"test_logo.png","cover_photo":"test_cover_photo.png"}},"app__models__user_models__UpdateUniversityModel":{"title":"UpdateUniversityModel","required":["current_university_id"],"type":"object","properties":{"current_university_id":{"title":"Current University Id","type":"string"}},"example":{"current_university_id":"61ddea901311ecaed99afb7g"}}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} \ No newline at end of file