This repository has been archived by the owner on Jan 22, 2025. 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.
Merge branch 'development' into backend/user_name_in_db
- Loading branch information
Showing
28 changed files
with
1,363 additions
and
862 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 +1,21 @@ | ||
# UGent-3 | ||
# UGent-3 project peristerónas | ||
![tests](https://github.com/SELab-2/UGent-3/actions/workflows/ci-test-frontend.yaml/badge.svg?branch=development) | ||
![linter](https://github.com/SELab-2/UGent-3/actions/workflows/ci-linter-frontend.yaml/badge.svg?branch=development) | ||
![tests](https://github.com/SELab-2/UGent-3/actions/workflows/ci-test-backend.yaml/badge.svg?branch=development) | ||
![linter](https://github.com/SELab-2/UGent-3/actions/workflows/ci-linter-backend.yaml/badge.svg?branch=development) | ||
## Introduction | ||
Project peristerónas was created to aid both teachers and students in achieving a | ||
clear overview of deadlines and projects that need to be submitted. | ||
|
||
There's a separate functionality depending on if you're logged in as a teacher or as a student. | ||
For students the main functionality is to have a user-friendly interface to submit projects and check the correctness of their submissions. | ||
|
||
When a teacher is logged in they can get an overview of the projects he assigned and check how many students have already | ||
handed in a correct solution for example. It's also possible to edit the project and to grade projects in peristerónas' interface. | ||
## Usage | ||
### Frontend | ||
For the developer instructions of the frontend please refer to the [frontend readme](frontend/README.md) | ||
where clear instructions can be found for usage, test cases, deployment and development. | ||
### Backend | ||
For the developer instructions of the backend please refer to the [backend readme](backend/README.md) | ||
where clear instructions can be found for usage, test cases, deployment and development. |
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,17 @@ | ||
""" | ||
Module for defining the swagger docs | ||
""" | ||
|
||
from os import getenv | ||
from flask_swagger_ui import get_swaggerui_blueprint | ||
|
||
SWAGGER_URL = getenv("DOCS_URL") | ||
API_URL = getenv("DOCS_JSON_PATH") | ||
|
||
swagger_ui_blueprint = get_swaggerui_blueprint( | ||
SWAGGER_URL, | ||
f"/{API_URL}", | ||
config={ | ||
'app_name': 'Pigeonhole API' | ||
} | ||
) |
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 |
---|---|---|
@@ -1,19 +1,34 @@ | ||
"""User model""" | ||
|
||
from enum import Enum | ||
from dataclasses import dataclass | ||
from sqlalchemy import Boolean, Column, String | ||
from sqlalchemy import Column, String, Enum as EnumField | ||
from project.db_in import db | ||
|
||
class Role(Enum): | ||
"""This class defines the roles of a user""" | ||
STUDENT = 0 | ||
TEACHER = 1 | ||
ADMIN = 2 | ||
|
||
@dataclass | ||
class User(db.Model): | ||
"""This class defines the users table, | ||
a user has a uid, | ||
a display_name, | ||
is_teacher and is_admin booleans because a user | ||
can be either a student, admin or teacher""" | ||
""" | ||
a user has a uid, | ||
a display_name and a role, a user | ||
can be either a student,admin or teacher | ||
""" | ||
|
||
__tablename__ = "users" | ||
uid: str = Column(String(255), primary_key=True) | ||
display_name: str = Column(String(255)) | ||
is_teacher: bool = Column(Boolean) | ||
is_admin: bool = Column(Boolean) | ||
role: Role = Column(EnumField(Role), nullable=False) | ||
def to_dict(self): | ||
""" | ||
Converts a User to a serializable dict | ||
""" | ||
return { | ||
'uid': self.uid, | ||
'role': self.role.name, # Convert the enum to a string | ||
'display_name': self.display_name | ||
} |
Oops, something went wrong.