domain

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HomeType     = "home"
	PageType     = "page"
	SingleType   = "single"
	ArchiveType  = "archive"
	CategoryType = "category"
)

Use for PostType

View Source
const (
	// The default banned role ID.
	BannedRoleID = 1
	// The default contributor role ID.
	ContributorRoleID = 2
	// The default author role ID.
	AuthorRoleID = 3
	// The default editor role ID.
	EditorRoleID = 4
	// The default admin role ID.
	AdminRoleID = 5
	// The default owner role ID.
	OwnerRoleID = 6
)
View Source
const (
	// WebPExtension defines the extension used for webp images.
	WebPExtension = ".webp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	Path                string `yaml:"admin_path,omitempty" json:"admin_path,omitempty"`
	InactiveSessionTime int    `yaml:"inactive_session_time,omitempty" json:"inactive_session_time,omitempty"`
}

type Categories

type Categories []Category

Categories represents the slice of Category's.

type Category

type Category struct {
	Id          int       `sqlb:"id,skipAll" db:"id" json:"id"` //nolint
	UUID        uuid.UUID `sqlb:"uuid" db:"uuid" json:"uuid"`
	Slug        string    `sqlb:"slug" db:"slug" json:"slug" binding:"required,max=150"`
	Name        string    `sqlb:"name" db:"name" json:"name" binding:"required,max=150"`
	Description *string   `sqlb:"description" db:"description" json:"description" binding:"omitempty,max=500"`
	Resource    string    `sqlb:"resource" db:"resource" json:"resource" binding:"required,max=150"`
	ParentId    *int      `sqlb:"parent_id" db:"parent_id" json:"parent_id" binding:"omitempty,numeric"`    //nolint
	ArchiveId   *int      `sqlb:"archive_id" db:"archive_id" json:"archive_id" binding:"omitempty,numeric"` //nolint
	CreatedAt   time.Time `sqlb:"created_at,autoCreateTime" db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `sqlb:"updated_at,autoUpdateTime" db:"updated_at" json:"updated_at"`
}

Category defines the groups used for categorising individual posts.

func (*Category) HasParent

func (c *Category) HasParent() bool

HasParent

Determines if a category has a parent ID attached to it.

type DBMap

type DBMap map[string]interface{}

DBMap defines the helper for unmarshalling into a map directly from the database.

func (DBMap) Scan

func (m DBMap) Scan(value interface{}) error

Scan

Scanner for DBMap. unmarshal the DBMap when the entity is pulled from the database.

func (DBMap) Value

func (m DBMap) Value() (driver.Value, error)

Value

Valuer for DBMap. marshal the DBMap when the entity is inserted to the database.

type Editor

type Editor struct {
	Modules []string               `yaml:"modules" json:"modules"`
	Options map[string]interface{} `yaml:"options" json:"options"`
}

Editor defines editor options for the admin interface.

type Field

type Field struct {
	UUID         uuid.UUID                 `json:"uuid"`
	Label        string                    `json:"label"`
	Name         string                    `json:"name"`
	Type         string                    `json:"type"`
	Instructions string                    `json:"instructions"`
	Required     bool                      `json:"required"`
	Logic        [][]FieldConditionalLogic `json:"conditional_logic"`
	Wrapper      *FieldWrapper             `json:"wrapper"`
	Options      map[string]interface{}    `json:"options"`
	SubFields    []Field                   `json:"sub_fields,omitempty"`
	Layouts      map[string]FieldLayout    `json:"layouts,omitempty"`
}

Field defines an individual field type.

type FieldConditionalLogic

type FieldConditionalLogic struct {
	Field    string `json:"field"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

FieldConditionalLogic defines the logic used to process a field and if one can be shown.

type FieldGroup

type FieldGroup struct {
	UUID      uuid.UUID         `json:"uuid"`
	Title     string            `json:"title"`
	Fields    []Field           `json:"fields,omitempty"`
	Locations [][]FieldLocation `json:"location,omitempty"`
}

FieldGroup defines a group of JSON fields.

type FieldGroups

type FieldGroups []FieldGroup

FieldGroups defines the slice of JSON fields.

type FieldLayout

type FieldLayout struct {
	UUID      uuid.UUID `json:"uuid"`
	Name      string    `json:"name"`
	Label     string    `json:"label"`
	Display   string    `json:"display"`
	SubFields []Field   `json:"sub_fields,omitempty"`
}

FieldLayout defines the structure of fields for individual pages and resources.

type FieldLocation

type FieldLocation struct {
	Param    string
	Operator string
	Value    string
}

FieldLocation defines where the FieldGroup will appear.

type FieldValue

type FieldValue string

FieldValue defines the original value of the field in string form.

func (FieldValue) Int

func (f FieldValue) Int() (int, error)

Int

Converts the field value to a string.

Returns errors.INVALID if the string convert failed.

func (FieldValue) IsEmpty

func (f FieldValue) IsEmpty() bool

IsEmpty

Determines if the field is an empty string.

func (FieldValue) Slice

func (f FieldValue) Slice() []string

Slice

Returns a slice of split field values by comma.

func (FieldValue) String

func (f FieldValue) String() string

String

Stringer on the FieldValue type.

type FieldWrapper

type FieldWrapper struct {
	Width int `json:"width"`
}

FieldWrapper defines the container for field objects on the front end.

type Fields

type Fields []Field

Fields defines the slice of Fields.

type Form

type Form struct {
	Id           int             `db:"id" json:"id" binding:"numeric"` //nolint
	UUID         uuid.UUID       `db:"uuid" json:"uuid"`
	Name         string          `db:"name" json:"name" binding:"required,max=500"`
	Fields       FormFields      `db:"fields" json:"fields"`
	Submissions  FormSubmissions `db:"-" json:"submissions"`
	EmailSend    types.BitBool   `db:"email_send" json:"email_send"`
	EmailMessage string          `db:"email_message" json:"email_message"`
	EmailSubject string          `db:"email_subject" json:"email_subject"`
	Recipients   string          `db:"recipients" json:"recipients"`
	StoreDB      types.BitBool   `db:"store_db" json:"store_db"`
	Body         interface{}     `db:"-" json:"-"`
	CreatedAt    time.Time       `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time       `db:"updated_at" json:"updated_at"`
}

Form defines the data for sending data to the API from the client side.

func (*Form) GetRecipients

func (f *Form) GetRecipients() []string

GetRecipients Splits the recipients string and returns a slice of email addresses.

type FormField

type FormField struct {
	Id         int           `db:"id" json:"id" binding:"numeric"` //nolint
	UUID       uuid.UUID     `db:"uuid" json:"uuid"`
	FormId     int           `db:"form_id" json:"-"` //nolint
	Key        string        `db:"key" json:"key" binding:"required"`
	Label      FormLabel     `db:"label" json:"label" binding:"required"`
	Type       string        `db:"type" json:"type" binding:"required"`
	Validation string        `db:"validation" json:"validation"`
	Required   types.BitBool `db:"required" json:"required"`
	Options    DBMap         `db:"options" json:"options"`
}

FormField defines a individual field from the pivot table.

type FormFields

type FormFields []FormField

FormFields represents the slice of FormField's.

type FormLabel

type FormLabel string

FormLabel defines the label/name for form fields.

func (FormLabel) Name

func (f FormLabel) Name() string

Name converts the label to a dynamic-struct friendly name.

func (FormLabel) String

func (f FormLabel) String() string

String is thg stringer on the FormLabel type

type FormSubmission

type FormSubmission struct {
	Id        int        `db:"id" json:"id" binding:"numeric"` //nolint
	UUID      uuid.UUID  `db:"uuid" json:"uuid"`
	FormId    int        `db:"form_id" json:"form_id"` //nolint
	Fields    FormValues `db:"fields" json:"fields"`
	IPAddress string     `db:"ip_address" json:"ip_address"`
	UserAgent string     `db:"user_agent" json:"user_agent"`
	SentAt    *time.Time `db:"sent_at" json:"sent_at"`
}

FormSubmission defines a submission of the of a form.

type FormSubmissions

type FormSubmissions []FormSubmission

FormSubmissions represents the slice of FormSubmission's.

type FormValues

type FormValues map[string]interface{}

func (FormValues) JSON

func (f FormValues) JSON() ([]byte, error)

func (FormValues) Scan

func (f FormValues) Scan(value interface{}) error

Scan

Scanner for FormValues. unmarshal the FormValues when the entity is pulled from the database.

func (FormValues) Value

func (f FormValues) Value() (driver.Value, error)

Value

Valuer for FormValues. marshal the FormValues when the entity is inserted to the database.

type Forms

type Forms []Form

Forms represents the slice of Form's.

type Layout

type Layout struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

Layout defines a page layout that are available from the theme's layouts directory.

type Layouts

type Layouts []Layout

Layouts represents the slice of Layout's.

type Media

type Media struct {
	Id          int        `db:"id" json:"id"` //nolint
	UUID        uuid.UUID  `db:"uuid" json:"uuid"`
	Url         string     `db:"url" json:"url"` //nolint
	Title       string     `db:"title" json:"title"`
	Alt         string     `db:"alt" json:"alt"`
	Description string     `db:"description" json:"description"`
	FilePath    string     `db:"file_path" json:"-"`
	FileSize    int64      `db:"file_size" json:"file_size"`
	FileName    string     `db:"file_name" json:"file_name"`
	Sizes       MediaSizes `db:"sizes" json:"sizes"`
	Mime        Mime       `db:"mime" json:"mime"`
	UserId      int        `db:"user_id" json:"user_id"` //nolint
	CreatedAt   time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time  `db:"updated_at" json:"updated_at"`
}

Media defines the core media entity for Verbis.

func (*Media) Extension

func (m *Media) Extension() string

Extension

Returns the extension of the file by stripping from the url.

func (*Media) IsOrganiseYearMonth

func (m *Media) IsOrganiseYearMonth() bool

IsOrganiseYearMonth

Returns a bool indicating if the file has been saved a year month path, i.e 2020/01.

func (*Media) PossibleFiles

func (m *Media) PossibleFiles() []string

PossibleFiles

Returns a the possible files saved to the system after the files have been uploaded. Note: This does not include the upload path.

func (*Media) UploadPath

func (m *Media) UploadPath() string

UploadPath

Returns the upload path of the media item without the storage uploads path, for example: 2020/01/photo.jpg

type MediaConfig

type MediaConfig struct {
	UploadPath       string   `yaml:"upload_path" json:"upload_path"`
	AllowedFileTypes []string `yaml:"allowed_file_types" json:"allowed_file_types"`
}

type MediaItems

type MediaItems []Media

MediaItems represents the slice of Media.

type MediaSize

type MediaSize struct {
	UUID     uuid.UUID `db:"uuid" json:"uuid"`
	Url      string    `db:"url" json:"url"` //nolint
	Name     string    `db:"name" json:"name"`
	SizeName string    `db:"size_name" json:"size_name"`
	FileSize int64     `db:"file_size" json:"file_size"`
	Width    int       `db:"width" json:"width"`
	Height   int       `db:"height" json:"height"`
	Crop     bool      `db:"crop" json:"crop"`
}

MediaSize defines an individual media size that's stored in the database.

type MediaSizeOptions

type MediaSizeOptions struct {
	Name   string `db:"name" json:"name" binding:"required,numeric"`
	Width  int    `db:"width" json:"width" binding:"required,numeric"`
	Height int    `db:"height" json:"height" binding:"required,numeric"`
	Crop   bool   `db:"crop" json:"crop"`
}

MediaSizeOptions defines the options for saving different image sizes when uploaded.

type MediaSizes

type MediaSizes map[string]MediaSize

MediaSizes defines the map of MediaSizes, by key value pair.

func (MediaSizes) Scan

func (m MediaSizes) Scan(value interface{}) error

Scan

Scanner for MediaSize. unmarshal the MediaSize when the entity is pulled from the database.

func (MediaSizes) Value

func (m MediaSizes) Value() (driver.Value, error)

Value

Valuer for MediaSize. marshal the MediaSize when the entity is inserted to the database.

type Mime

type Mime string

Mime TODO

func (Mime) CanResize

func (m Mime) CanResize() bool

CanResize

Returns true if the mime type is of JPG or PNG, determining if the image can be resized.

func (Mime) IsJPG

func (m Mime) IsJPG() bool

IsJPG

Returns true if the mime type is of JPG.

func (Mime) IsPNG

func (m Mime) IsPNG() bool

IsPNG

Returns true if the mime type is of PNG.

func (Mime) String

func (m Mime) String() string

String

Stringer on Mime type.

type OptionDB

type OptionDB struct {
	ID    int             `db:"id" json:"id"`
	Name  string          `db:"option_name" json:"option_name" binding:"required"`
	Value json.RawMessage `db:"option_value" json:"option_value" binding:"required"`
}

OptionDB represents a singular entity of an option that's stored in the database.

type Options

type Options struct {
	// Site
	SiteTitle       string `json:"site_title" binding:"required"`
	SiteDescription string `json:"site_description" binding:"required"`
	SiteUrl         string `json:"site_url" binding:"required,url"` //nolint
	// Theme
	ActiveTheme string `json:"active_theme" binding:"required"`
	Homepage    int    `json:"homepage"`
	// General
	GeneralLocale string `json:"general_locale" binding:"required"`
	// Contact
	ContactEmail     string `json:"contact_email" binding:"omitempty,email"`
	ContactTelephone string `json:"contact_telephone"`
	ContactAddress   string `json:"contact_address"`
	// Social
	SocialFacebook  string `json:"social_facebook" binding:"omitempty,url"`
	SocialTwitter   string `json:"social_twitter" binding:"omitempty,url"`
	SocialInstagram string `json:"social_instagram" binding:"omitempty,url"`
	SocialLinkedIn  string `json:"social_linkedin" binding:"omitempty,url"`
	SocialYoutube   string `json:"social_youtube" binding:"omitempty,url"`
	SocialPinterest string `json:"social_pinterest" binding:"omitempty,url"`
	// Code Injection
	CodeInjectionHead string `json:"codeinjection_head" binding:"omitempty"`
	CodeInjectionFoot string `json:"codeinjection_foot" binding:"omitempty"`
	// Meta
	MetaTitle               string `json:"meta_title" binding:"omitempty"`
	MetaDescription         string `json:"meta_description" binding:"omitempty"`
	MetaFacebookTitle       string `json:"meta_facebook_title" binding:"omitempty"`
	MetaFacebookDescription string `json:"meta_facebook_description" binding:"omitempty"`
	MetaFacebookImageId     int    `json:"meta_facebook_image_id" binding:"numeric"` //nolint
	MetaTwitterTitle        string `json:"meta_twitter_title" binding:"omitempty"`
	MetaTwitterDescription  string `json:"meta_twitter_description" binding:"omitempty"`
	MetaTwitterImageID      int    `json:"meta_twitter_image_id" binding:"omitempty,numeric"`
	// SEO
	SeoPrivate          bool     `json:"seo_private"`
	SeoSitemapServe     bool     `json:"seo_sitemap_serve"`
	SeoSitemapRedirects bool     `json:"seo_sitemap_redirects"`
	SeoSitemapExcluded  []string `json:"seo_sitemap_excluded"`
	SeoEnforceSlash     bool     `json:"seo_enforce_slash"`
	SeoRobotsServe      bool     `json:"seo_robots_serve"`
	SeoRobots           string   `json:"seo_robots"`
	// Breadcrumbs
	BreadcrumbsEnable       bool   `json:"breadcrumbs_enable"`
	BreadcrumbsTitle        string `json:"breadcrumbs_title"`
	BreadcrumbsSeparator    string `json:"breadcrumbs_separator"`
	BreadcrumbsHomepageText string `json:"breadcrumbs_homepage_text"`
	BreadcrumbsHideHomePage bool   `json:"breadcrumbs_hide_homepage"`
	// Media
	MediaCompression     int        `json:"media_compression" binding:"required"`
	MediaConvertWebP     bool       `json:"media_convert_webp"`
	MediaServeWebP       bool       `json:"media_serve_webp"`
	MediaUploadMaxSize   int64      `json:"media_upload_max_size" binding:"numeric"`
	MediaUploadMaxWidth  int64      `json:"media_upload_max_width" binding:"numeric"`
	MediaUploadMaxHeight int64      `json:"media_upload_max_height" binding:"numeric"`
	MediaOrganiseDate    bool       `json:"media_organise_year_month"`
	MediaSizes           MediaSizes `json:"media_images_sizes"`
	// Server Cache
	CacheServerTemplates bool `json:"cache_server_templates"`
	CacheServerFields    bool `json:"cache_server_field_layouts"`
	// Frontend Caching
	CacheFrontend          bool     `json:"cache_frontend"`
	CacheFrontendRequest   string   `json:"cache_frontend_request"`
	CacheFrontendSeconds   int64    `json:"cache_frontend_seconds"`
	CacheFrontendExtension []string `json:"cache_frontend_extensions"`
	// Gzip
	Gzip                   bool     `json:"gzip"`
	GzipCompression        string   `json:"gzip_compression"`
	GzipUsePaths           bool     `json:"gzip_use_paths"`
	GzipExcludedExtensions []string `json:"gzip_excluded_extensions"`
	GzipExcludedPaths      []string `json:"gzip_excluded_paths"`
	// Minify
	MinifyHTML bool `json:"minify_html"`
	MinifyJS   bool `json:"minify_js"`
	MinifyCSS  bool `json:"minify_css"`
	MinifySVG  bool `json:"minify_svg"`
	MinifyJSON bool `json:"minify_json"`
	MinifyXML  bool `json:"minify_xml"`
	// Forms
	FormSendEmailAddresses []string `json:"form_send_email_addresses"`
	FormFromEmailAddress   string   `json:"form_from_email_addresses"`
	FormEmailDisclosure    string   `json:"form_email_disclosure"`
}

Options defines the main system options defined in the store this is used throughout the application for user defined choices.

type OptionsDB

type OptionsDB []OptionDB

OptionsDB represents the slice of OptionDB's.

type OptionsDBMap

type OptionsDBMap map[string]interface{}

OptionsDBMap defines the map of key value pair options that are stored in the database, used for marshalling and unmarshalling into the Options struct.

type PasswordReset

type PasswordReset struct {
	Id        int       `db:"id" json:"-"` //nolint
	Email     string    `db:"email" json:"email" binding:"required,email"`
	Token     string    `db:"token" json:"token" binding:"required,email"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
}

PasswordReset defines the struct for interacting with the password resets table.

type Post

type Post struct {
	Id                int           `db:"id" json:"id" binding:"numeric"` //nolint
	UUID              uuid.UUID     `db:"uuid" json:"uuid"`
	Slug              string        `db:"slug" json:"slug" binding:"required,max=150"`
	Permalink         string        `db:"-" json:"permalink"`
	Title             string        `db:"title" json:"title" binding:"required,max=500"`
	Status            string        `db:"status" json:"status,omitempty"`
	Resource          string        `db:"resource" json:"resource"`
	PageTemplate      string        `db:"page_template" json:"page_template,omitempty" binding:"max=150"`
	PageLayout        string        `db:"layout" json:"layout,omitempty" binding:"required,max=150"`
	CodeInjectionHead string        `db:"codeinjection_head" json:"codeinjection_head,omitempty"`
	CodeInjectionFoot string        `db:"codeinjection_foot" json:"codeinjection_foot,omitempty"`
	UserId            int           `db:"user_id" json:"-"` //nolint
	IsArchive         types.BitBool `db:"archive" json:"archive"`
	PublishedAt       *time.Time    `db:"published_at" json:"published_at"`
	CreatedAt         time.Time     `db:"created_at" json:"created_at"`
	UpdatedAt         time.Time     `db:"updated_at" json:"updated_at"`
	SeoMeta           PostOptions   `db:"options" json:"options"`
}

Post defines the main page entity of Verbis.

func (*Post) IsPublic

func (p *Post) IsPublic() bool

IsPublic

Determines if the post is published.

type PostCreate

type PostCreate struct {
	Post
	Author   int        `json:"author,omitempty" binding:"numeric"`
	Category *int       `json:"category,omitempty" binding:"omitempty,numeric"`
	Fields   PostFields `json:"fields,omitempty"`
}

PostCreate defines the data when a post is created.

type PostData

type PostData []PostDatum

PostData represents the slice of PostDatum's.

type PostDatum

type PostDatum struct {
	Post     `json:"post"`
	Author   UserPart     `json:"author"`
	Category *Category    `json:"category"`
	Layout   []FieldGroup `json:"layout,omitempty"`
	Fields   PostFields   `json:"fields,omitempty"`
	Type     PostType     `json:"type"`
}

PostDatum defines the post including author, category, layout and field information.

func (*PostDatum) HasCategory

func (p *PostDatum) HasCategory() bool

HasCategory

Determines if a post has a category attached to it.

func (*PostDatum) HasResource

func (p *PostDatum) HasResource() bool

HasCategory

Determines if a post has any resources attached to it.

func (*PostDatum) IsHomepage

func (p *PostDatum) IsHomepage(id int) bool

IsHomepage

Determines if the post is the homepage by comparing the domain options.

func (*PostDatum) Tpl

func (p *PostDatum) Tpl() PostTemplate

Tpl

Converts a PostDatum to a PostTemplate and hides layouts.

type PostFacebook

type PostFacebook struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	ImageId     int    `json:"image_id,omitempty" binding:"numeric"` //nolint
}

