|
@@ -1,12 +1,15 @@
|
|
package models
|
|
package models
|
|
|
|
|
|
-import "database/sql"
|
|
|
|
|
|
+import (
|
|
|
|
+ "database/sql"
|
|
|
|
+ "time"
|
|
|
|
+)
|
|
|
|
|
|
type ArticlePreview struct {
|
|
type ArticlePreview struct {
|
|
ID int
|
|
ID int
|
|
URL string
|
|
URL string
|
|
Title string
|
|
Title string
|
|
- PublishTime string
|
|
|
|
|
|
+ PublishTime time.Time
|
|
PreviewText sql.NullString
|
|
PreviewText sql.NullString
|
|
Image sql.NullString
|
|
Image sql.NullString
|
|
}
|
|
}
|
|
@@ -15,7 +18,7 @@ type Article struct {
|
|
ID int
|
|
ID int
|
|
URL string
|
|
URL string
|
|
Title string
|
|
Title string
|
|
- PublishTime string
|
|
|
|
|
|
+ PublishTime time.Time
|
|
Text string
|
|
Text string
|
|
PreviewText sql.NullString
|
|
PreviewText sql.NullString
|
|
IsActive bool
|
|
IsActive bool
|
|
@@ -26,15 +29,15 @@ type Article struct {
|
|
|
|
|
|
type ArticleForm struct {
|
|
type ArticleForm struct {
|
|
ID int
|
|
ID int
|
|
- Title string `form:"title" validate:"required,max=255"`
|
|
|
|
- Image string `form:"image" validate:"uri,max=255"`
|
|
|
|
- URL string `form:"url" validate:"required,max=255"`
|
|
|
|
- Text string `form:"text" validate:"required"`
|
|
|
|
- PreviewText string `form:"preview_text" validate:"max=255"`
|
|
|
|
- MetaKeywords string `form:"meta_keywords" validate:"max=255"`
|
|
|
|
- MetaDescription string `form:"meta_description" validate:"max=255"`
|
|
|
|
- IsActive bool `form:"is_active"`
|
|
|
|
- PublishTime string `form:"publish_time" validate:"required"`
|
|
|
|
- Tags []string `form:"tag"`
|
|
|
|
|
|
+ Title string `form:"title" validate:"required,max=255"`
|
|
|
|
+ Image string `form:"image" validate:"uri,max=255"`
|
|
|
|
+ URL string `form:"url" validate:"required,max=255"`
|
|
|
|
+ Text string `form:"text" validate:"required"`
|
|
|
|
+ PreviewText string `form:"preview_text" validate:"max=255"`
|
|
|
|
+ MetaKeywords string `form:"meta_keywords" validate:"max=255"`
|
|
|
|
+ MetaDescription string `form:"meta_description" validate:"max=255"`
|
|
|
|
+ IsActive bool `form:"is_active"`
|
|
|
|
+ PublishTime time.Time `form:"publish_time" validate:"required"`
|
|
|
|
+ Tags []string `form:"tag"`
|
|
ActiveTags map[int]bool
|
|
ActiveTags map[int]bool
|
|
}
|
|
}
|