Skip to content

Commit

Permalink
Merge branch 'development' into docker-compose
Browse files Browse the repository at this point in the history
# Conflicts:
#	backend/Dockerfile
  • Loading branch information
warreprovoost committed Mar 10, 2024
2 parents 1fc9900 + 815fd2a commit b01d384
Show file tree
Hide file tree
Showing 29 changed files with 546 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
working-directory: ./frontend
run: npm run lint
Backend-tests:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ docs/_build/
dist/
venv/
.env
.run/
8 changes: 5 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM python:3.9
RUN mkdir /app
WORKDIR /app/
WORKDIR /app
ADD ./project /app/
COPY . .
COPY requirements.txt /app/requirements.txt
RUN pip3 install -r requirements.txt
CMD ["python3", "-m","project"]
COPY . /app
ENTRYPOINT ["python"]
CMD ["__main__.py"]
2 changes: 2 additions & 0 deletions backend/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .endpoints.index.index import index_bp
from .endpoints.projects.project_endpoint import project_bp
from .endpoints.courses.courses_config import courses_bp
from .endpoints.users import users_bp


def create_app():
Expand All @@ -20,6 +21,7 @@ def create_app():
app.register_blueprint(index_bp)
app.register_blueprint(project_bp)
app.register_blueprint(courses_bp)
app.register_blueprint(users_bp)

return app

Expand Down
4 changes: 2 additions & 2 deletions backend/project/endpoints/courses/course_admin_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from flask import request
from flask_restful import Resource

from project.models.course_relations import CourseAdmin
from project.models.users import User
from project.models.course_relation import CourseAdmin
from project.models.user import User
from project.endpoints.courses.courses_utils import (
execute_query_abort_if_db_error,
commit_abort_if_error,
Expand Down
4 changes: 2 additions & 2 deletions backend/project/endpoints/courses/course_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from flask_restful import Resource
from sqlalchemy.exc import SQLAlchemyError

from project.models.courses import Course
from project.models.course_relations import CourseAdmin, CourseStudent
from project.models.course import Course
from project.models.course_relation import CourseAdmin, CourseStudent

from project import db
from project.utils.query_agent import delete_by_id_from_model, patch_by_id_from_model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from flask_restful import Resource

from project import db
from project.models.course_relations import CourseStudent
from project.models.course_relation import CourseStudent
from project.endpoints.courses.courses_utils import (
execute_query_abort_if_db_error,
add_abort_if_error,
Expand Down
2 changes: 1 addition & 1 deletion backend/project/endpoints/courses/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from flask import request
from flask_restful import Resource

from project.models.courses import Course
from project.models.course import Course
from project.utils.query_agent import query_selected_from_model, insert_into_model

load_dotenv()
Expand Down
6 changes: 3 additions & 3 deletions backend/project/endpoints/courses/courses_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from sqlalchemy.exc import SQLAlchemyError

from project import db
from project.models.course_relations import CourseAdmin
from project.models.users import User
from project.models.courses import Course
from project.models.course_relation import CourseAdmin
from project.models.user import User
from project.models.course import Course

load_dotenv()
API_URL = getenv("API_HOST")
Expand Down
184 changes: 184 additions & 0 deletions backend/project/endpoints/index/OpenAPI_Object.json
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,191 @@
}
}
}
},
"/users": {
"get": {
"summary": "Get all users",
"responses": {
"200": {
"description": "A list of users",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"is_teacher": {
"type": "boolean"
},
"is_admin": {
"type": "boolean"
}
},
"required": ["uid", "is_teacher", "is_admin"]
}
}
}
}
}}},
"post": {
"summary": "Create a new user",
"requestBody": {
"required": true,
"content":{
"application/json": {
"schema": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"is_teacher": {
"type": "boolean"
},
"is_admin": {
"type": "boolean"
}
},
"required": ["uid", "is_teacher", "is_admin"]
}
}
}
},
"responses": {
"201": {
"description": "User created successfully"
},
"400": {
"description": "Invalid request data"
},
"415": {
"description": "Unsupported Media Type. Expected JSON."
},
"500": {
"description": "An error occurred while creating the user"
}
}

},
"/users/{user_id}": {
"get": {
"summary": "Get a user by ID",
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A user",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"is_teacher": {
"type": "boolean"
},
"is_admin": {
"type": "boolean"
}
},
"required": ["uid", "is_teacher", "is_admin"]
}
}
}
},
"404": {
"description": "User not found"
}
}
},
"patch": {
"summary": "Update a user's information",
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"is_teacher": {
"type": "boolean"
},
"is_admin": {
"type": "boolean"
}
},
"required": ["is_teacher", "is_admin"]
}
}
}
},
"responses": {
"200": {
"description": "User updated successfully"
},
"404": {
"description": "User not found"
},
"415": {
"description": "Unsupported Media Type. Expected JSON."
},
"500": {
"description": "An error occurred while patching the user"
}
}
},
"delete": {
"summary": "Delete a user",
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "User deleted successfully"
},
"404": {
"description": "User not found"
},
"500": {
"description": "An error occurred while deleting the user"
}
}
}
}
}

}


}
2 changes: 1 addition & 1 deletion backend/project/endpoints/projects/project_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from flask import request
from flask_restful import Resource

from project.models.projects import Project
from project.models.project import Project
from project.utils.query_agent import query_by_id_from_model, delete_by_id_from_model, \
patch_by_id_from_model

Expand Down
2 changes: 1 addition & 1 deletion backend/project/endpoints/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from flask import request
from flask_restful import Resource

from project.models.projects import Project
from project.models.project import Project
from project.utils.query_agent import query_selected_from_model, insert_into_model

API_URL = getenv('API_HOST')
Expand Down
Loading

0 comments on commit b01d384

Please sign in to comment.