PostFacebook defines the opengraph meta information used when calling the VerbisHeader.

type PostField

type PostField struct {
	//Id            int         `db:"id" json:"-"`      //nolint
	PostId        int         `db:"post_id" json:"-"` //nolint
	UUID          uuid.UUID   `db:"uuid" json:"uuid" binding:"required"`
	Type          string      `db:"type" json:"type"`
	Name          string      `db:"name" json:"name"`
	Key           string      `db:"field_key" json:"key"`
	Value         interface{} `json:"-"`
	OriginalValue FieldValue  `db:"value" json:"value"`
}

PostField defines the individual field that is attached to a post.

func (*PostField) IsValueJSON

func (f *PostField) IsValueJSON() bool

IsValueJSON

Determines if the value is valid JSON and has the key words - key and value.

func (*PostField) TypeIsInSlice

func (f *PostField) TypeIsInSlice(arr []string) bool

TypeIsInSlice

Determines if the given field values is in the slice passed.

type PostFields

type PostFields []PostField

PostFields represents the slice of PostField's.

type PostMeta

type PostMeta struct {
	Title       string       `json:"title,omitempty"`
	Description string       `json:"description,omitempty"`
	Twitter     PostTwitter  `json:"twitter,omitempty"`
	Facebook    PostFacebook `json:"facebook,omitempty"`
}

