Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Add description field to projects
Browse files Browse the repository at this point in the history
  • Loading branch information
msathieu committed Mar 1, 2024
1 parent cd23feb commit 234ae38
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/db/implementation/SqlProjectDAO.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SqlProjectDAO(SqlAbstractDAO[Project, ProjectDataclass], ProjectDAO):
def __init__(self) -> None:
self.model_class = Project

def create_project(self, subject_id: int, name: str, deadline: datetime, archived: bool, requirements: str,
def create_project(self, subject_id: int, name: str, deadline: datetime, archived: bool, description: str, requirements: str,
visible: bool, max_students: int) -> ProjectDataclass:
with Session(engine) as session:
subject: Subject | None = session.get(Subject, subject_id)
Expand All @@ -23,7 +23,7 @@ def create_project(self, subject_id: int, name: str, deadline: datetime, archive
raise ItemNotFoundError(msg)

new_project: Project = Project(subject_id=subject_id, name=name, deadline=deadline,
archived=archived, requirements=requirements, visible=visible,
archived=archived, description=description, requirements=requirements, visible=visible,
max_students=max_students)

session.add(new_project)
Expand Down
7 changes: 4 additions & 3 deletions backend/db/interface/ProjectDAO.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
class ProjectDAO(AbstractDAO[Project, ProjectDataclass]):

@abstractmethod
def create_project(self, subject_id: int, name: str, deadline: datetime, archived: bool, requirements: str,
def create_project(self, subject_id: int, name: str, deadline: datetime, archived: bool, description: str, requirements: str,
visible: bool, max_students: int) -> ProjectDataclass:
"""
Creëert een nieuw ProjectDataClass in de database en associeert het met een SubjectDataClass.
:param max_students: maximaal aantal studenten per groep per project
:param visible: of het project zichtbaar is voor de studenten
:param requirements: Uitleg van het project
:param visible: of het project zichtbaar is voor de studentent
:param description: Beschrijving van het project
:param requirements: Vereisten van het project
:param archived: Of het project gearchiveerd is
:param name: De naam van het project
:param deadline: De deadline van het project
Expand Down
2 changes: 2 additions & 0 deletions backend/db/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Project(Base, AbstractModel):
name: Mapped[str]
deadline: Mapped[datetime]
archived: Mapped[bool]
description: Mapped[str]
requirements: Mapped[str]
visible: Mapped[bool]
max_students: Mapped[int]
Expand All @@ -121,6 +122,7 @@ def to_domain_model(self) -> ProjectDataclass:
name=self.name,
deadline=self.deadline,
archived=self.archived,
description=self.description,
requirements=self.requirements,
visible=self.visible,
max_students=self.max_students,
Expand Down
1 change: 1 addition & 0 deletions backend/domain/models/ProjectDataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ProjectDataclass(JsonRepresentable):
name: str
deadline: datetime
archived: bool
description: str
requirements: str
visible: bool
max_students: int
Expand Down
3 changes: 2 additions & 1 deletion backend/fill_database_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
name="PROJECT",
archived=False,
visible=True,
requirements="Maak iets in javafx",
description="Maak iets in javafx",
requirements="Een zip bestand met java-code",
max_students=2,
deadline=datetime(2000, 1, 1, 0, 0, 0, tzinfo=tz.LOCAL),
)
Expand Down

0 comments on commit 234ae38

Please sign in to comment.