2024-10-06 17:04:37 +03:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/uptrace/bun"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Quote struct {
|
|
|
|
bun.BaseModel `bun:"table:quotes,alias:q"`
|
|
|
|
|
|
|
|
ID int64 `bun:",pk,autoincrement"`
|
|
|
|
Quote string `bun:",notnull"`
|
|
|
|
Approved bool
|
|
|
|
Archive bool
|
2024-10-08 03:43:08 +03:00
|
|
|
Rating int
|
2024-10-06 17:04:37 +03:00
|
|
|
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
|
|
|
|
DeletedAt time.Time `bun:",soft_delete,nullzero"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Quote) Text() string {
|
|
|
|
return strings.ReplaceAll(q.Quote, "\n", "<br />")
|
|
|
|
}
|