21 lines
1.0 KiB
Go
21 lines
1.0 KiB
Go
package model
|
|
|
|
// CsatTemplate represents a WhatsApp CSAT survey template for an inbox.
|
|
// Reference: Chatwoot app/models/csat_template.rb + InboxCsatTemplatesController
|
|
// Each inbox can have one CSAT template that defines the survey message sent via WhatsApp.
|
|
// Chatwoot uses a singular resource (not a collection) — show + create under inbox scope.
|
|
//
|
|
// Chatwoot compatibility notes:
|
|
// - Routes: GET/POST /inboxes/:inbox_id/csat_template (singular resource)
|
|
// - "analyze" action: POST /inboxes/:inbox_id/csat_template/analyze
|
|
// - status field tracks template approval state with WhatsApp (pending/approved/rejected)
|
|
type CsatTemplate struct {
|
|
Base
|
|
InboxID uint `gorm:"not null;index" json:"inbox_id"`
|
|
Message string `gorm:"type:text" json:"message"`
|
|
Status string `gorm:"size:50;default:'pending'" json:"status"`
|
|
Inbox Inbox `gorm:"foreignKey:InboxID" json:"inbox,omitempty"`
|
|
}
|
|
|
|
// TableName returns the database table name for CsatTemplate.
|
|
func (CsatTemplate) TableName() string { return "csat_templates" } |