-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #52 created schemas for newest models
- updated the schemas in order to meet the new architecture - cleaned the dependencies at `requirements.txt` - include code coverage for actions
- Loading branch information
Showing
10 changed files
with
237 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: PR Conventional Commit Validation | ||
uses: ytanikin/[email protected] | ||
uses: ytanikin/[email protected] | ||
with: | ||
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]' | ||
task_types: '["feat","fix","docs","test","ci","refac", | ||
"perf","chore","revert"]' | ||
add_label: 'false' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# app/schemas/activity.py | ||
|
||
from typing import Optional | ||
from enum import Enum | ||
from datetime import datetime | ||
from pydantic import BaseModel | ||
from app.database.models import Question | ||
|
||
|
||
class ActivityType(str, Enum): | ||
question = "question" | ||
|
||
|
||
class ActivityBase(BaseModel): | ||
type: ActivityType | ||
activity: str | ||
created_at: datetime | ||
|
||
|
||
class ActivityCreate(ActivityBase): | ||
pass | ||
|
||
|
||
class ActivityUpdate(ActivityBase): | ||
pass | ||
|
||
|
||
class ActivityInDBBase(ActivityBase): | ||
id: int | ||
user_id: int | ||
study_session_id: int | ||
|
||
class Config: | ||
orm_mode = True | ||
|
||
|
||
class Activity(ActivityInDBBase): | ||
question: Optional["Question"] = None | ||
|
||
|
||
class ActivityInDB(ActivityInDBBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# app/schemas/answer.py | ||
|
||
from typing import ( | ||
Optional, | ||
List, | ||
) | ||
from pydantic import BaseModel | ||
|
||
|
||
class AnswerBase(BaseModel): | ||
answer: str | ||
|
||
|
||
class AnswerCreate(AnswerBase): | ||
pass | ||
|
||
|
||
class AnswerUpdate(AnswerBase): | ||
pass | ||
|
||
|
||
class AnswerInDBBase(AnswerBase): | ||
id: int | ||
user_id: int | ||
question_id: int | ||
|
||
class Config: | ||
orm_mode = True | ||
|
||
|
||
class Answer(AnswerInDBBase): | ||
parent_answer: Optional["Answer"] = None | ||
child_answers: Optional[List["Answer"]] = [] | ||
|
||
|
||
class AnswerInDB(AnswerInDBBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import ( | ||
Optional, | ||
List, | ||
) | ||
from pydantic import BaseModel | ||
from app.database.models import Answer | ||
|
||
|
||
class QuestionBase(BaseModel): | ||
question: str | ||
|
||
|
||
class QuestionCreate(QuestionBase): | ||
pass | ||
|
||
|
||
class QuestionUpdate(QuestionBase): | ||
pass | ||
|
||
|
||
class QuestionInDBBase(QuestionBase): | ||
id: int | ||
user_id: int | ||
activity_id: int | ||
|
||
class Config: | ||
orm_mode = True | ||
|
||
|
||
class Question(QuestionInDBBase): | ||
answers: Optional[List["Answer"]] = [] | ||
|
||
|
||
class QuestionInDB(QuestionInDBBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# app/schemas/study_session.py | ||
|
||
from typing import ( | ||
List, | ||
Optional, | ||
) | ||
from datetime import datetime | ||
from pydantic import BaseModel | ||
from app.database.models import Activity | ||
|
||
|
||
class StudySessionBase(BaseModel): | ||
start_time: datetime | ||
end_time: Optional[datetime] = None | ||
|
||
|
||
class StudySessionCreate(StudySessionBase): | ||
pass | ||
|
||
|
||
class StudySessionUpdate(StudySessionBase): | ||
pass | ||
|
||
|
||
class StudySessionInDBBase(StudySessionBase): | ||
id: int | ||
user_id: int | ||
|
||
class Config: | ||
orm_mode = True | ||
|
||
|
||
class StudySession(StudySessionInDBBase): | ||
activities: Optional[List["Activity"]] = [] | ||
|
||
|
||
class StudySessionInDB(StudySessionInDBBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.