187 lines
6.3 KiB
Go
187 lines
6.3 KiB
Go
package khira
|
|
|
|
import "time"
|
|
|
|
type Role string
|
|
|
|
const (
|
|
RoleFrontend Role = "frontend_dev"
|
|
RoleBackend Role = "backend_dev"
|
|
RoleTester Role = "tester"
|
|
RoleLead Role = "team_lead"
|
|
)
|
|
|
|
func (r Role) DisplayName() string {
|
|
switch r {
|
|
case RoleFrontend:
|
|
return "Frontend Dev"
|
|
case RoleBackend:
|
|
return "Backend Dev"
|
|
case RoleTester:
|
|
return "Tester"
|
|
case RoleLead:
|
|
return "Team Lead"
|
|
default:
|
|
return string(r)
|
|
}
|
|
}
|
|
|
|
func (r Role) IsValid() bool {
|
|
switch r {
|
|
case RoleFrontend, RoleBackend, RoleTester, RoleLead:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Username string `json:"username"`
|
|
Name string `json:"name"`
|
|
PasswordHash string `json:"password_hash,omitempty"`
|
|
Role string `json:"role"`
|
|
RoleDisplay string `json:"role_display"`
|
|
Avatar string `json:"avatar"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
func (u *User) Public() *User {
|
|
if u == nil {
|
|
return nil
|
|
}
|
|
clone := *u
|
|
clone.PasswordHash = ""
|
|
return &clone
|
|
}
|
|
|
|
type Priority string
|
|
|
|
const (
|
|
PriorityCritical Priority = "critical"
|
|
PriorityHigh Priority = "high"
|
|
PriorityMedium Priority = "medium"
|
|
PriorityLow Priority = "low"
|
|
)
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusOpen Status = "open"
|
|
StatusInProgress Status = "in_progress"
|
|
StatusOnHold Status = "on_hold"
|
|
StatusCompleted Status = "completed"
|
|
StatusClosed Status = "closed"
|
|
)
|
|
|
|
type Attachment struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
URL string `json:"url"`
|
|
Size int64 `json:"size"`
|
|
Type string `json:"type"` // "file", "image", "link"
|
|
UploadedBy string `json:"uploaded_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type Remark struct {
|
|
ID string `json:"id"`
|
|
AuthorUsername string `json:"author_username"`
|
|
AuthorName string `json:"author_name"`
|
|
AuthorRole string `json:"author_role"`
|
|
Type string `json:"type"` // comment, hold, resume, complete, priority_change, reassign, created, attachment, link
|
|
Text string `json:"text"`
|
|
Attachments []Attachment `json:"attachments,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type Ticket struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
TicketType string `json:"ticket_type"` // "general" | "application"
|
|
GeneralCategory string `json:"general_category,omitempty"`
|
|
Department string `json:"department,omitempty"`
|
|
AppName string `json:"app_name,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
FeatureName string `json:"feature_name,omitempty"`
|
|
APIKey string `json:"api_key,omitempty"`
|
|
IssueType string `json:"issue_type,omitempty"`
|
|
Priority string `json:"priority"`
|
|
Status string `json:"status"`
|
|
Description string `json:"description"`
|
|
AssistanceRequired string `json:"assistance_required"`
|
|
AdditionalInfo string `json:"additional_info,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedByName string `json:"created_by_name"`
|
|
CreatedByRole string `json:"created_by_role"`
|
|
AssignedTo string `json:"assigned_to"`
|
|
AssignedToName string `json:"assigned_to_name"`
|
|
AssignedToRole string `json:"assigned_to_role"`
|
|
HoldReason string `json:"hold_reason,omitempty"`
|
|
HeldBy string `json:"held_by,omitempty"`
|
|
HeldAt *time.Time `json:"held_at,omitempty"`
|
|
CompletionRemarks string `json:"completion_remarks,omitempty"`
|
|
CompletedBy string `json:"completed_by,omitempty"`
|
|
CompletedAt *time.Time `json:"completed_at,omitempty"`
|
|
Attachments []Attachment `json:"attachments,omitempty"`
|
|
Links []string `json:"links,omitempty"`
|
|
LinkedErrorID string `json:"linked_error_id,omitempty"`
|
|
Remarks []Remark `json:"remarks"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ErrorSeverity string
|
|
|
|
const (
|
|
SeverityCritical ErrorSeverity = "critical"
|
|
SeverityHigh ErrorSeverity = "high"
|
|
SeverityMedium ErrorSeverity = "medium"
|
|
SeverityLow ErrorSeverity = "low"
|
|
)
|
|
|
|
type ErrorStatus string
|
|
|
|
const (
|
|
ErrorStatusUnresolved ErrorStatus = "unresolved"
|
|
ErrorStatusInvestigating ErrorStatus = "investigating"
|
|
ErrorStatusResolved ErrorStatus = "resolved"
|
|
ErrorStatusIgnored ErrorStatus = "ignored"
|
|
)
|
|
|
|
type AppError struct {
|
|
ID string `json:"id"`
|
|
Fingerprint string `json:"fingerprint"`
|
|
AppName string `json:"app_name"`
|
|
Version string `json:"version"`
|
|
Environment string `json:"environment"` // production, staging, development
|
|
Service string `json:"service"` // feature / subsystem name
|
|
Endpoint string `json:"endpoint,omitempty"`
|
|
ExceptionType string `json:"exception_type"`
|
|
Message string `json:"message"`
|
|
StackTrace string `json:"stack_trace"`
|
|
Severity string `json:"severity"` // critical, high, medium, low
|
|
Status string `json:"status"` // unresolved, investigating, resolved, ignored
|
|
Occurrences int `json:"occurrences"`
|
|
FirstSeen time.Time `json:"first_seen"`
|
|
LastSeen time.Time `json:"last_seen"`
|
|
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
|
|
ResolvedBy string `json:"resolved_by,omitempty"`
|
|
ResolutionNotes string `json:"resolution_notes,omitempty"`
|
|
LinkedTicketID string `json:"linked_ticket_id,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
RequestPayload string `json:"request_payload,omitempty"`
|
|
Tags []string `json:"tags,omitempty"`
|
|
}
|
|
|
|
type Notification struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
TicketID string `json:"ticket_id"`
|
|
Title string `json:"title"`
|
|
Message string `json:"message"`
|
|
Type string `json:"type"` // assignment, status_change, hold, complete, remark
|
|
Read bool `json:"read"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|