Skip to content

Commit

Permalink
fix: fix nested ids and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Spotika committed Sep 25, 2024
1 parent dde4289 commit 3bd43c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/db/methods/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def add_member(organization_id: int, member: types.Member, session: ClientSessio

organizations.update_one(
{"_id": organization_id},
{"$push": {"members": member.db_dump()}},
{"$push": {"members": member.model_dump()}},
session=session,
)

Expand Down
6 changes: 6 additions & 0 deletions src/routers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ async def invite_user_to_organization(
message="You are not a member of this organization",
)

if methods.organizations.is_user_in_organization(request.user_id, request.organization_id, session):
raise ErrorResponse(
code=ErrorCodes.USER_ALREADY_MEMBER,
message="User already in organization",
)

methods.organizations.add_member(request.organization_id, types.Member(id=request.user_id), session)

0 comments on commit 3bd43c2

Please sign in to comment.