Added room controller
Added async server Added CORS
This commit is contained in:
parent
b761372e96
commit
50fd053186
@ -7,6 +7,6 @@ RUN pip3 install -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ENV FLASK_APP=src/main.py
|
ENV FLASK_APP=src/app.py
|
||||||
|
|
||||||
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0", "--port=5000"]
|
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0", "--port=5004"]
|
@ -1,14 +1,17 @@
|
|||||||
annotated-types==0.7.0
|
annotated-types==0.7.0
|
||||||
bidict==0.23.1
|
bidict==0.23.1
|
||||||
blinker==1.8.2
|
blinker==1.8.2
|
||||||
bson==0.5.10
|
bson==0.5.10
|
||||||
click==8.1.8
|
click==8.1.8
|
||||||
colorama==0.4.6
|
colorama==0.4.6
|
||||||
dnspython==2.7.0
|
dnspython==2.7.0
|
||||||
email_validator==2.2.0
|
email_validator==2.2.0
|
||||||
|
eventlet==0.39.1
|
||||||
Flask==3.0.3
|
Flask==3.0.3
|
||||||
|
Flask-Cors==5.0.0
|
||||||
Flask-JWT-Extended==4.7.1
|
Flask-JWT-Extended==4.7.1
|
||||||
Flask-SocketIO==5.5.1
|
Flask-SocketIO==5.5.1
|
||||||
|
greenlet==3.1.1
|
||||||
h11==0.14.0
|
h11==0.14.0
|
||||||
idna==3.10
|
idna==3.10
|
||||||
importlib_metadata==8.5.0
|
importlib_metadata==8.5.0
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from flask_cors import CORS
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
from flask_jwt_extended import JWTManager
|
from flask_jwt_extended import JWTManager
|
||||||
|
|
||||||
@ -8,11 +9,14 @@ from infra.server import app, socketio
|
|||||||
from controllers.user_controller import user_blueprint
|
from controllers.user_controller import user_blueprint
|
||||||
from controllers.reservation_controller import reservation_blueprint
|
from controllers.reservation_controller import reservation_blueprint
|
||||||
from controllers.health_controller import health_blueprint
|
from controllers.health_controller import health_blueprint
|
||||||
|
from controllers.room_controller import room_blueprint
|
||||||
|
|
||||||
|
CORS(app)
|
||||||
app.config['JWT_SECRET_KEY'] = Config.JWT_SECRET_KEY
|
app.config['JWT_SECRET_KEY'] = Config.JWT_SECRET_KEY
|
||||||
|
|
||||||
app.register_blueprint(user_blueprint, url_prefix='/user')
|
app.register_blueprint(user_blueprint, url_prefix='/user')
|
||||||
app.register_blueprint(reservation_blueprint, url_prefix='/reservation')
|
app.register_blueprint(reservation_blueprint, url_prefix='/reservation')
|
||||||
|
app.register_blueprint(room_blueprint, url_prefix='/room')
|
||||||
app.register_blueprint(health_blueprint, url_prefix='/health')
|
app.register_blueprint(health_blueprint, url_prefix='/health')
|
||||||
|
|
||||||
jwt = JWTManager(app)
|
jwt = JWTManager(app)
|
||||||
@ -26,4 +30,4 @@ else:
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#app.run(debug=True)
|
#app.run(debug=True)
|
||||||
socketio.run(app, debug=False)
|
socketio.run(app, host="192.168.1.178", debug=False)
|
||||||
|
13
src/controllers/room_controller.py
Normal file
13
src/controllers/room_controller.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from flask import Blueprint, request, jsonify
|
||||||
|
|
||||||
|
room_blueprint = Blueprint('room', __name__)
|
||||||
|
|
||||||
|
@room_blueprint.route('/', methods=['GET'])
|
||||||
|
#@jwt_required()
|
||||||
|
def list_rooms():
|
||||||
|
return jsonify([
|
||||||
|
{"id": "67d28e7004bda1d7130c9825", "title": "Маркетинг"},
|
||||||
|
{"id": "67d28e7004bda1d7130c9826", "title": "Green"},
|
||||||
|
{"id": "67d28e7004bda1d7130c9827", "title": "Конференц-зал"},
|
||||||
|
{"id": "67d28e7004bda1d7130c9828", "title": "Dipal"}
|
||||||
|
])
|
@ -1,4 +1,3 @@
|
|||||||
class Room:
|
class Room:
|
||||||
def __init__(self, title, office_id):
|
def __init__(self, title, office_id):
|
||||||
self.title = title
|
self.title = title
|
||||||
self.office_id = office_id
|
|
Loading…
x
Reference in New Issue
Block a user