model

package
v0.0.0-...-be294a2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migration

func Migration()

Migration - core models

Types

type Author

type Author struct {
	config.Base
	Email            string         `gorm:"column:email;uniqueIndex" json:"email"`
	KID              string         `gorm:"column:kid;" json:"kid"`
	FirstName        string         `gorm:"column:first_name" json:"first_name"`
	LastName         string         `gorm:"column:last_name" json:"last_name"`
	Slug             string         `gorm:"column:slug" json:"slug"`
	DisplayName      string         `gorm:"column:display_name" json:"display_name"`
	BirthDate        string         `gorm:"column:birth_date" json:"birth_date"`
	Gender           string         `gorm:"column:gender" json:"gender"`
	FeaturedMediumID *uint          `gorm:"column:featured_medium_id;default:NULL" json:"featured_medium_id"`
	Medium           *Medium        `gorm:"foreignKey:featured_medium_id" json:"medium"`
	SocialMediaURLs  postgres.Jsonb `gorm:"column:social_media_urls" json:"social_media_urls" swaggertype:"primitive,string"`
	Description      string         `gorm:"column:description" json:"description"`
}

Author model

type Category

type Category struct {
	config.Base
	Name            string         `gorm:"column:name" json:"name"`
	Slug            string         `gorm:"column:slug" json:"slug"`
	Description     postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HTMLDescription string         `gorm:"column:html_description" json:"html_description,omitempty"`
	ParentID        *uint          `gorm:"column:parent_id;default:NULL" json:"parent_id"`
	MediumID        *uint          `gorm:"column:medium_id;default:NULL" json:"medium_id"`
	Medium          *Medium        `json:"medium"`
	IsFeatured      bool           `gorm:"column:is_featured" json:"is_featured"`
	SpaceID         uint           `gorm:"column:space_id" json:"space_id"`
	Posts           []*Post        `gorm:"many2many:post_categories;" json:"posts"`
	Space           *Space         `json:"space,omitempty"`
	MetaFields      postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
}

Category model

func (*Category) BeforeCreate

func (category *Category) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Category) BeforeSave

func (category *Category) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - validation for medium

type Event

type Event struct {
	config.Base
	Name  string            `json:"name"`
	Event string            `json:"event"`
	Tags  map[string]string `json:"tags"`
}

Event event model

type Format

type Format struct {
	config.Base
	Name        string         `gorm:"column:name" json:"name" validate:"required"`
	Slug        string         `gorm:"column:slug" json:"slug" validate:"required"`
	Description string         `gorm:"column:description" json:"description"`
	MetaFields  postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID     uint           `gorm:"column:space_id" json:"space_id"`
	Space       *Space         `json:"space,omitempty"`
}

Format model

func (*Format) BeforeCreate

func (format *Format) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Info

type Info struct {
	Categories int64       `gorm:"column:categories" json:"categories"`
	Tags       int64       `gorm:"column:tags" json:"tags"`
	Posts      []PostCount `gorm:"column:posts" json:"posts"`
	Podcasts   int64       `gorm:"column:podcasts" json:"podcasts"`
	Episodes   int64       `gorm:"column:episodes" json:"episodes"`
}

type KetoPolicy

type KetoPolicy struct {
	ID          string   `json:"id"`
	Subjects    []string `json:"subjects"`
	Actions     []string `json:"actions"`
	Resources   []string `json:"resources"`
	Effect      string   `json:"effect"`
	Description string   `json:"description"`
}

KetoPolicy model

type KetoRole

type KetoRole struct {
	ID      string   `json:"id"`
	Members []string `json:"members"`
}

KetoRole model

type Medium

type Medium struct {
	config.Base
	Name        string         `gorm:"column:name" json:"name"`
	Slug        string         `gorm:"column:slug" json:"slug"`
	Type        string         `gorm:"column:type" json:"type"`
	Title       string         `gorm:"column:title" json:"title"`
	Description string         `gorm:"column:description" json:"description"`
	Caption     string         `gorm:"column:caption" json:"caption"`
	AltText     string         `gorm:"column:alt_text" json:"alt_text"`
	FileSize    int64          `gorm:"column:file_size" json:"file_size"`
	URL         postgres.Jsonb `gorm:"column:url" json:"url" swaggertype:"primitive,string"`
	Dimensions  string         `gorm:"column:dimensions" json:"dimensions"`
	MetaFields  postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID     uint           `gorm:"column:space_id" json:"space_id"`
}

Medium model

func (*Medium) AfterCreate

func (media *Medium) AfterCreate(tx *gorm.DB) (err error)

AfterCreate hook

func (*Medium) AfterFind

func (media *Medium) AfterFind(tx *gorm.DB) (err error)

AfterFind hook

func (*Medium) BeforeCreate

func (media *Medium) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (Medium) TableName

func (Medium) TableName() string
type Menu struct {
	config.Base
	Name       string         `gorm:"column:name" json:"name" validate:"required"`
	Slug       string         `gorm:"column:slug" json:"slug" validate:"required"`
	Menu       postgres.Jsonb `gorm:"column:menu" json:"menu" swaggertype:"primitive,string"`
	SpaceID    uint           `gorm:"column:space_id" json:"space_id"`
	MetaFields postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	Space      *Space         `json:"space,omitempty"`
}

