owl-blogs/domain/model/image_entry.go

38 lines
730 B
Go
Raw Normal View History

2023-06-25 18:04:06 +00:00
package model
import "time"
type ImageEntry struct {
id string
publishedAt *time.Time
2023-07-06 16:56:43 +00:00
meta ImageEntryMetaData
2023-06-25 18:04:06 +00:00
}
type ImageEntryMetaData struct {
2023-07-08 09:08:55 +00:00
ImageId string `owl:"inputType=file"`
Content string `owl:"inputType=text widget=textarea"`
2023-06-25 18:04:06 +00:00
}
func (e *ImageEntry) ID() string {
return e.id
}
func (e *ImageEntry) Content() EntryContent {
2023-07-07 19:04:25 +00:00
return EntryContent(e.meta.Content)
2023-06-25 18:04:06 +00:00
}
func (e *ImageEntry) PublishedAt() *time.Time {
return e.publishedAt
}
func (e *ImageEntry) MetaData() interface{} {
2023-07-07 19:04:25 +00:00
return &e.meta
2023-06-25 18:04:06 +00:00
}
2023-07-06 16:56:43 +00:00
func (e *ImageEntry) Create(id string, publishedAt *time.Time, metaData EntryMetaData) error {
2023-06-25 18:04:06 +00:00
e.id = id
e.publishedAt = publishedAt
2023-07-06 16:56:43 +00:00
e.meta = *metaData.(*ImageEntryMetaData)
2023-06-25 18:04:06 +00:00
return nil
}