Skip to content

Commit

Permalink
(backend) linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Alexandre35 committed Oct 27, 2024
1 parent 8994382 commit 986d496
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
17 changes: 16 additions & 1 deletion travian/backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions travian/backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ python-jose = "^3.3.0"
[tool.poetry.group.dev.dependencies]
flake8 = "^6.0.0"
black = "^24.10.0"
autopep8 = "^2.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 1 addition & 1 deletion travian/backend/src/db/schemas/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ class UserAuth(BaseModel):
class UserJWTToken(BaseModel):
"""current authenticated User data stored in the JWT Web Token"""

id: str ##UUID
id: str # UUID
email: str
2 changes: 1 addition & 1 deletion travian/backend/src/db/services/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def create_coordonates(
session: Database, position: schemas.map.MapPosition, crop_type_id: int
):
sql = """
INSERT INTO positions (x_pos, y_pos, is_empty, crop_type_id)
INSERT INTO positions (x_pos, y_pos, is_empty, crop_type_id)
VALUES (%s, %s, %s, %s)
"""
params = (position.x_pos, position.y_pos, position.is_empty, crop_type_id)
Expand Down
8 changes: 4 additions & 4 deletions travian/backend/src/db/services/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create_user(
is_active = True
is_superuser = False
sql = """
INSERT INTO transactions.users (uuid, email, active, superuser, created_on, password, password_salt, tribe_id)
INSERT INTO transactions.users (uuid, email, active, superuser, created_on, password, password_salt, tribe_id)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
"""
params = (
Expand All @@ -33,8 +33,8 @@ def create_user(

def user_exits(session: Database, email: str) -> bool:
sql = """
SELECT COUNT(id)
FROM transactions.users
SELECT COUNT(id)
FROM transactions.users
WHERE email = (%s)
"""
params = [email]
Expand All @@ -45,7 +45,7 @@ def user_exits(session: Database, email: str) -> bool:
def get_user_by_email(session: Database, email: str) -> user_schemas.UserAuth:
sql = """
SELECT id, uuid, email, password, password_salt
FROM transactions.users
FROM transactions.users
WHERE email = (%s)
"""
params = [email]
Expand Down
12 changes: 6 additions & 6 deletions travian/backend/src/db/services/village.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
def get_user_villages(session: Database, user_id: int) -> village_schemas.UserVillages:
print(user_id)
sql = """
SELECT
SELECT
villages.id,
villages.name,
villages.owner_id,
villages.position_id,
villages.population
FROM
transactions.villages as villages
LEFT JOIN
master.map as map
LEFT JOIN
master.map as map
ON villages.position_id = map.id
WHERE
villages.owner_id = (%s)
Expand All @@ -40,7 +40,7 @@ def create_village(
) -> int:
# SQL statement with the RETURNING clause to get the newly generated id
sql = """
INSERT INTO transactions.villages (name, population, owner_id, position_id)
INSERT INTO transactions.villages (name, population, owner_id, position_id)
VALUES (%s, %s, %s, %s)
RETURNING id
"""
Expand All @@ -66,8 +66,8 @@ def get_village_infos(
session: Database,
):
sql = """
SELECT name, population, owner_id, position_id
FROM villages
SELECT name, population, owner_id, position_id
FROM villages
WHERE village_id = (%s)
"""
params = [village_id]
Expand Down

0 comments on commit 986d496

Please sign in to comment.