PostMeta defines the global meta information for the post used when calling the VerbisHeader.

func (*PostMeta) Scan

func (m *PostMeta) Scan(value interface{}) error

Scan

Scanner for PostMeta. unmarshal the PostMeta when the entity is pulled from the database.

func (*PostMeta) Value

func (m *PostMeta) Value() (driver.Value, error)

Value

Valuer for PostMeta. marshal the PostMeta when the entity is inserted to the database.

type PostOptions

type PostOptions struct {
	Id       int       `json:"-"`                            //nolint
	PostId   int       `json:"-" binding:"required|numeric"` //nolint
	Meta     *PostMeta `db:"meta" json:"meta"`
	Seo      *PostSeo  `db:"seo" json:"seo"`
	EditLock string    `db:"edit_lock" json:"edit_lock"`
}

PostOptions defines the global post options that includes post meta and post seo information.

type PostSeo

type PostSeo struct {
	Private        bool   `json:"private"`
	ExcludeSitemap bool   `json:"exclude_sitemap"`
	Canonical      string `json:"canonical"`
}

PostSeo defines the options for Seo on the post, including if the post is indexable, if it should appear in the sitemap and any canonical overrides.

func (*PostSeo) Scan

func (m *PostSeo) Scan(value interface{}) error

Scan

