Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Enhancement/endpoints cleanup (#61)
Browse files Browse the repository at this point in the history
* added query agent containing functions that can be used by multiple endpoints

* loading env variables is only necessary in __main__

* removed unneeded load_dotenv

* completed functions that are ought to be used by multiple endpoints or files

* simplified endpoint functions by using query_agent functions

* fixed linting

* fixed urljoin incorrectly joining url

* lint: removed trailing whitepsace

* completely replaced functionality with query_agent functions

* added functionality for patching an entry in the database

* fixed linting

* filtered queries and forms to only contain entries that are valid in table

* created function that filters dict keys that are not in table

* made class serializable

* url query is not a valid authentication method, filtered out option

* using query_agent functions to prevent code duplication

* split courses into multiple files to keep it organized

* fixed linting

* added new courses blueprint

* removed trailing space

* changed test to stay consistent with course admin relation also

* added query agent functions to prevent code duplication

* using f string instead of concating string with plus operator

* updated with better module doc

* removed courses file (part of merge)

* removed unused module

* appending forward slash when using urljoin

* remove unused file

* fixed linting

* removed unused file

* removed duplicate column values
  • Loading branch information
AronBuzogany authored Mar 9, 2024
1 parent 46fc4ec commit a394736
Show file tree
Hide file tree
Showing 17 changed files with 969 additions and 794 deletions.
3 changes: 1 addition & 2 deletions backend/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from .db_in import db
from .endpoints.index.index import index_bp
from .endpoints.projects.project_endpoint import project_bp
from .endpoints.courses import courses_bp

from .endpoints.courses.courses_config import courses_bp


def create_app():
Expand Down
5 changes: 2 additions & 3 deletions backend/project/__main__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Main entry point for the application."""

from sys import path
from dotenv import load_dotenv
from project import create_app_with_db
from project.db_in import url

path.append(".")

if __name__ == "__main__":
load_dotenv()
app = create_app_with_db(url)
app.run(debug=True)
3 changes: 0 additions & 3 deletions backend/project/db_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

import os
from flask_sqlalchemy import SQLAlchemy
from dotenv import load_dotenv
from sqlalchemy import URL

db = SQLAlchemy()

load_dotenv()

DATABSE_NAME = os.getenv("POSTGRES_DB")
DATABASE_USER = os.getenv("POSTGRES_USER")
DATABASE_PASSWORD = os.getenv("POSTGRES_PASSWORD")
Expand Down
Loading

0 comments on commit a394736

Please sign in to comment.