Menu model

func (menu *Menu) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Organisation

type Organisation struct {
	config.Base
	Title            string  `json:"title"`
	Slug             string  `json:"slug"`
	Description      string  `json:"description"`
	FeaturedMediumID *uint   `json:"featured_medium_id"`
	Medium           *Medium `json:"medium"`
}

Organisation model

type OrganisationPermission

type OrganisationPermission struct {
	config.Base
	OrganisationID uint  `gorm:"column:organisation_id" json:"organisation_id"`
	Spaces         int64 `gorm:"column:spaces" json:"spaces"`
}

OrganisationPermission model

func (*OrganisationPermission) BeforeCreate

func (op *OrganisationPermission) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type OrganisationPermissionRequest

type OrganisationPermissionRequest struct {
	Request
	OrganisationID uint  `gorm:"column:organisation_id" json:"organisation_id"`
	Spaces         int64 `gorm:"column:spaces" json:"spaces"`
}

OrganisationPermissionRequest model

func (*OrganisationPermissionRequest) BeforeCreate

func (opr *OrganisationPermissionRequest) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Permission

type Permission struct {
	Resource string   `json:"resource"`
	Actions  []string `json:"actions"`
}

Permission model

type Policy

type Policy struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Permissions []Permission `json:"permissions"`
	Users       []Author     `json:"users"`
}

Policy model

type Post

type Post struct {
	config.Base
	Title            string         `gorm:"column:title" json:"title"`
	Subtitle         string         `gorm:"column:subtitle" json:"subtitle"`
	Slug             string         `gorm:"column:slug" json:"slug"`
	Status           string         `gorm:"column:status" json:"status"`
	IsPage           bool           `gorm:"column:is_page" json:"is_page"`
	Excerpt          string         `gorm:"column:excerpt" json:"excerpt"`
	Description      postgres.Jsonb `gorm:"column:description" json:"description" sql:"jsonb" swaggertype:"primitive,string"`
	HTMLDescription  string         `gorm:"column:html_description" json:"html_description,omitempty"`
	IsFeatured       bool           `gorm:"column:is_featured" json:"is_featured"`
	IsSticky         bool           `gorm:"column:is_sticky" json:"is_sticky"`
	IsHighlighted    bool           `gorm:"column:is_highlighted" json:"is_highlighted"`
	FeaturedMediumID *uint          `gorm:"column:featured_medium_id;default:NULL" json:"featured_medium_id"`
	Medium           *Medium        `gorm:"foreignKey:featured_medium_id" json:"medium"`
	FormatID         uint           `gorm:"column:format_id" json:"format_id" sql:"DEFAULT:NULL"`
	Format           *Format        `json:"format"`
	PublishedDate    *time.Time     `gorm:"column:published_date" json:"published_date"`
	SpaceID          uint           `gorm:"column:space_id" json:"space_id"`
	Schemas          postgres.Jsonb `gorm:"column:schemas" json:"schemas" swaggertype:"primitive,string"`
	Meta             postgres.Jsonb `gorm:"column:meta" json:"meta" swaggertype:"primitive,string"`
	HeaderCode       string         `gorm:"column:header_code" json:"header_code"`
	FooterCode       string         `gorm:"column:footer_code" json:"footer_code"`
	MetaFields       postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	Tags             []Tag          `gorm:"many2many:post_tags;" json:"tags"`
	Categories       []Category     `gorm:"many2many:post_categories;" json:"categories"`
	Space            *Space         `json:"space,omitempty"`
}

Post model

func (*Post) BeforeCreate

func (post *Post) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Post) BeforeSave

func (post *Post) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - validation for associations

type PostAuthor

type PostAuthor struct {
	config.Base
	AuthorID uint `gorm:"column:author_id" json:"author_id"`
	PostID   uint `gorm:"column:post_id" json:"post_id"`
}

PostAuthor model

func (*PostAuthor) BeforeCreate

func (pa *PostAuthor) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type PostCount

type PostCount struct {
	Status string `json:"status"`
	Slug   string `json:"slug"`
	Count  int64  `json:"count"`
}

type Request

type Request struct {
	config.Base
	Title       string         `gorm:"column:title" json:"title"`
	Description postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	Status      string         `gorm:"column:status" json:"status"`
}

Request model

type Space