Scanner for PostSeo. unmarshal the PostSeo when the entity is pulled from the database.

func (*PostSeo) Value

func (m *PostSeo) Value() (driver.Value, error)

Value

Valuer for PostSeo. marshal the PostSeo when the entity is inserted to the database.

type PostTemplate

type PostTemplate struct {
	Post
	Author   UserPart
	Category *Category
	Fields   []PostField
}

PostTemplate defines the Post data for templates when they are used in the front end.

type PostTwitter

type PostTwitter struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	ImageId     int    `json:"image_id,omitempty" binding:"numeric"` //nolint
}

PostTwitter defines the twitter meta information used when calling the VerbisHeader.

type PostType

type PostType struct {
	PageType string
	Data     interface{}
}

PostType defines the type of page that has been served, It can be an archive, single, home, page or any type defined by the constants below.

type Posts

type Posts []Post

Posts represents the slice of Post's.

type Redirect

type Redirect struct {
	Id        int       `db:"id" json:"id"` //nolint
	From      string    `db:"from_path" json:"from_path" binding:"required"`
	To        string    `db:"to_path" json:"to_path" binding:"required"`
	Code      int       `db:"code" json:"code" binding:"required,numeric"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

Redirects defines the data used for redirecting http requests.

type Redirects

type Redirects []Redirect

Redirects represents the slice of Redirect's.

type Resource

type Resource struct {
	Name               string   `yaml:"name" json:"name"`
	FriendlyName       string   `yaml:"friendly_name" json:"friendly_name"`
	SingularName       string   `yaml:"singular_name" json:"singular_name"`
	Slug               string   `yaml:"slug" json:"slug"`
	Icon               string   `yaml:"icon" json:"icon"`
	Hidden             bool     `yaml:"hidden" json:"hidden"`
	HideCategorySlug   bool     `yaml:"hide_category_slug" json:"hide_category_slug"`
	AvailableTemplates []string `yaml:"available_templates" json:"available_templates"`
}

Resource defines an individual resource or custom post type declared in the theme config.

type Resources

type Resources map[string]Resource

Resources defines the map of resources declared in the theme config.

func (Resources) Clean

func (r Resources) Clean() Resources

Clean removes any forward slashes from the resource.

type Role

type Role struct {
	Id          int    `db:"id" json:"id" binding:"required,numeric"` //nolint
	Name        string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
}

Role defines the role a user has, from the pivot table.

type Roles

type Roles []Role

Roles represents the slice of Role's.

type Site

type Site struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"` //nolint
	Version     string `json:"version"`
}

