Skip to content
Snippets Groups Projects
Commit 1e1c0d50 authored by Radek's avatar Radek
Browse files

added item class

parent 4a42edf9
No related branches found
No related tags found
No related merge requests found
Pipeline #13074 failed
......@@ -3,6 +3,7 @@ importlib-metadata
# Framework and libraries
flask
flask-restful
python-dotenv
# Git hooks
......
......@@ -18,9 +18,14 @@ from flask import (
request,
)
from flask_restful import Resource, Api
import src.tjts5901.backend.rest_teplates.item as auction_item
from .utils import get_version
def create_app(config: Optional[Dict] = None) -> Flask:
"""
Application factory for creating a new Flask instance.
......@@ -48,6 +53,11 @@ load_dotenv()
# Create the Flask application.
app = create_app()
#create flast restapi
api = Api(app)
#added auction item resource
api.add_resource(auction_item.AuctionItem, "/auction_item")
# Initialize "rich" output if enabled. It produces more human readable logs.
# You need to install `flask-rich` to use this.
......
from flask import request, jsonify
from flask_restful import Resource
class AuctionItem (Resource):
"""Auction item class that will for handling this object
Args:
Resource (_type_): _description_
"""
def get(self):
#TODO: connection with db
return jsonify({"message" : "trust me I work!"})
def post(self):
#TODO: connection with db
auction_item = request.get_json()
return jsonify({'data' : auction_item}), 201
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment