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

feat: Link Datadoc to GitHub Directory #7

Merged
merged 6 commits into from
Oct 30, 2024
Merged

Conversation

zhangvi7
Copy link
Owner

@zhangvi7 zhangvi7 commented Oct 23, 2024

Context

  • After users complete OAuth flow and have their GitHub token, they can link the datadoc to GitHub directory
  • Directory will be used for push commits, and version control on this datadoc
  • Users OAuth token needs read permissions for the linked repository to view commits and write permissions for the repository to push/restore a commit

Changes

  • DS: new endpoint to create GH Link
  • DB: Added new data model to store GitHub link
  • Logic: get and create_github_link()

Depends on PR: pinterest#1497

@zhangvi7 zhangvi7 force-pushed the github/datadoc-link branch from b4d0a3e to 2ff8786 Compare October 24, 2024 01:36
@zhangvi7 zhangvi7 changed the title Github/datadoc-link feat: Link Datadoc to GitHub Directory Oct 24, 2024
@zhangvi7 zhangvi7 marked this pull request as ready for review October 24, 2024 20:49
datadoc_id = sql.Column(
sql.Integer, sql.ForeignKey("data_doc.id"), nullable=False, unique=True
)
user_id = sql.Column(sql.Integer, sql.ForeignKey("user.id"), nullable=False)

Choose a reason for hiding this comment

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

what is this user_id for ? is it the doc owner or the first user commits the datadoc?

Copy link
Owner Author

Choose a reason for hiding this comment

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

its the user who links the current GitHubs directory to the datadoc



@with_session
def create_repo_link(

Choose a reason for hiding this comment

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

realized that, do we allow user to unlink a datadoc, or change the directory of the doc?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yep, plan to add support for it later on, with maybe a warning saying it will change version history

@zhangvi7 zhangvi7 requested a review from jczhong84 October 29, 2024 16:19
@zhangvi7 zhangvi7 force-pushed the github/datadoc-link branch from 2ff8786 to daa18d2 Compare October 29, 2024 16:19
@zhangvi7 zhangvi7 merged commit 866e733 into github/oauth Oct 30, 2024
@zhangvi7 zhangvi7 deleted the github/datadoc-link branch October 30, 2024 14:20
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.

2 participants