Skip to content

Commit

Permalink
fixes indentation and spaces (#2130)
Browse files Browse the repository at this point in the history
  • Loading branch information
geetchoudhary authored and kushthedude committed Sep 27, 2019
1 parent 4f9db59 commit 0bca928
Show file tree
Hide file tree
Showing 104 changed files with 12 additions and 283 deletions.
1 change: 0 additions & 1 deletion autodeploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ def execute(cwd, executable, *args):
out, err = process.communicate()

return process.returncode, str(out, 'utf-8'), str(err, 'utf-8')

1 change: 0 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM python:3-slim
LABEL maintainer="Yash Ladha <[email protected]>"


ENV INSTALL_PATH /badgeyay/api
RUN mkdir -p "$INSTALL_PATH"
RUN PYTHONPATH="$PYTHONPATH:/badgeyay/"
Expand Down
34 changes: 0 additions & 34 deletions backend/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@
from dateutil.relativedelta import relativedelta
import datetime


router = Blueprint('admin', __name__)


@router.route('/settings', methods=['GET'])
@adminRequired
def get_application_settings():
Expand All @@ -57,7 +55,6 @@ def get_application_settings():
settings = Settings.latest_settings()
return jsonify(SettingsSchema().dump(settings).data)


@router.route('/settings', methods=['POST'])
@adminRequired
def post_settings():
Expand All @@ -74,7 +71,6 @@ def post_settings():
settings.save_to_db()
return jsonify(SettingsSchema().dump(settings).data)


@router.route('/messages', methods=['GET'])
def get_messages():
ref = firebasedb.reference('MailTemplate').get()
Expand All @@ -84,7 +80,6 @@ def get_messages():
messages.append(ref[key])
return jsonify(Mails(many=True).dump(messages).data)


@router.route('/messages/<type_>', methods=['PATCH'])
def patch_messages(type_):
data, err = Mails().load(request.get_json())
Expand All @@ -96,7 +91,6 @@ def patch_messages(type_):
ref.set(data)
return jsonify(Mails().dump(tempCopy).data)


@router.route('/show_all_users', methods=['GET'])
@adminRequired
def show_all_users():
Expand All @@ -118,14 +112,12 @@ def show_all_users():
result = schema.dump(users.items)
return jsonify(result.data)


@router.route('/all-modules', methods=['GET'])
@adminRequired
def get_all_modules():
module = Module.query.all()[0]
return jsonify(ModuleSchema().dump(module).data)


@router.route('/all-badge-detail', methods=['GET'])
@adminRequired
def get_all_badge_detail():
Expand All @@ -150,7 +142,6 @@ def get_all_badge_detail():
page, app.config['POSTS_PER_PAGE'], False)
return jsonify(schema.dump(badges.items).data)


@router.route('/all-badge-detail/<badgeId>', methods=['DELETE'])
@adminRequired
def delete_badge(badgeId):
Expand All @@ -162,7 +153,6 @@ def delete_badge(badgeId):
badge.delete_from_db()
return jsonify(DeletedBadges().dump(temp_badge).data)


@router.route('/admin-report', methods=['GET'])
@adminRequired
def get_admin_report():
Expand Down Expand Up @@ -193,7 +183,6 @@ def get_admin_report():
payload.append(report)
return jsonify(schema.dump(payload).data)


@router.route('/all-modules/<id_>', methods=['PATCH'])
@adminRequired
def patch_module(id_):
Expand All @@ -205,7 +194,6 @@ def patch_module(id_):
module.save_to_db()
return jsonify(ModuleSchema().dump(module).data)


@router.route('/show_all_users/<userid>', methods=['PATCH'])
@adminRequired
def update_user(userid):
Expand All @@ -226,7 +214,6 @@ def update_user(userid):
result = schema.dump(user)
return jsonify(result.data)


@router.route('/show_all_users/<userid>', methods=['DELETE'])
@adminRequired
def delete_user(userid):
Expand All @@ -239,7 +226,6 @@ def delete_user(userid):
result = schema.dump(user)
return jsonify(result.data)


