2020-03-23 21:17:16 +01:00
|
|
|
from flask import request, jsonify
|
2020-04-15 00:29:59 +02:00
|
|
|
from database.crud import insert_data
|
2020-03-23 21:17:16 +01:00
|
|
|
from external.twilio import send_otp
|
|
|
|
from app import app
|
|
|
|
|
|
|
|
|
2020-04-15 00:29:59 +02:00
|
|
|
@app.route("/register", methods=["POST"])
|
2020-04-02 19:33:04 +02:00
|
|
|
def create_user():
|
2020-03-23 21:17:16 +01:00
|
|
|
data = request.get_json()
|
2020-04-15 00:29:59 +02:00
|
|
|
insert_data(schema="Users", data=data)
|
|
|
|
send_otp(receiver=data["mobile"])
|
2020-03-23 21:17:16 +01:00
|
|
|
return jsonify("User created, pending OTP verification")
|