1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-06-23 06:35:24 +00:00
neonmodem/models/post/post.go

52 lines
743 B
Go
Raw Normal View History

2022-12-29 03:22:36 +00:00
package post
2022-12-30 06:44:31 +00:00
import (
2022-12-31 04:57:03 +00:00
"fmt"
2022-12-30 07:05:48 +00:00
"time"
2022-12-30 06:44:31 +00:00
"github.com/mrusme/gobbs/models/author"
2022-12-31 04:57:03 +00:00
"github.com/mrusme/gobbs/models/forum"
2022-12-30 06:44:31 +00:00
"github.com/mrusme/gobbs/models/reply"
)
2022-12-29 03:22:36 +00:00
type Post struct {
ID string
Subject string
2022-12-30 06:44:31 +00:00
Body string
Type string // "post", "url"
Pinned bool
Closed bool
2022-12-30 07:05:48 +00:00
CreatedAt time.Time
LastCommentedAt time.Time
2022-12-30 06:44:31 +00:00
Author author.Author
2022-12-31 04:57:03 +00:00
Forum forum.Forum
2022-12-30 06:44:31 +00:00
Replies []reply.Reply
2022-12-30 08:22:54 +00:00
URL string
2022-12-30 08:22:54 +00:00
SysIDX int
2022-12-29 03:22:36 +00:00
}
func (post Post) FilterValue() string {
return post.Subject
}
func (post Post) Title() string {
return post.Subject
}
func (post Post) Description() string {
2022-12-31 04:57:03 +00:00
return fmt.Sprintf(
2022-12-31 21:57:11 +00:00
"in %s by %s on %s",
2022-12-31 04:57:03 +00:00
post.Forum.Name,
2022-12-31 21:57:11 +00:00
post.Author.Name,
2023-01-06 02:55:04 +00:00
post.CreatedAt.Local().Format("02 Jan 06 15:04 MST"),
2022-12-31 04:57:03 +00:00
)
2022-12-29 03:22:36 +00:00
}