From 6ec3e7a1e3b8a5949b9cd860dfab4eb1afe16827 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Fri, 20 Aug 2021 01:25:33 +0800 Subject: [PATCH] :alembic: add project card api preview --- src/libs/github/models/issue.py | 5 +++-- src/libs/github/models/timeline.py | 13 ++++++++++++- .../github/libs/issue/templates/add-to-project.html | 6 ++++-- .../issue/templates/move-columns-in-project.html | 8 ++++++-- .../libs/issue/templates/remove-from-project.html | 6 ++++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/libs/github/models/issue.py b/src/libs/github/models/issue.py index b2f81ef..1d87ba2 100644 --- a/src/libs/github/models/issue.py +++ b/src/libs/github/models/issue.py @@ -4,7 +4,7 @@ @Author : yanyongyu @Date : 2021-03-11 16:57:04 @LastEditors : yanyongyu -@LastEditTime : 2021-08-20 01:10:46 +@LastEditTime : 2021-08-20 01:11:35 @Description : None @GitHub : https://github.com/yanyongyu """ @@ -95,7 +95,8 @@ class Issue(BaseModel): https://docs.github.com/en/rest/reference/issues#list-timeline-events-for-an-issue """ headers = { - "Accept": "application/vnd.github.mockingbird-preview.full+json" + "Accept": "application/vnd.github.mockingbird-preview.full+json, " + "application/vnd.github.starfox-preview+json" } return PaginatedList( Union[TimelineEventCommited, TimelineEventForcePushed, diff --git a/src/libs/github/models/timeline.py b/src/libs/github/models/timeline.py index 565d5cd..249c94b 100644 --- a/src/libs/github/models/timeline.py +++ b/src/libs/github/models/timeline.py @@ -4,7 +4,7 @@ @Author : yanyongyu @Date : 2021-05-14 00:57:33 @LastEditors : yanyongyu -@LastEditTime : 2021-08-20 00:46:20 +@LastEditTime : 2021-08-20 01:15:57 @Description : None @GitHub : https://github.com/yanyongyu """ @@ -314,12 +314,22 @@ class TimelineEventClosed(TimelineEvent): # Issue Added to Project +class TimelineEventProjectCard(_BaseModel): + id: int + url: str + project_id: int + project_url: str + column_name: str + previous_column_name: str = "" + + class TimelineEventAddedToProject(TimelineEvent): event: Literal["added_to_project"] id: int node_id: str url: str actor: Actor + project_card: TimelineEventProjectCard commit_id: Optional[str] commit_url: Optional[str] created_at: datetime @@ -344,6 +354,7 @@ class TimelineEventRemovedFromProject(TimelineEvent): node_id: str url: str actor: Actor + project_card: TimelineEventProjectCard commit_id: Optional[str] commit_url: Optional[str] created_at: datetime diff --git a/src/plugins/github/libs/issue/templates/add-to-project.html b/src/plugins/github/libs/issue/templates/add-to-project.html index 5d4e052..d5486a4 100644 --- a/src/plugins/github/libs/issue/templates/add-to-project.html +++ b/src/plugins/github/libs/issue/templates/add-to-project.html @@ -2,7 +2,7 @@ * @Author : yanyongyu * @Date : 2021-05-22 14:57:58 * @LastEditors : yanyongyu - * @LastEditTime : 2021-05-25 20:56:50 + * @LastEditTime : 2021-08-20 01:18:27 * @Description : None * @GitHub : https://github.com/yanyongyu --> @@ -33,7 +33,9 @@ /> {{ event.actor.login|escape }} - added this to project + added this to + {{ event.project_card.column_name|escape }} + in project {{ event.created_at|relative_time }} diff --git a/src/plugins/github/libs/issue/templates/move-columns-in-project.html b/src/plugins/github/libs/issue/templates/move-columns-in-project.html index 59f2c52..cb76aa6 100644 --- a/src/plugins/github/libs/issue/templates/move-columns-in-project.html +++ b/src/plugins/github/libs/issue/templates/move-columns-in-project.html @@ -2,7 +2,7 @@ * @Author : yanyongyu * @Date : 2021-05-22 14:59:08 * @LastEditors : yanyongyu - * @LastEditTime : 2021-05-25 21:04:40 + * @LastEditTime : 2021-08-20 01:24:27 * @Description : None * @GitHub : https://github.com/yanyongyu --> @@ -33,7 +33,11 @@ /> {{ event.actor.login|escape }} - moved this in project + moved this from + {{ event.project_card.column_name|escape }} + to + {{ event.project_card.previous_column_name|escape }} + in project {{ event.created_at|relative_time }} diff --git a/src/plugins/github/libs/issue/templates/remove-from-project.html b/src/plugins/github/libs/issue/templates/remove-from-project.html index 287104c..725b416 100644 --- a/src/plugins/github/libs/issue/templates/remove-from-project.html +++ b/src/plugins/github/libs/issue/templates/remove-from-project.html @@ -2,7 +2,7 @@ * @Author : yanyongyu * @Date : 2021-05-22 15:01:24 * @LastEditors : yanyongyu - * @LastEditTime : 2021-05-25 21:05:34 + * @LastEditTime : 2021-08-20 01:23:51 * @Description : None * @GitHub : https://github.com/yanyongyu --> @@ -33,7 +33,9 @@ /> {{ event.actor.login|escape }} - removed this from project + removed this from + {{ event.project_card.column_name|escape }} + in project {{ event.created_at|relative_time }}