chore(webhooks): remove WebhookEvent interface

This commit is contained in:
kolaente 2023-09-14 12:22:57 +02:00
parent 96ccf6b923
commit 4253d14367
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 1 additions and 70 deletions

View File

@ -36,10 +36,6 @@ func (t *TaskCreatedEvent) Name() string {
return "task.created"
}
func (t *TaskCreatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskUpdatedEvent represents an event where a task has been updated
type TaskUpdatedEvent struct {
Task *Task `json:"task"`
@ -51,10 +47,6 @@ func (t *TaskUpdatedEvent) Name() string {
return "task.updated"
}
func (t *TaskUpdatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskDeletedEvent represents a TaskDeletedEvent event
type TaskDeletedEvent struct {
Task *Task `json:"task"`
@ -66,10 +58,6 @@ func (t *TaskDeletedEvent) Name() string {
return "task.deleted"
}
func (t *TaskDeletedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskAssigneeCreatedEvent represents an event where a task has been assigned to a user
type TaskAssigneeCreatedEvent struct {
Task *Task `json:"task"`
@ -82,10 +70,6 @@ func (t *TaskAssigneeCreatedEvent) Name() string {
return "task.assignee.created"
}
func (t *TaskAssigneeCreatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskAssigneeDeletedEvent represents a TaskAssigneeDeletedEvent event
type TaskAssigneeDeletedEvent struct {
Task *Task `json:"task"`
@ -98,10 +82,6 @@ func (t *TaskAssigneeDeletedEvent) Name() string {
return "task.assignee.deleted"
}
func (t *TaskAssigneeDeletedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskCommentCreatedEvent represents an event where a task comment has been created
type TaskCommentCreatedEvent struct {
Task *Task `json:"task"`
@ -114,10 +94,6 @@ func (t *TaskCommentCreatedEvent) Name() string {
return "task.comment.created"
}
func (t *TaskCommentCreatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskCommentUpdatedEvent represents a TaskCommentUpdatedEvent event
type TaskCommentUpdatedEvent struct {
Task *Task `json:"task"`
@ -130,10 +106,6 @@ func (t *TaskCommentUpdatedEvent) Name() string {
return "task.comment.edited"
}
func (t *TaskCommentUpdatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskCommentDeletedEvent represents a TaskCommentDeletedEvent event
type TaskCommentDeletedEvent struct {
Task *Task `json:"task"`
@ -146,10 +118,6 @@ func (t *TaskCommentDeletedEvent) Name() string {
return "task.comment.deleted"
}
func (t *TaskCommentDeletedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskAttachmentCreatedEvent represents a TaskAttachmentCreatedEvent event
type TaskAttachmentCreatedEvent struct {
Task *Task `json:"task"`
@ -162,10 +130,6 @@ func (t *TaskAttachmentCreatedEvent) Name() string {
return "task.attachment.created"
}
func (t *TaskAttachmentCreatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskAttachmentDeletedEvent represents a TaskAttachmentDeletedEvent event
type TaskAttachmentDeletedEvent struct {
Task *Task `json:"task"`
@ -178,10 +142,6 @@ func (t *TaskAttachmentDeletedEvent) Name() string {
return "task.attachment.deleted"
}
func (t *TaskAttachmentDeletedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskRelationCreatedEvent represents a TaskRelationCreatedEvent event
type TaskRelationCreatedEvent struct {
Task *Task `json:"task"`
@ -194,10 +154,6 @@ func (t *TaskRelationCreatedEvent) Name() string {
return "task.relation.created"
}
func (t *TaskRelationCreatedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
// TaskRelationDeletedEvent represents a TaskRelationDeletedEvent event
type TaskRelationDeletedEvent struct {
Task *Task `json:"task"`
@ -210,10 +166,6 @@ func (t *TaskRelationDeletedEvent) Name() string {
return "task.relation.deleted"
}
func (t *TaskRelationDeletedEvent) ProjectID() int64 {
return t.Task.ProjectID
}
////////////////////
// Project Events //
////////////////////
@ -240,10 +192,6 @@ func (p *ProjectUpdatedEvent) Name() string {
return "project.updated"
}
func (p *ProjectUpdatedEvent) ProjectID() int64 {
return p.Project.ID
}
// ProjectDeletedEvent represents an event where a project has been deleted
type ProjectDeletedEvent struct {
Project *Project `json:"project"`
@ -255,10 +203,6 @@ func (p *ProjectDeletedEvent) Name() string {
return "project.deleted"
}
func (p *ProjectDeletedEvent) ProjectID() int64 {
return p.Project.ID
}
////////////////////
// Sharing Events //
////////////////////
@ -275,10 +219,6 @@ func (p *ProjectSharedWithUserEvent) Name() string {
return "project.shared.user"
}
func (p *ProjectSharedWithUserEvent) ProjectID() int64 {
return p.Project.ID
}
// ProjectSharedWithTeamEvent represents an event where a project has been shared with a team
type ProjectSharedWithTeamEvent struct {
Project *Project `json:"project"`
@ -291,10 +231,6 @@ func (p *ProjectSharedWithTeamEvent) Name() string {
return "project.shared.team"
}
func (p *ProjectSharedWithTeamEvent) ProjectID() int64 {
return p.Project.ID
}
/////////////////
// Team Events //
/////////////////

View File

@ -49,11 +49,6 @@ func (w *Webhook) TableName() string {
return "webhooks"
}
type WebhookEvent interface {
events.Event
ProjectID() int64
}
var availableWebhookEvents map[string]bool
var availableWebhookEventsLock *sync.Mutex
@ -62,7 +57,7 @@ func init() {
availableWebhookEventsLock = &sync.Mutex{}
}
func RegisterEventForWebhook(event WebhookEvent) {
func RegisterEventForWebhook(event events.Event) {
availableWebhookEventsLock.Lock()
defer availableWebhookEventsLock.Unlock()