add: webhook tasks and test

This commit is contained in:
2021-07-28 14:27:11 +08:00
parent 8b53aac8a6
commit 264a831a1c
10 changed files with 1152 additions and 131 deletions
+2
View File
@@ -1,8 +1,10 @@
class Gitea::Webhook < Gitea::Base
serialize :events, JSON
self.inheritance_column = nil
self.table_name = 'webhook'
has_many :tasks, class_name: "Gitea::WebhookTask", foreign_key: :hook_id
belongs_to :project, class_name: "::Project", primary_key: :gpid, foreign_key: :repo_id, optional: true
enum hook_task_type: {gogs: 1, slack: 2, gitea: 3, discord: 4, dingtalk: 5, telegram: 6, msteams: 7, feishu: 8, matrix: 9}
+13
View File
@@ -0,0 +1,13 @@
class Gitea::WebhookTask < Gitea::Base
serialize :payload_content, JSON
serialize :request_content, JSON
serialize :response_content, JSON
self.inheritance_column = nil
self.table_name = 'hook_task'
belongs_to :webhook, class_name: "Gitea::Webhook", foreign_key: :hook_id
enum type: {gogs: 1, slack: 2, gitea: 3, discord: 4, dingtalk: 5, telegram: 6, msteams: 7, feishu: 8, matrix: 9}
end