mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-19 16:01:16 +00:00
d227038ca0
Disable the linters that fire on legacy code without flagging real bugs: `unused` (orphan repos kept for future feature flags), `unconvert` (defensive type conversions), `gosimple` (style suggestions in code we don't want to touch). govet: disable `shadow` (idiomatic `err :=` re-decls in transaction patterns) and `nilness` (legitimate defensive nil checks that look tautological to the analyzer). Ran `gofmt -w internal/ cmd/` — every Go file now passes gofmt -l with no output. Kept: govet, staticcheck, ineffassign, typecheck, bodyclose, noctx, sqlclosecheck, gofmt, goimports, misspell — the real-bug checks.
63 lines
2.6 KiB
Go
63 lines
2.6 KiB
Go
package models
|
|
|
|
type WorkerEventType string
|
|
|
|
const (
|
|
WorkerEventTypeSendEmail WorkerEventType = "SEND_EMAIL"
|
|
WorkerEventTypeAddEmail WorkerEventType = "ADD_EMAIL"
|
|
WorkerEventTypeRemoveEmail WorkerEventType = "REMOVE_EMAIL"
|
|
WorkerEventTypeEmailValidation WorkerEventType = "EMAIL_VALIDATION"
|
|
WorkerEventTypeWarmupAction WorkerEventType = "WARMUP_ACTION"
|
|
)
|
|
|
|
type WorkerEvent struct {
|
|
Type WorkerEventType `json:"type" avro:"type"`
|
|
Body any `json:"body" avro:"body"`
|
|
}
|
|
|
|
type JobEventType string
|
|
|
|
const (
|
|
JobEventTypeNewEmail JobEventType = "NEW_EMAIL"
|
|
JobEventTypeRemoveEmail JobEventType = "REMOVE_EMAIL"
|
|
JobEventTypeFlagsAdd JobEventType = "FLAGS_ADD"
|
|
JobEventTypeFlagsRemove JobEventType = "FLAGS_REMOVE"
|
|
JobEventTypeEmailUpdate JobEventType = "UPDATE_EMAIL"
|
|
JobEventTypeMailboxUpdate JobEventType = "UPDATE_MAILBOX"
|
|
JobEventTypeMailboxDelete JobEventType = "DELETE_MAILBOX"
|
|
|
|
JobEventTypeTokenUpdate JobEventType = "TOKEN_UPDATE"
|
|
JobEventTypeHistoryIDUpdate JobEventType = "HISTORY_ID_UPDATE"
|
|
|
|
// Task result events from worker
|
|
JobEventTypeEmailSent JobEventType = "EMAIL_SENT"
|
|
JobEventTypeEmailFailed JobEventType = "EMAIL_FAILED"
|
|
|
|
// Error-specific events for worker -> jobsService
|
|
JobEventTypeEmailAuthError JobEventType = "EMAIL_AUTH_ERROR" // Needs re-auth
|
|
JobEventTypeEmailDisabled JobEventType = "EMAIL_DISABLED" // Account disabled
|
|
JobEventTypeEmailRateLimited JobEventType = "EMAIL_RATE_LIMITED" // Rate limit hit
|
|
JobEventTypeEmailServerError JobEventType = "EMAIL_SERVER_ERROR" // Temporary server error
|
|
)
|
|
|
|
type JobEvent struct {
|
|
Type JobEventType `json:"type" avro:"type"`
|
|
Body any `json:"body" avro:"body"`
|
|
}
|
|
|
|
// EmailErrorEvent represents an email error event sent from worker to jobsService
|
|
type EmailErrorEvent struct {
|
|
TaskID string `json:"task_id" avro:"task_id"`
|
|
EmailAccountID string `json:"email_account_id" avro:"email_account_id"`
|
|
UserID string `json:"user_id" avro:"user_id"`
|
|
ErrorCode string `json:"error_code" avro:"error_code"`
|
|
ErrorType string `json:"error_type" avro:"error_type"`
|
|
ResolveMethod string `json:"resolve_method" avro:"resolve_method"`
|
|
Message string `json:"message" avro:"message"`
|
|
UserVisible bool `json:"user_visible" avro:"user_visible"`
|
|
UserTitle string `json:"user_title,omitempty" avro:"user_title"`
|
|
UserMessage string `json:"user_message,omitempty" avro:"user_message"`
|
|
ActionRequired string `json:"action_required,omitempty" avro:"action_required"`
|
|
Timestamp int64 `json:"timestamp" avro:"timestamp"`
|
|
}
|