-
Notifications
You must be signed in to change notification settings - Fork 8
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
Sync group with association's membership #631
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #631 +/- ##
==========================================
+ Coverage 81.31% 81.35% +0.04%
==========================================
Files 129 129
Lines 10013 10030 +17
==========================================
+ Hits 8142 8160 +18
+ Misses 1871 1870 -1 ☔ View full report in Codecov by Sentry. |
membership_db = models_core.CoreMembership( | ||
user_id=member.user_id, | ||
group_id=group_id, | ||
description="", | ||
) | ||
await cruds_groups.create_membership(db=db, membership=membership_db) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a bulk insert operation
https://docs.sqlalchemy.org/en/20/orm/queryguide/dml.html#orm-queryguide-bulk-insert
@@ -304,3 +305,43 @@ async def delete_group( | |||
|
|||
await cruds_groups.delete_membership_by_group_id(group_id=group_id, db=db) | |||
await cruds_groups.delete_group(db=db, group_id=group_id) | |||
|
|||
|
|||
@router.patch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a post could be more appropriate as it start an action
|
||
group_db = await cruds_groups.get_group_by_id(group_id=group_id, db=db) | ||
if group_db is None: | ||
raise HTTPException(status_code=404, detail="Group not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you test this line?
Description
Please explain the changes you made here.
Checklist