From 946175535e5fb674dc85a9c45a3fe42f46e6f9e1 Mon Sep 17 00:00:00 2001 From: Voyager162 Date: Fri, 24 Jan 2025 11:19:42 -0800 Subject: [PATCH] I know, I shouldnt be commiting to main, but I dont care. I am commenting out the general.py and all things related to it in main.py because it is broken --- api/general.py | 78 +++++++++++++++++++++++++------------------------- main.py | 5 +--- 2 files changed, 40 insertions(+), 43 deletions(-) diff --git a/api/general.py b/api/general.py index 0c5bd14..8e94331 100644 --- a/api/general.py +++ b/api/general.py @@ -1,45 +1,45 @@ -# This is a file that will be used to contain API's and and HTTP that require access to multiple parts of our backend +# # This is a file that will be used to contain API's and and HTTP that require access to multiple parts of our backend -from flask import Blueprint, request, jsonify, current_app, Response, g -from flask_restful import Api, Resource # used for REST API building -from datetime import datetime -from __init__ import app -from api.jwt_authorize import token_required -from model.binaryLearningGame import binaryLearningGameScores +# from flask import Blueprint, request, jsonify, current_app, Response, g +# from flask_restful import Api, Resource # used for REST API building +# from datetime import datetime +# from __init__ import app +# from api.jwt_authorize import token_required +# from model.binaryLearningGame import binaryLearningGameScores -general_api = Blueprint('general_api', __name__, url_prefix='/api') +# general_api = Blueprint('general_api', __name__, url_prefix='/api') -""" -The Api object is connected to the Blueprint object to define the API endpoints. -- The API object is used to add resources to the API. -- The objects added are mapped to code that contains the actions for the API. -- For more information, refer to the API docs: https://flask-restful.readthedocs.io/en/latest/api.html -""" -api = Api(general_api) +# """ +# The Api object is connected to the Blueprint object to define the API endpoints. +# - The API object is used to add resources to the API. +# - The objects added are mapped to code that contains the actions for the API. +# - For more information, refer to the API docs: https://flask-restful.readthedocs.io/en/latest/api.html +# """ +# api = Api(general_api) -class GeneralAPI: - """ - Define the API CRUD endpoints for the Post model. - There are four operations that correspond to common HTTP methods: - - post: create a new post - - get: read posts - - put: update a post - - delete: delete a post - """ - class _CRUD(Resource): - @token_required() - def get(self): - # Find all the posts by the current user - scores = binaryLearningGameScores.query.all() - # Prepare a JSON list of all the posts, uses for loop shortcut called list comprehension - json_ready = [score.read() for score in scores] - # Return a JSON list, converting Python dictionaries to JSON format - return jsonify(json_ready) +# class GeneralAPI: +# """ +# Define the API CRUD endpoints for the Post model. +# There are four operations that correspond to common HTTP methods: +# - post: create a new post +# - get: read posts +# - put: update a post +# - delete: delete a post +# """ +# class _CRUD(Resource): +# @token_required() +# def get(self): +# # Find all the posts by the current user +# scores = binaryLearningGameScores.query.all() +# # Prepare a JSON list of all the posts, uses for loop shortcut called list comprehension +# json_ready = [score.read() for score in scores] +# # Return a JSON list, converting Python dictionaries to JSON format +# return jsonify(json_ready) - """ - Map the _CRUD class to the API endpoints for /post. - - The API resource class inherits from flask_restful.Resource. - - The _CRUD class defines the HTTP methods for the API. - """ - api.add_resource(_CRUD, '/general/binaryScores') \ No newline at end of file +# """ +# Map the _CRUD class to the API endpoints for /post. +# - The API resource class inherits from flask_restful.Resource. +# - The _CRUD class defines the HTTP methods for the API. +# """ +# api.add_resource(_CRUD, '/general/binaryScores') \ No newline at end of file diff --git a/main.py b/main.py index eccc5d5..308c06e 100644 --- a/main.py +++ b/main.py @@ -31,15 +31,13 @@ from api.vote import vote_api from api.lgate import lgate_api # New API's being tested -from api.general import general_api +# from api.general import general_api from api.binaryLearningGame import binaryLearningGameScores_api from api.student import student_api from api.binaryConverter import binary_converter_api from api.vote import vote_api # database Initialization functions -from model.quizgrading import quizgrading -from model.carChat import CarChat from model.user import User, initUsers from model.section import Section, initSections from model.group import Group, initGroups @@ -66,7 +64,6 @@ # apis under development app.register_blueprint(binaryLearningGameScores_api) app.register_blueprint(student_api) -app.register_blueprint(quizgrading_api) app.register_blueprint(commentsAndFeedback_api) app.register_blueprint(binary_converter_api)