@router.route('/admin-stat-mail', methods=['GET'])
@adminRequired
def get_admin_stat():
Expand All @@ -249,7 +235,6 @@ def get_admin_stat():
last_three_days_date = curr_date - relativedelta(days=3)
last_seven_days_date = curr_date - relativedelta(days=7)
last_day_date = curr_date - relativedelta(days=1)

prev_month_cnt = find_mail_count(mail_list, prev_month_date)
last_three_days_cnt = find_mail_count(mail_list, last_three_days_date)
last_day_cnt = find_mail_count(mail_list, last_day_date)
Expand All @@ -264,7 +249,6 @@ def get_admin_stat():

return jsonify(AdminMailStat().dump(payload).data)


def get_mail_list():
mail_ref = firebasedb.reference('mails')
mail_resp = mail_ref.get()
Expand All @@ -277,7 +261,6 @@ def get_mail_list():
item['date'], '%Y-%m-%dT%H:%M:%SZ')
return mail_list


# Finding the successor node from the date passed
def find_mail_count(mail_list, date):
low = 0
Expand All @@ -290,7 +273,6 @@ def find_mail_count(mail_list, date):
low = mid + 1
return len(mail_list[low:])


@router.route('/all-badge', methods=['GET'])
@adminRequired
def all_generated_badges():
Expand All @@ -300,14 +282,12 @@ def all_generated_badges():
'cnt': str(badge_cnt)}
return jsonify(AllGenBadges().dump(dataPayload).data)


@router.route('/all-admin', methods=['GET'])
@adminRequired
def get_all_admin():
admin_users = User.query.filter_by(siteAdmin=True).all()
return jsonify(AllAdminRole(many=True).dump(admin_users).data)


@router.route('/all-role', methods=['GET'])
@adminRequired
def get_all_roles():
Expand All @@ -321,7 +301,6 @@ def get_all_roles():
Permissions.isSales.is_(True)).all()
return jsonify(RoleSchema(many=True).dump(users).data)


@router.route('/all-user', methods=['GET'])
@adminRequired
def all_users_stat():
Expand All @@ -333,7 +312,6 @@ def all_users_stat():
'registered': str(reg_users)}
return jsonify(AllUserStat().dump(payload).data)


@router.route('/get_all_badges', methods=['GET'])
@loginRequired
def get_all_badges():
Expand All @@ -344,7 +322,6 @@ def get_all_badges():
result = schema.dump(all_badges)
return jsonify(result.data)


@router.route('/get_all_files', methods=['GET'])
@loginRequired
def get_all_files():
Expand All @@ -353,7 +330,6 @@ def get_all_files():
page, app.config['POSTS_PER_PAGE'], False).items
return jsonify(FileSchema(many=True).dump(files).data)


@router.route('/register_admin', methods=['POST'])
@adminRequired
def register_admin():
Expand All @@ -371,7 +347,6 @@ def register_admin():
else:
return ErrorResponse(JsonNotFound().message, 422, {'Content-Type': 'application/json'}).respond()


@router.route('/delete-admin', methods=['GET'])
@adminRequired
def delete_admin():
Expand All @@ -387,7 +362,6 @@ def delete_admin():
user.save_to_db()
return jsonify(DeleteAdminRole().dump(user).data)


@router.route('/register_sales', methods=['POST'])
@adminRequired
def register_sales():
Expand All @@ -404,7 +378,6 @@ def register_sales():
else:
return ErrorResponse(JsonNotFound().message, 422, {'Content-Type': 'application/json'}).respond()


@router.route('/delete-sales', methods=['GET'])
@adminRequired
def delete_sales():
Expand All @@ -420,7 +393,6 @@ def delete_sales():
user.save_to_db()
return jsonify(DeleteSales().dump(user).data)


@router.route('/add_usage', methods=['POST'])
@loginRequired
def admin_add_usage():
Expand All @@ -438,7 +410,6 @@ def admin_add_usage():

