from flask import Flask import config import utils.response as response import service.faker_data as faker from base import db from flasgger import Swagger, swag_from app = Flask(__name__) config.init_config(app) db.init_app(app) swagger = Swagger(app) @app.route('/') def hello_world(): return f'

nConTrack_Faker

' @app.route("/faker/railway/") def faker_railway(number): """Faker Railway Datas --- parameters: - name: number in: path type: number required: true description: the number of to be generated responses: 200: description: A list of railway """ return response.succ(faker.faker_railways(int(number))) @app.route("/faker/hotel/") def faker_hotel(number): """Faker Hotel Datas --- parameters: - name: number in: path type: number required: true description: the number of to be generated responses: 200: description: A list of hotel """ return response.succ(faker.faker_hotels(int(number))) @app.route("/faker/contacts//") def faker_contacts(num_hotel, num_railway): """Faker Contacts Datas --- parameters: - name: num_hotel in: path type: number required: true description: the number of hotel to be generated - name: num_railway in: path type: number required: true description: the number of railway to be generated responses: 200: description: the contacts and patient """ return response.succ(faker.faker_contacts(int(num_hotel), int(num_railway))) @app.route("/query/patient") def query_patient(): """Query Patients --- responses: 200: description: A list of patients """ return response.succ(faker.query_patients()) @app.route("/query/contacts/hotel/") def query_contacts_hotel(identification): """Query Hotel Contacts by Patient's Identification --- parameters: - name: identification in: path type: number required: true description: the identification of patient responses: 200: description: A list of contacts """ return response.succ(faker.query_contacts_hotel(identification)) @app.route("/query/contacts/railway/") def query_contacts_railway(identification): """Query Railway Contacts by Patient's Identification --- parameters: - name: identification in: path type: number required: true description: the identification of patient responses: 200: description: A list of contacts """ return response.succ(faker.query_contacts_railway(identification)) @app.route("/query/contacts/classify/") def query_contacts_classify(identification): """Query Classified Hotel and Railway Contacts by Patient's Identification --- parameters: - name: identification in: path type: number required: true description: the identification of patient responses: 200: description: A list of contacts """ return response.succ(faker.query_contacts_classify(identification)) @app.route("/query/contacts/") def query_contacts(identification): """Query All Contacts by Patient's Identification --- parameters: - name: identification in: path type: number required: true description: the identification of patient responses: 200: description: A list of contacts """ return response.succ(faker.query_contacts(identification)) if __name__ == '__main__': app.run(host='0.0.0.0')