39 lines
786 B
Python
39 lines
786 B
Python
|
from flask import jsonify
|
||
|
from flask_jwt_extended import jwt_required
|
||
|
from flask_cors import cross_origin
|
||
|
|
||
|
from . import api_v1
|
||
|
|
||
|
|
||
|
USER_DATA = [
|
||
|
{"id": 1, "email": "john@doe.com", "name": "John Doe", "status": "active", "last_login": "2021-08-03T07:40:51+00:00"}
|
||
|
]
|
||
|
|
||
|
|
||
|
@api_v1.route('/users', methods=['GET'])
|
||
|
@jwt_required()
|
||
|
@cross_origin()
|
||
|
def get_users():
|
||
|
return jsonify(USER_DATA)
|
||
|
|
||
|
|
||
|
@api_v1.route('/users', methods=['POST'])
|
||
|
@jwt_required()
|
||
|
@cross_origin()
|
||
|
def post_user():
|
||
|
return jsonify(USER_DATA), 201
|
||
|
|
||
|
|
||
|
@api_v1.route('/users/<int:id>', methods=['PUT'])
|
||
|
@jwt_required()
|
||
|
@cross_origin()
|
||
|
def put_user(id):
|
||
|
return jsonify(USER_DATA)
|
||
|
|
||
|
|
||
|
@api_v1.route('/users/<int:id>', methods=['DELETE'])
|
||
|
@jwt_required()
|
||
|
@cross_origin()
|
||
|
def delete_user(id):
|
||
|
return jsonify(USER_DATA)
|