return jsonify(UserAllowedUsage().dump(user).data)


@router.route('/get_badges_dated', methods=['POST'])
def get_badges_dated():
schema = DatedBadgeSchema()
Expand All @@ -450,7 +421,6 @@ def get_badges_dated():
'end_date')).filter(Badges.created_at >= data.get('start_date'))
return jsonify(AllBadges(many=True).dump(dated_badges).data)


@router.route('/get_users_dated', methods=['POST'])
def get_user_dated():
schema = DatedUserSchema()
Expand All @@ -462,7 +432,6 @@ def get_user_dated():
'end_date')).filter(User.created_at >= data.get('start_date'))
return jsonify(AllUsersSchema(many=True).dump(dated_users).data)


@router.route('/set_pricing', methods=['POST'])
@adminRequired
def set_pricing():
Expand All @@ -481,7 +450,6 @@ def set_pricing():
}
return jsonify(ReturnSetPricing().dump(ret_data).data)


@router.route('/get_pricing', methods=['GET'])
@adminRequired
def get_pricing():
Expand All @@ -493,13 +461,11 @@ def get_pricing():
}
return jsonify(ReturnSetPricing().dump(ret_data).data)


@router.route('/social-media', methods=['GET'])
def get_all_social_media():
social_media = SocialContent.query.all()
return jsonify(SocialMedia(many=True).dump(social_media).data)


@router.route('/social-media/<media>', methods=['PATCH'])
def patch_social_media(media):
social_media = SocialContent.check_key(media)
Expand Down
2 changes: 0 additions & 2 deletions backend/controllers/assetHelper.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os

from backend.config import config
from flask import Blueprint, jsonify
from backend.helpers.verifyToken import loginRequired

router = Blueprint('assethelper', __name__)


@router.route('/default_images', methods=['GET'])
@loginRequired
def getDefaultBackgrounds():
Expand Down
2 changes: 0 additions & 2 deletions backend/controllers/changeMeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from flask import current_app as app
from flask import Blueprint, jsonify, request
from werkzeug.security import generate_password_hash

from backend.models.user import User
from backend.schemas.errors import PayloadNotFound, SignatureExpired, PasswordNotFound
from backend.utils.errors import ErrorResponse
Expand All @@ -11,7 +10,6 @@

router = Blueprint('Change Meta', __name__)


@router.route('/password', methods=['POST'])
def changePwd():
try:
Expand Down
4 changes: 0 additions & 4 deletions backend/controllers/changePermissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from backend.utils.errors import ErrorResponse
from backend.schemas.permissions import ModifyPermissionsIncoming, ModifyPermissionsDone


router = Blueprint('changePermissions', __name__)


@router.route('/add/user', methods=['POST'])
def add_as_user():
schema = ModifyPermissionsIncoming()
Expand All @@ -33,7 +31,6 @@ def add_as_user():

return jsonify(ModifyPermissionsDone().dump(user_permissions).data)


@router.route('/add/sales', methods=['POST'])
def add_as_sales():
schema = ModifyPermissionsIncoming()
Expand All @@ -58,7 +55,6 @@ def add_as_sales():

return jsonify(ModifyPermissionsDone().dump(user_permissions).data)


@router.route('/add/admin', methods=['POST'])
def add_as_admin():
schema = ModifyPermissionsIncoming()
Expand Down
2 changes: 0 additions & 2 deletions backend/controllers/errorHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@

router = Blueprint('errorHandler', __name__)


@router.app_errorhandler(404)
def handle_404(err):
return jsonify(
Response(404).generateMessage(
str(err)))


@router.app_errorhandler(500)
def handle_500(err):
return jsonify(
Expand Down
2 changes: 0 additions & 2 deletions backend/controllers/exportData.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
FileNotFound
)


router = Blueprint('exportData', __name__)


@router.route('/csv/data', methods=['GET'])
def export_data():
input_data = request.args
Expand Down
Loading

0 comments on commit 0bca928

Please sign in to comment.