Initial import with modified Dockerfile for env-based config generation

This commit is contained in:
2026-06-22 11:56:10 +03:00
parent 28fa7537ac
commit 6bf27aa40e
25 changed files with 3228 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
package event
import "time"
// Type represents the normalized event type
type Type string
const (
TypePROpened Type = "pr_opened"
TypePRClosed Type = "pr_closed"
TypePRMerged Type = "pr_merged"
TypePRAssigned Type = "pr_assigned"
TypePRReviewRequested Type = "pr_review_requested"
TypePRReviewed Type = "pr_reviewed"
TypePRCommented Type = "pr_commented"
TypePRSynchronized Type = "pr_synchronized" // New commits pushed
TypeIssueOpened Type = "issue_opened"
TypeIssueClosed Type = "issue_closed"
TypeIssueCommented Type = "issue_commented"
)
// User represents a user in our normalized event model
type User struct {
GiteaID int64 `json:"gitea_id"`
GiteaUsername string `json:"gitea_username"`
Email string `json:"email"`
FullName string `json:"full_name"`
}
// Event is a normalized event from Gitea
type Event struct {
ID string `json:"id"` // Delivery ID from Gitea
Type Type `json:"type"` // Normalized event type
Timestamp time.Time `json:"timestamp"` // When the event occurred
// The user who triggered the event
Actor User `json:"actor"`
// Repository info
RepoName string `json:"repo_name"`
RepoFullName string `json:"repo_full_name"`
RepoURL string `json:"repo_url"`
// PR/Issue info
Number int64 `json:"number"` // PR or Issue number
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
// Users to potentially notify (based on roles)
Owner *User `json:"owner,omitempty"` // PR/Issue author
Assignees []User `json:"assignees,omitempty"` // Assigned users
Reviewers []User `json:"reviewers,omitempty"` // Requested reviewers (PR only)
// For review events
ReviewState string `json:"review_state,omitempty"` // APPROVED, CHANGES_REQUESTED, COMMENT
// For comment events
CommentBody string `json:"comment_body,omitempty"`
CommentURL string `json:"comment_url,omitempty"`
// For synchronize events (new commits pushed)
Commits []CommitInfo `json:"commits,omitempty"`
}
// CommitInfo represents a commit in a synchronized event
type CommitInfo struct {
SHA string `json:"sha"`
Message string `json:"message"`
URL string `json:"url"`
Author string `json:"author"`
}
// Notification represents a notification to be sent
type Notification struct {
// Target user to notify
TargetUser User `json:"target_user"`
// The event that triggered this notification
Event *Event `json:"event"`
// Why this user is being notified
Reason NotificationReason `json:"reason"`
// Message content
Message string `json:"message"`
// Channel override (empty = DM)
Channel string `json:"channel,omitempty"`
}
// NotificationReason explains why a user is being notified
type NotificationReason string
const (
ReasonOwner NotificationReason = "owner" // PR/Issue author
ReasonAssignee NotificationReason = "assignee" // Assigned to PR/Issue
ReasonReviewer NotificationReason = "reviewer" // Requested reviewer
ReasonMention NotificationReason = "mention" // @mentioned in comment
)