Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column: TableTN #61 #78

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Column: TableTN #61 #78

wants to merge 5 commits into from

Conversation

Mikefrfr
Copy link

@Mikefrfr Mikefrfr commented Feb 22, 2025

feat: Add teamTN API endpoint

-Added table_tn (optional integer) column to the Team model.
-Implemented POST /team/{id} admin route to upsert the table_tn value.
-Included input validation (TableTNBody model) for the new API endpoint.
-Added bcrypt hashing for secure password storage
-Updated API endpoints to require admin_password
-Ensured compatibility with existing team logic

Closes #61

@Mikefrfr Mikefrfr marked this pull request as ready for review February 23, 2025 11:02
@Mikefrfr Mikefrfr requested a review from ThEditor February 28, 2025 10:00
@Mikefrfr Mikefrfr marked this pull request as draft February 28, 2025 10:05
@Mikefrfr Mikefrfr marked this pull request as ready for review February 28, 2025 10:10
Copy link

@ThEditor ThEditor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more changes that expected.
The only required change was

if not bcrypt.verify(admin_password, ADMIN_HASH):
        response.status_code = 401

also ADMIN_HASH is a constant defined in admin.py, you need to import it into team.py before using it.

@Mikefrfr Mikefrfr marked this pull request as draft March 6, 2025 06:01
@Mikefrfr Mikefrfr marked this pull request as ready for review March 6, 2025 06:24
@Mikefrfr Mikefrfr requested a review from ThEditor March 6, 2025 06:30
Comment on lines 162 to 177
response.status_code = 401
return {"msg_code": "not_authorized"}

team = await Team.get_or_none(id=id)
if not team:
response.status_code = 404
return {"msg_code": "team_not_found"}

try:
team.table_tn = data.table_tn
await team.save()
except Exception:
response.status_code = 500
return {"msg_code": "db_error"}

return {"msg_code": "tabletn_upserted"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines were NOT meant to be removed.

@Mikefrfr Mikefrfr requested a review from ThEditor March 6, 2025 07:07
Copy link

@ThEditor ThEditor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ThEditor ThEditor requested a review from KreativeThinker March 6, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Column: TableTN
3 participants