Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf

This commit fixes the style issues introduced in 9746187 according to the output
from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java
Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt,
Scalafmt, StandardJS, StandardRB, swift-format and Yapf.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored May 10, 2024
1 parent 9746187 commit 52b21f4
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions api/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
from flask import Blueprint, request, jsonify
from flask import Blueprint, jsonify, request

from .authentication import jwt_required
from .serializers import UserSchema, TransactionSchema
from .serializers import TransactionSchema, UserSchema

endpoints = Blueprint("endpoints", __name__)

endpoints = Blueprint('endpoints', __name__)

@endpoints.route('/users', methods=['POST'])
@endpoints.route("/users", methods=["POST"])
def create_user():
user_schema = UserSchema()
user = user_schema.load(request.get_json())
# Create user in the database
return user_schema.jsonify(user), 201

@endpoints.route('/users/<int:user_id>', methods=['GET'])

@endpoints.route("/users/<int:user_id>", methods=["GET"])
@jwt_required()
def get_user(user_id):
user = get_user_from_database(user_id)
user_schema = UserSchema()
return user_schema.jsonify(user)

@endpoints.route('/users/<int:user_id>', methods=['PUT'])

@endpoints.route("/users/<int:user_id>", methods=["PUT"])
@jwt_required()
def update_user(user_id):
user = get_user_from_database(user_id)
Expand All @@ -27,36 +31,41 @@ def update_user(user_id):
# Update user in the database
return user_schema.jsonify(user)

@endpoints.route('/users/<int:user_id>', methods=['DELETE'])

@endpoints.route("/users/<int:user_id>", methods=["DELETE"])
@jwt_required()
def delete_user(user_id):
user = get_user_from_database(user_id)
# Delete user from the database
return '', 204
return "", 204

@endpoints.route('/transactions', methods=['POST'])

@endpoints.route("/transactions", methods=["POST"])
@jwt_required()
def create_transaction():
transaction_schema = TransactionSchema()
transaction = transaction_schema.load(request.get_json())
# Create transaction in the database
return transaction_schema.jsonify(transaction), 201

@endpoints.route('/transactions', methods=['GET'])

@endpoints.route("/transactions", methods=["GET"])
@jwt_required()
def get_transactions():
transactions = get_transactions_from_database()
transaction_schema = TransactionSchema(many=True)
return transaction_schema.jsonify(transactions)

@endpoints.route('/transactions/<int:transaction_id>', methods=['GET'])

@endpoints.route("/transactions/<int:transaction_id>", methods=["GET"])
@jwt_required()
def get_transaction(transaction_id):
transaction = get_transaction_from_database(transaction_id)
transaction_schema = TransactionSchema()
return transaction_schema.jsonify(transaction)

@endpoints.route('/transactions/<int:transaction_id>', methods=['PUT'])

@endpoints.route("/transactions/<int:transaction_id>", methods=["PUT"])
@jwt_required()
def update_transaction(transaction_id):
transaction = get_transaction_from_database(transaction_id)
Expand All @@ -65,9 +74,10 @@ def update_transaction(transaction_id):
# Update transaction in the database
return transaction_schema.jsonify(transaction)

@endpoints.route('/transactions/<int:transaction_id>', methods=['DELETE'])

@endpoints.route("/transactions/<int:transaction_id>", methods=["DELETE"])
@jwt_required()
def delete_transaction(transaction_id):
transaction = get_transaction_from_database(transaction_id)
# Delete transaction from the database
return '', 204
return "", 204

0 comments on commit 52b21f4

Please sign in to comment.