model

package
v0.0.0-...-c7114d0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migration

func Migration()

Migration does database migrations

Types

type Category

type Category struct {
	config.Base
	Name          string   `json:"name" validate:"required"`
	Slug          string   `json:"slug" validate:"required"`
	Description   string   `json:"description"`
	IsForTemplate bool     `gorm:"column:is_for_template" json:"is_for_template"`
	SpaceID       uint     `gorm:"column:space_id" json:"space_id"`
	Space         *Space   `json:"space,omitempty"`
	Charts        []*Chart `gorm:"many2many:chart_category;" json:"charts"`
}

Category model

func (*Category) BeforeCreate

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

BeforeCreate hook

type Chart

type Chart struct {
	ID               string          `gorm:"primary_key" json:"id"`
	CreatedAt        time.Time       `json:"created_at"`
	UpdatedAt        time.Time       `json:"updated_at"`
	DeletedAt        *gorm.DeletedAt `sql:"index" json:"deleted_at" swaggertype:"primitive,string"`
	CreatedByID      uint            `gorm:"column:created_by_id" json:"created_by_id"`
	UpdatedByID      uint            `gorm:"column:updated_by_id" json:"updated_by_id"`
	Title            string          `json:"title"`
	Slug             string          `json:"slug"`
	Description      postgres.Jsonb  `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HtmlDescription  string          `gorm:"column:html_description" json:"html_description"`
	DataURL          string          `json:"data_url"`
	Config           postgres.Jsonb  `json:"config" swaggertype:"primitive,string"`
	Status           string          `json:"status"`
	IsPublic         bool            `gorm:"column:is_public" json:"is_public"`
	FeaturedMediumID *uint           `gorm:"column:featured_medium_id;default:NULL" json:"featured_medium_id"`
	Medium           *Medium         `gorm:"foreignKey:featured_medium_id" json:"medium"`
	TemplateID       string          `gorm:"column:template_id" json:"template_id"`
	Template         *Template       `gorm:"foreignKey:template_id;default:NULL" json:"template"`
	ThemeID          *uint           `gorm:"column:theme_id" json:"theme_id"`
	Theme            *Theme          `gorm:"foreignKey:theme_id;default:NULL" json:"theme"`
	PublishedDate    *time.Time      `gorm:"column:published_date" sql:"DEFAULT:NULL" json:"published_date"`
	Mode             string          `gorm:"column:mode" json:"mode"`
	SpaceID          uint            `gorm:"column:space_id" json:"space_id"`
	Space            *Space          `json:"space,omitempty"`
	Tags             []Tag           `gorm:"many2many:chart_tag;" json:"tags"`
	Categories       []Category      `gorm:"many2many:chart_category;" json:"categories"`
}

Chart model

func (*Chart) BeforeCreate

func (c *Chart) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Chart) BeforeSave

func (c *Chart) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - to check space for medium & theme

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"`
	Description string   `json:"description"`
	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"`
	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

type Organisation

type Organisation struct {
	config.Base
	Title       string           `json:"title"`
	Slug        string           `json:"slug"`
	Description string           `json:"description"`
	Permission  organisationUser `json:"permission"`
}

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 {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Permissions []Permission  `json:"permissions"`
	Subjects    []interface{} `json:"subjects"`
}

Policy model

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 Role

type Role struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Users       []User `json:"users"`
}

Role 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:"column: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"`
	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
	SpaceID uint   `gorm:"column:space_id" json:"space_id"`
	Space   *Space `gorm:"foreignKey:space_id" json:"space,omitempty"`
	Charts  int64  `gorm:"column:charts" json:"charts"`
}

SpacePermission model

func (*SpacePermission) BeforeCreate

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

BeforeCreate hook

type SpacePermissionRequest

type SpacePermissionRequest struct {
	Request
	Charts  int64  `gorm:"column:charts" json:"charts"`
	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   `json:"name"`
	Slug        string   `json:"slug"`
	Description string   `json:"description"`
	SpaceID     uint     `gorm:"column:space_id" json:"space_id"`
	Space       *Space   `json:"space,omitempty"`
	Charts      []*Chart `gorm:"many2many:chart_tag;" json:"charts"`
}

Tag model

func (*Tag) BeforeCreate

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

BeforeCreate hook

type Template

type Template struct {
	ID              string          `gorm:"primary_key" json:"id"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
	DeletedAt       *gorm.DeletedAt `sql:"index" json:"deleted_at" swaggertype:"primitive,string"`
	CreatedByID     uint            `gorm:"column:created_by_id" json:"created_by_id"`
	UpdatedByID     uint            `gorm:"column:updated_by_id" json:"updated_by_id"`
	Title           string          `json:"title"`
	Slug            string          `json:"slug"`
	Spec            postgres.Jsonb  `gorm:"column:spec" json:"spec" sql:"jsonb" swaggertype:"primitive,string"`
	Properties      postgres.Jsonb  `gorm:"column:properties" json:"properties" sql:"jsonb" swaggertype:"primitive,string"`
	CategoryID      uint            `gorm:"column:category_id" json:"category_id"`
	Category        Category        `gorm:"foreignKey:category_id" json:"category"`
	MediumID        *uint           `gorm:"column:medium_id;default:NULL" json:"medium_id"`
	Medium          *Medium         `gorm:"foreignKey:medium_id" json:"medium"`
	IsDefault       bool            `gorm:"column:is_default" json:"is_default"`
	Mode            string          `gorm:"column:mode" json:"mode"`
	Description     postgres.Jsonb  `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HtmlDescription string          `gorm:"column:html_description" json:"html_description"`
	SpaceID         uint            `gorm:"column:space_id" json:"space_id"`
	Space           *Space          `gorm:"foreignKey:space_id" json:"space,omitempty"`
}

Template model

func (*Template) BeforeCreate

func (t *Template) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Theme

type Theme struct {
	config.Base
	Name            string         `json:"name" validate:"required"`
	Config          postgres.Jsonb `json:"config" swaggertype:"primitive,string"`
	Description     postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HtmlDescription string         `gorm:"column:html_description" json:"html_description"`
	SpaceID         uint           `gorm:"column:space_id" json:"space_id"`
	Space           *Space         `json:"space,omitempty"`
}

Theme model

func (*Theme) BeforeCreate

func (theme *Theme) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type User

type User struct {
	config.Base
	Email     string `gorm:"column:email;unique_index" json:"email"`
	FirstName string `gorm:"column:first_name" json:"first_name"`
	LastName  string `gorm:"column:last_name" json:"last_name"`
	BirthDate string `gorm:"column:birth_date" json:"birth_date"`
	Gender    string `gorm:"column:gender" json:"gender"`
}

User model

Jump to

Keyboard shortcuts

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