2025-03-25 03:52:30 -04:00

77 lines
2.6 KiB
Go

package moderation
import (
"time"
"gorm.io/gorm"
)
// ContentFlag represents a flag raised against content
type ContentFlag struct {
ID uint `json:"id" gorm:"primaryKey"`
ContentID string `json:"contentId" gorm:"index"`
Reason string `json:"reason"`
FlaggerAddress string `json:"flaggerAddress"`
Timestamp time.Time `json:"timestamp"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}
// ModerationQueueItem represents an item in the moderation queue
type ModerationQueueItem struct {
ID uint `json:"id" gorm:"primaryKey"`
ContentID string `json:"contentId" gorm:"uniqueIndex"`
FlagCount int `json:"flagCount"`
Reason string `json:"reason"`
Status string `json:"status"` // "pending", "approved", "rejected"
AIFlagged bool `json:"aiFlagged"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}
// ContentType represents the type of content being moderated (used for AI filtering)
type ContentType string
const (
// ContentTypePerspective is for perspective content
ContentTypePerspective ContentType = "perspective"
// ContentTypeComment is for comment content
ContentTypeComment ContentType = "comment"
)
// ContentToModerate represents content being submitted for moderation
type ContentToModerate struct {
ContentID string `json:"contentId"`
Text string `json:"text"`
UserAddress string `json:"userAddress"`
IsVerified bool `json:"isVerified"`
ContentType ContentType `json:"contentType"`
}
// FlagContentRequest represents a request to flag content
type FlagContentRequest struct {
ContentID string `json:"contentId" binding:"required"`
Reason string `json:"reason" binding:"required"`
FlaggerAddress string `json:"flaggerAddress" binding:"required"`
}
// FlagContentResponse represents a response to a flag content request
type FlagContentResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
}
// ModerateContentRequest represents a request to moderate content
type ModerateContentRequest struct {
ContentID string `json:"contentId" binding:"required"`
Decision string `json:"decision" binding:"required"` // "approve" or "reject"
}
// ModerateContentResponse represents a response to a moderate content request
type ModerateContentResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
}