feat: daily vani

This commit is contained in:
Krispire Admin
2026-07-11 00:57:27 +05:30
parent d29eb5d844
commit fa3d2b932c
2 changed files with 9 additions and 16 deletions
+1
View File
@@ -12,6 +12,7 @@ type VaniPayload struct {
Subtitle string `json:"subtitle"` // short excerpt or date · place
Href string `json:"href"` // in-app path to open the item
BookTitle string `json:"book_title,omitempty"` // e.g. "Bhagavad-gītā As It Is"
Date string `json:"date,omitempty"` // transcript date, for the "Lecture • DATE" line
}
// VaniPick is one persisted day's choice. RefID is `<kind>:<mongo _id hex>` and
+8 -16
View File
@@ -145,28 +145,20 @@ func transcriptPick(t *repository.TranscriptionDoc, day time.Time) *model.VaniPi
if t.Type == "conversation" {
label = "Conversation"
}
// Prefer a date · place line; fall back to the first spoken line.
var bits []string
if t.Date != nil && *t.Date != "" {
bits = append(bits, *t.Date)
}
if t.Place != nil && *t.Place != "" {
bits = append(bits, *t.Place)
}
subtitle := strings.Join(bits, " · ")
if subtitle == "" && len(t.Content) > 0 {
subtitle = excerpt(t.Content[0].Text, 140)
date := ""
if t.Date != nil {
date = *t.Date
}
return &model.VaniPick{
Day: day,
Kind: "transcript",
RefID: "transcript:" + t.ID.Hex(),
Payload: model.VaniPayload{
Kind: "transcript",
Label: label,
Title: t.Name,
Subtitle: subtitle,
Href: "/transcriptions/" + t.Slug,
Kind: "transcript",
Label: label,
Title: t.Name,
Href: "/transcriptions/" + t.Slug,
Date: date,
},
}
}