cms

package module
v0.0.0-...-281c92d Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 7 Imported by: 3

README

Headless CMS

This is an attempt to make a Headless CMS in go.

API documentation

You can find the API documentation here.

Requirements

  • Go 1.10
  • dep for installing the dependencies
  • go-swagger for generating the server stubs
  • A database, e.g. PostgreSQL

Running the project

First, generate the server stub from the swagger definition

./gen.sh

Install the dependencies using dep

dep ensure

Build the executable

./build.sh

Run the binary

./main

Run --help to check the available parameters

./main --help
Usage of main:
  -database string
        The database name (default "cms")
  -db-host string
        The database hostname (default "localhost")
  -db-port string
        The database port (default "5432")
  -dialect string
        The database dialect (default "postgres")
  -pass string
        The database password (default "test")
  -port int
        Port to run this service on (default 3000)
  -user string
        The database username (default "test")

Dashboard

You can find a dashboard for the project here.

Built using

License

Open sourced under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JWTTokenExpiryTime time.Duration = 7 * 24 * time.Hour
)

Functions

func InitDatabase

func InitDatabase(db *gorm.DB, config DatabaseConfig) error

InitDatabase initializes the database

func NewDatabase

func NewDatabase(config DatabaseConfig) (*gorm.DB, error)

Types

type DatabaseConfig

type DatabaseConfig struct {
	Dialect string
	Source  string
	Debug   bool
}

DatabaseConfig contains the database settings

type Service

type Service interface {
	// Account
	CreateAccount(*models.Account) (string, error)
	AuthenticateAccount(*models.Account) (string, error)

	// Project
	CreateProject(*models.Project) error
	UpdateProject(*models.Project) error
	GetProject(*models.Project) error
	GetProjectList() ([]models.Project, error)
	DeleteProject(*models.Project) error

	// Role
	CreateRole(*models.Role) error
	UpdateRole(*models.Role) error
	GetRole(*models.Role) error
	GetRoleList(uint) ([]models.Role, error)
	DeleteRole(*models.Role) error

	// User
	CreateUser(*models.User) error
	UpdateUser(*models.User) error
	GetUser(*models.User) error
	GetUserList(uint) ([]models.User, error)
	DeleteUser(*models.User) error

	// Item Type
	CreateItemType(*models.ItemType) error
	UpdateItemType(*models.ItemType) error
	GetItemTypeList(uint) ([]models.ItemType, error)
	GetItemType(*models.ItemType) error
	DuplicateItemType(*models.ItemType) error
	DeleteItemType(*models.ItemType) error

	// Field
	CreateField(*models.Field) error
	UpdateField(*models.Field) error
	GetFieldList(itemTypeID uint, projectID uint) ([]models.Field, error)
	GetProjectFieldList(projectID uint, filter models.FilterOptions) ([]models.Field, error)
	GetField(*models.Field) error
	DeleteField(*models.Field) error

	// Item
	CreateItem(*models.Item) error
	UpdateItem(*models.Item) error
	GetItemList(projectID uint, filter models.ItemFilterOptions) (int, []models.Item, error)
	GetItem(*models.Item) error
	DeleteItem(*models.Item) error
}

func NewService

func NewService(db *gorm.DB, config config.Config) Service

Directories

Path Synopsis
api
gen
restapi
Package restapi Headless CMS Schemes: http Host: 127.0.0.1:8080 BasePath: /api Version: 1.0.0 Consumes: - application/json Produces: - application/json swagger:meta
Package restapi Headless CMS Schemes: http Host: 127.0.0.1:8080 BasePath: /api Version: 1.0.0 Consumes: - application/json Produces: - application/json swagger:meta

Jump to

Keyboard shortcuts

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