Site defines the global Verbis object that is used in the public facing API (without credentials). The version is the version of Verbis the application is currently running.

type Template

type Template struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

Template defines a page template that are available from the theme's template directory.

type Templates

type Templates []Template

Templates represents the slice of Template.

type Theme

type Theme struct {
	Title       string `yaml:"title" json:"title"`
	Description string `yaml:"description" json:"description"`
	Version     string `yaml:"version" json:"version"`
	Screenshot  string `yaml:"-" json:"screenshot"`
	Name        string `yaml:"-" json:"name"`
	Active      bool   `yaml:"-" json:"active"`
}

Theme defines the information for the currently active theme.

type ThemeConfig

type ThemeConfig struct {
	Theme         Theme       `yaml:"theme" json:"theme"`
	Resources     Resources   `yaml:"resources" json:"resources"`
	AssetsPath    string      `yaml:"assets_path" json:"assets_path"`
	FileExtension string      `yaml:"file_extension" json:"file_extension"`
	TemplateDir   string      `yaml:"template_dir" json:"template_dir"`
	LayoutDir     string      `yaml:"layout_dir" json:"layout_dir"`
	Admin         AdminConfig `yaml:"admin" json:"admin"`
	Media         MediaConfig `yaml:"media" json:"media"`
	Editor        Editor      `yaml:"editor" json:"editor"`
}

