Files
libredesk/internal/media/models/models.go
T
Abhinav Raut 634fc66e9f Translate welcome to libredesk email subject
- Update all SQL queries to add missing columns

- Update the create conversation API to allow setting the initiator of a conversation. For example, we might want to use this API to create a conversation on behalf of a customer, with the first message coming from the customer instead of the agent. This param allows this.

- Minor refactors and clean up

- Tidy go.mod

- Rename structs to reflect purpose

- Create focus structs for scanning JSON payloads for clarity.
2025-08-28 00:34:56 +05:30

38 lines
1.2 KiB
Go

package models
import (
"encoding/json"
"time"
"github.com/volatiletech/null/v9"
)
const (
// TODO: pick these table names from their respective package/models/models.go
ModelMessages = "messages"
ModelUser = "users"
DispositionInline = "inline"
)
// Media represents an uploaded object in DB and storage backend.
type Media struct {
ID int `db:"id" json:"id"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
UUID string `db:"uuid" json:"uuid"`
Store string `db:"store" json:"store"`
Filename string `db:"filename" json:"filename"`
ContentType string `db:"content_type" json:"content_type"`
ContentID string `db:"content_id" json:"content_id"`
ModelID null.Int `db:"model_id" json:"model_id"`
Model null.String `db:"model_type" json:"model_type"`
Disposition null.String `db:"disposition" json:"disposition"`
Size int `db:"size" json:"size"`
Meta json.RawMessage `db:"meta" json:"meta"`
// Pseudo fields
URL string `json:"url"`
Content []byte `json:"-"`
}