44 lines
978 B
Python
44 lines
978 B
Python
from flask import Flask
|
|
import config
|
|
import utils.response as response
|
|
import service.faker_data as faker
|
|
from base import db
|
|
from model import Person, SexEnum, City, Hotel
|
|
from sqlalchemy import select, join
|
|
|
|
app = Flask(__name__)
|
|
config.init_config(app)
|
|
db.init_app(app)
|
|
|
|
|
|
@app.route('/')
|
|
def hello_world(): # put application's code here
|
|
print(SexEnum(1).sex)
|
|
return 'Hello World!'
|
|
|
|
|
|
@app.route("/faker/railway/<number>")
|
|
def faker_railway(number):
|
|
return response.succ(faker.faker_railways(int(number)))
|
|
|
|
|
|
@app.route("/faker/hotel/<number>")
|
|
def faker_hotel(number):
|
|
return response.succ(faker.faker_hotels(int(number)))
|
|
|
|
|
|
@app.route("/faker/contacts/<num_hotel>/<num_railway>")
|
|
def faker_contacts(num_hotel, num_railway):
|
|
return response.succ(faker.faker_contacts(int(num_hotel), int(num_railway)))
|
|
|
|
|
|
@app.route("/test")
|
|
def test():
|
|
print(
|
|
select(Hotel.identification).
|
|
join(Hotel, )
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
app.run()
|