Files
gerald/internal/models/feedback.go
aspasskiy 3ab98cf500
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/production Build is passing
upvotes models
2024-04-23 19:42:33 +03:00

43 lines
957 B
Go

package models
import (
"github.com/google/uuid"
"time"
)
type Feedback struct {
UUID string `gorm:"primaryKey"`
UserID string `gorm:"type:varchar(255)"`
ProjectID string `gorm:"type:varchar(255)"`
SessionUUID string `gorm:"type:varchar(255)"`
Type FeedbackType `gorm:"type:varchar(255)"`
Text string `gorm:"type:varchar(300)"`
Upvote []Upvote `gorm:"foreignKey:FeedbackUUID"`
CreatedAt time.Time `gorm:"type:timestamp"`
UpdatedAt time.Time `gorm:"type:timestamp"`
}
type FeedbackType string
const (
FeedbackTypeFeature FeedbackType = "feature"
FeedbackTypeFeedback FeedbackType = "feedback"
FeedbackTypeSupport FeedbackType = "support"
)
func NewFeedback(userUUID, sessionUUID, text, projectID string, feedbackType FeedbackType) *Feedback {
return &Feedback{
UUID: uuid.New().String(),
UserID: userUUID,
SessionUUID: sessionUUID,
ProjectID: projectID,
Type: feedbackType,
Text: text,
}
}