ThemeConfig defines the data used for unmarshalling the config.yml file found in the theme's directory.

type Themes

type Themes []Theme

type User

type User struct {
	UserPart
	Password      string     `db:"password" json:"password,omitempty" binding:""`
	Token         string     `db:"token" json:"token,omitempty"`
	TokenLastUsed *time.Time `db:"token_last_used" json:"token_last_used,omitempty"`
}

User defines the main author entity for Verbis.

func (*User) HideCredentials

func (u *User) HideCredentials() UserPart

HideCredentials

Returns a new UserPart, hiding any sensitive information such as passwords and tokens.

func (*User) HidePassword

func (u *User) HidePassword()

HidePassword

Sets the users password to an empty string.

type UserCreate

type UserCreate struct {
	User
	Password        string `db:"password" json:"password,omitempty" binding:"required,min=8,max=60"`
	ConfirmPassword string `json:"confirm_password,omitempty" binding:"required,eqfield=Password,required"`
}

PostCreate defines the data when a user is created.

type UserPart

type UserPart struct {
	Id               int        `db:"id" json:"id"` //nolint
	UUID             uuid.UUID  `db:"uuid" json:"uuid"`
	FirstName        string     `db:"first_name" json:"first_name" binding:"required,max=150,alpha"`
	LastName         string     `db:"last_name" json:"last_name" binding:"required,max=150,alpha"`
	Email            string     `db:"email" json:"email" binding:"required,email,max=255"`
	Website          string     `db:"website" json:"website,omitempty" binding:"omitempty,url"`
	Facebook         string     `db:"facebook" json:"facebook"`
	Twitter          string     `db:"twitter" json:"twitter"`
	Linkedin         string     `db:"linked_in" json:"linked_in"`
	Instagram        string     `db:"instagram" json:"instagram"`
	Biography        string     `db:"biography" json:"biography"`
	Role             Role       `db:"roles" json:"role"`
	ProfilePictureID *int       `db:"profile_picture_id" json:"profile_picture_id"`
	EmailVerifiedAt  *time.Time `db:"email_verified_at" json:"email_verified_at"`
	CreatedAt        time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt        time.Time  `db:"updated_at" json:"updated_at"`
}

UserPart defines the User with non-sensitive information.

type UserPasswordReset

type UserPasswordReset struct {
	DBPassword      string `json:"-" binding:""`
	CurrentPassword string `json:"current_password" binding:"required,password"`
	NewPassword     string `json:"new_password" binding:"required,min=8,max=60"`
	ConfirmPassword string `json:"confirm_password" binding:"eqfield=NewPassword,required"`
}

UserPasswordReset defines the data for when a user resets their password.

type Users

type Users []User

Users represents the slice of User's.

func (Users) HideCredentials

func (u Users) HideCredentials() UsersParts

HideCredentials

Returns a slice of UserParts from the given input, hiding any sensitive information such as passwords and tokens.

type UsersParts

type UsersParts []UserPart

UsersParts represents the slice of UserPart's.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL