-
Notifications
You must be signed in to change notification settings - Fork 1
Chat Sharing #200
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
base: dev
Are you sure you want to change the base?
Chat Sharing #200
Conversation
| def get_all_team_members_by_project(project_id: str) -> List[User]: | ||
| query = ( | ||
| session.query(User) | ||
| .join(TeamMember, TeamMember.user_id == User.id) |
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 we only want the user_id here so not needed to join with user or is this used for something else as well?
| ) | ||
|
|
||
|
|
||
| def get_by_conversation(conversation_id: str) -> List[ConversationGlobalShare]: |
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.
return type doesn't fit
| if with_commit: | ||
| session.commit() |
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.
general.flush_or_commit(with_commit)
| session.commit() | ||
|
|
||
|
|
||
| def get_by_user(project_id: str, user_id: str) -> List[ConversationGlobalShare]: |
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.
return type
|
|
||
| for share in existing_shares: | ||
| if share.shared_with not in shared_with_set: | ||
| session.delete(share) |
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.
we usually dont use the session object directly for this
| shares = [] | ||
|
|
||
| for user_id in shared_with_user_ids: | ||
| share = ConversationShare( | ||
| conversation_id=conversation_id, | ||
| shared_with=user_id, | ||
| shared_by=shared_by, | ||
| can_copy=can_copy, | ||
| ) | ||
| general.add(share, with_commit=False) | ||
| shares.append(share) | ||
|
|
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.
| shares = [] | |
| for user_id in shared_with_user_ids: | |
| share = ConversationShare( | |
| conversation_id=conversation_id, | |
| shared_with=user_id, | |
| shared_by=shared_by, | |
| can_copy=can_copy, | |
| ) | |
| general.add(share, with_commit=False) | |
| shares.append(share) | |
| general.add_all([ConversationShare( | |
| conversation_id=conversation_id, | |
| shared_with=user_id, | |
| shared_by=shared_by, | |
| can_copy=can_copy, | |
| ) for user_id in shared_with_user_ids, with_commit=True) | |
Main PR:
https://github.com/code-kern-ai/cognition-gateway/pull/277