Files
Charon/backend/internal/models/notification.go
GitHub Actions af8384046c chore: implement instruction compliance remediation
- Replace Go interface{} with any (Go 1.18+ standard)
- Add database indexes to frequently queried model fields
- Add JSDoc documentation to frontend API client methods
- Remove deprecated docker-compose version keys
- Add concurrency groups to all 25 GitHub Actions workflows
- Add YAML front matter and fix H1→H2 headings in docs

Coverage: Backend 85.5%, Frontend 87.73%
Security: No vulnerabilities detected

Refs: docs/plans/instruction_compliance_spec.md
2025-12-21 04:08:42 +00:00

34 lines
800 B
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type NotificationType string
const (
NotificationTypeInfo NotificationType = "info"
NotificationTypeSuccess NotificationType = "success"
NotificationTypeWarning NotificationType = "warning"
NotificationTypeError NotificationType = "error"
)
type Notification struct {
ID string `gorm:"primaryKey" json:"id"`
Type NotificationType `json:"type" gorm:"index"`
Title string `json:"title"`
Message string `json:"message"`
Read bool `json:"read" gorm:"index"`
CreatedAt time.Time `json:"created_at" gorm:"index"`
}
func (n *Notification) BeforeCreate(tx *gorm.DB) (err error) {
if n.ID == "" {
n.ID = uuid.New().String()
}
return
}