Skip to content

Commit

Permalink
feat: remove permissions to check group expenses inactive user
Browse files Browse the repository at this point in the history
  • Loading branch information
RezenkovD committed Jan 24, 2024
1 parent 68d3820 commit ac2c867
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/services/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ def group_member_validate_input_data(

def read_group_history(db: Session, user_id: int, group_id: int) -> List[GroupHistory]:
user_validate_input_date(db, user_id, group_id)
try:
(
db.query(UserGroup)
.filter_by(
user_id=user_id,
group_id=group_id,
status=GroupStatusEnum.ACTIVE,
)
.one()
)
except exc.NoResultFound:
raise HTTPException(
status_code=status.HTTP_405_METHOD_NOT_ALLOWED,
detail="The user is not active in this group!",
)
history = (
select(
Expense.id,
Expand Down

0 comments on commit ac2c867

Please sign in to comment.