-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 在安装 GitHub App 的时候注册仓库
- Loading branch information
Showing
4 changed files
with
85 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
import json | ||
from dao.BaseDAO import BaseDAO | ||
from models.repository import RepositoryConfig | ||
from supabase.client import Client, create_client | ||
|
||
from petercat_utils.db.client.supabase import get_client | ||
|
||
class RepositoryConfigDAO(BaseDAO): | ||
client: Client | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.client = get_client() | ||
|
||
def create(self, data: RepositoryConfig): | ||
print('supabase github_repo_config creation', data.model_dump()) | ||
try: | ||
authorization = self.client.from_("github_repo_config")\ | ||
.insert(data.model_dump())\ | ||
.execute() | ||
if authorization: | ||
return True, {"message": "GithubRepoConfig created successfully"} | ||
else: | ||
return False, {"message": "GithubRepoConfig creation failed"} | ||
except Exception as e: | ||
print("Error: ", e) | ||
return False, {"message": "GithubRepoConfig creation failed"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from datetime import datetime | ||
from typing import Optional | ||
from pydantic import BaseModel | ||
|
||
class RepositoryConfig(BaseModel): | ||
repo_name: str | ||
robot_id: Optional[str] | ||
created_at: datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters