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-06 16:56:43 +00:00
|
|
|
ImagePath string `owl:"inputType=file"`
|
|
|
|
Content EntryContent `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-06 16:56:43 +00:00
|
|
|
return 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{} {
|
|
|
|
return &ImageEntryMetaData{
|
2023-07-06 16:56:43 +00:00
|
|
|
ImagePath: e.meta.ImagePath,
|
|
|
|
Content: e.meta.Content,
|
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
|
|
|
|
}
|