This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #11
- Loading branch information
Showing
1 changed file
with
56 additions
and
5 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 |
---|---|---|
@@ -1,23 +1,74 @@ | ||
import dataclasses | ||
from abc import ABC | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
|
||
|
||
@dataclass() | ||
class JsonRepresentable(ABC): | ||
|
||
def to_dict(self) -> dict: | ||
return dataclasses.asdict(self) | ||
|
||
|
||
@dataclass() | ||
class SubjectDataclass(JsonRepresentable): | ||
class UserDataclass(JsonRepresentable): | ||
id: int | ||
name: str | ||
teacher_id: int = None | ||
id: int = None | ||
email: str | ||
|
||
|
||
@dataclass() | ||
class AdminDataclass(JsonRepresentable): | ||
id: int | ||
|
||
|
||
@dataclass() | ||
class TeacherDataclass(JsonRepresentable): | ||
id: int | ||
subject_ids: list[int] | None = None | ||
|
||
|
||
@dataclass() | ||
class StudentDataclass(JsonRepresentable): | ||
id: int = -1 | ||
subject_ids: list[int] | None = None | ||
group_ids: list[int] | None = None | ||
submission_ids: list[int] | None = None | ||
|
||
|
||
@dataclass() | ||
class SubjectDataclass(JsonRepresentable): | ||
name: str | ||
id: int | None = None | ||
teacher_ids: list[int] | None = None | ||
|
||
|
||
@dataclass() | ||
class ProjectDataclass(JsonRepresentable): | ||
name: str | ||
id: int = None | ||
deadline: datetime | ||
archived: bool | ||
requirements: str | ||
visible: bool | ||
max_students: int | ||
subject_id: int | ||
id: int | None = None | ||
groups: list[int] | None = None | ||
|
||
|
||
@dataclass() | ||
class GroupDataclass(JsonRepresentable): | ||
project_id: int | ||
id: int | None = None | ||
student_ids: list[int] | None = None | ||
submission_ids: list[int] | None = None | ||
|
||
|
||
@dataclass() | ||
class SubmissionDataclass(JsonRepresentable): | ||
date_time: datetime | ||
group_id: int | ||
student_id: int | ||
state: int | ||
message: str | ||
id: int | None = None |