type Space struct {
	config.Base
	Name              string         `gorm:"column:name" json:"name"`
	Slug              string         `gorm:"column:slug" json:"slug"`
	SiteTitle         string         `gorm:"column:site_title" json:"site_title"`
	TagLine           string         `gorm:"column:tag_line" json:"tag_line"`
	Description       string         `gorm:"description" json:"description"`
	SiteAddress       string         `gorm:"column:site_address" json:"site_address"`
	LogoID            *uint          `gorm:"column:logo_id;default:NULL" json:"logo_id"`
	LogoMobileID      *uint          `gorm:"column:logo_mobile_id;default:NULL" json:"logo_mobile_id"`
	LogoMobile        *Medium        `gorm:"foreignKey:logo_mobile_id" json:"logo_mobile"`
	FavIconID         *uint          `gorm:"column:fav_icon_id;default:NULL" json:"fav_icon_id"`
	FavIcon           *Medium        `gorm:"foreignKey:fav_icon_id" json:"fav_icon"`
	MobileIconID      *uint          `gorm:"column:mobile_icon_id;default:NULL" json:"mobile_icon_id"`
	MobileIcon        *Medium        `gorm:"foreignKey:mobile_icon_id" json:"mobile_icon"`
	VerificationCodes postgres.Jsonb `gorm:"column:verification_codes" json:"verification_codes" swaggertype:"primitive,string"`
	SocialMediaURLs   postgres.Jsonb `gorm:"column:social_media_urls" json:"social_media_urls" swaggertype:"primitive,string"`
	ContactInfo       postgres.Jsonb `gorm:"column:contact_info" json:"contact_info" swaggertype:"primitive,string"`
	Analytics         postgres.Jsonb `gorm:"column:analytics" json:"analytics" swaggertype:"primitive,string"`
	HeaderCode        string         `gorm:"column:header_code" json:"header_code"`
	FooterCode        string         `gorm:"column:footer_code" json:"footer_code"`
	MetaFields        postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	OrganisationID    int            `gorm:"column:organisation_id" json:"organisation_id"`
}

Space model

func (*Space) BeforeCreate

func (space *Space) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Space) BeforeUpdate

func (space *Space) BeforeUpdate(tx *gorm.DB) (e error)

BeforeUpdate checks if all associated mediums are in same space

type SpacePermission

type SpacePermission struct {
	config.Base
	FactCheck bool   `gorm:"column:fact_check" json:"fact_check"`
	SpaceID   uint   `gorm:"column:space_id" json:"space_id"`
	Space     *Space `gorm:"foreignKey:space_id" json:"space,omitempty"`
	Media     int64  `gorm:"column:media" json:"media"`
	Posts     int64  `gorm:"column:posts" json:"posts"`
	Podcast   bool   `gorm:"column:podcast" json:"podcast"`
	Episodes  int64  `gorm:"column:episodes" json:"episodes"`
}

SpacePermission model

func (*SpacePermission) BeforeCreate

func (sp *SpacePermission) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type SpacePermissionRequest

type SpacePermissionRequest struct {
	Request
	Media     int64  `gorm:"column:media" json:"media"`
	Posts     int64  `gorm:"column:posts" json:"posts"`
	Episodes  int64  `gorm:"column:episodes" json:"episodes"`
	Podcast   bool   `gorm:"column:podcast" json:"podcast"`
	FactCheck bool   `gorm:"column:fact_check" json:"fact_check"`
	SpaceID   uint   `gorm:"column:space_id" json:"space_id"`
	Space     *Space `gorm:"foreignKey:space_id" json:"space,omitempty"`
}

SpacePermissionRequest model

func (*SpacePermissionRequest) BeforeCreate

func (spr *SpacePermissionRequest) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Tag

type Tag struct {
	config.Base
	Name            string         `gorm:"column:name" json:"name" validate:"required"`
	Slug            string         `gorm:"column:slug" json:"slug" validate:"required"`
	Description     postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HTMLDescription string         `gorm:"column:html_description" json:"html_description,omitempty"`
	IsFeatured      bool           `gorm:"column:is_featured" json:"is_featured"`
	MetaFields      postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID         uint           `gorm:"column:space_id" json:"space_id"`
	Space           *Space         `json:"space,omitempty"`
	Posts           []*Post        `gorm:"many2many:post_tags;" json:"posts"`
}

Tag model

func (*Tag) BeforeCreate

func (tag *Tag) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Webhook

type Webhook struct {
	config.Base
	Name    string            `json:"name"`
	URL     string            `json:"url"`
	Enabled bool              `json:"enabled"`
	Events  []Event           `json:"events"`
	Tags    map[string]string `json:"tags"`
}

Webhook webhook model

type WebhookLog

type WebhookLog struct {
	ID                 uint           `gorm:"primary_key" json:"id"`
	CreatedAt          time.Time      `json:"created_at"`
	CreatedByID        uint           `gorm:"column:created_by_id" json:"created_by_id"`
	Event              string         `gorm:"column:event" json:"event"`
	URL                string         `gorm:"column:url" json:"url"`
	ResponseStatusCode int            `gorm:"column:response_status_code" json:"response_status_code"`
	Data               postgres.Jsonb `gorm:"column:data" json:"data" swaggertype:"primitive,string"`
	ResponseBody       postgres.Jsonb `gorm:"column:response_body" json:"response_body" swaggertype:"primitive,string"`
	Tags               postgres.Jsonb `gorm:"column:tags" json:"tags" swaggertype:"primitive,string"`
}

WebhookLog model

Jump to

Keyboard shortcuts

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