Piotr Biernat
27222a479e
All checks were successful
continuous-integration/drone/push Build is passing
26 lines
606 B
Go
26 lines
606 B
Go
package model
|
|
|
|
import (
|
|
"github.com/Kamva/mgm/v3"
|
|
)
|
|
|
|
// Article type
|
|
type Article struct {
|
|
mgm.DefaultModel `bson:",inline"`
|
|
Title string `json:"title" bson:"title" validate:"required"`
|
|
Description string `json:"description" bson:"description" validate:"required"`
|
|
Content string `json:"content" bson:"content" validate:"required"`
|
|
}
|
|
|
|
// Articles Collection
|
|
type Articles []Article
|
|
|
|
// NewArticle create new Article
|
|
func NewArticle(title string, desc string, content string) *Article {
|
|
return &Article{
|
|
Title: title,
|
|
Description: desc,
|
|
Content: content,
|
|
}
|
|
}
|