1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-11-03 04:27:16 -05:00
neonmodem/models/post/post.go

50 lines
710 B
Go
Raw Normal View History

2022-12-28 22:22:36 -05:00
package post
2022-12-30 01:44:31 -05:00
import (
2022-12-30 23:57:03 -05:00
"fmt"
2022-12-30 02:05:48 -05:00
"time"
2022-12-30 01:44:31 -05:00
"github.com/mrusme/gobbs/models/author"
2022-12-30 23:57:03 -05:00
"github.com/mrusme/gobbs/models/forum"
2022-12-30 01:44:31 -05:00
"github.com/mrusme/gobbs/models/reply"
)
2022-12-28 22:22:36 -05:00
type Post struct {
ID string
Subject string
2022-12-30 01:44:31 -05:00
Body string
Type string // "post", "url"
Pinned bool
Closed bool
2022-12-30 02:05:48 -05:00
CreatedAt time.Time
LastCommentedAt time.Time
2022-12-30 01:44:31 -05:00
Author author.Author
2022-12-30 23:57:03 -05:00
Forum forum.Forum
2022-12-30 01:44:31 -05:00
Replies []reply.Reply
2022-12-30 03:22:54 -05:00
SysIDX int
2022-12-28 22:22:36 -05:00
}
func (post Post) FilterValue() string {
return post.Subject
}
func (post Post) Title() string {
return post.Subject
}
func (post Post) Description() string {
2022-12-30 23:57:03 -05:00
return fmt.Sprintf(
"%s in %s on %s",
post.Author.Name,
post.Forum.Name,
post.CreatedAt.Format("Jan 2 2006"),
)
2022-12-28 22:22:36 -05:00
}