domain

package
v0.0.0-...-5aa591a Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func SendPasswordReset

func SendPasswordReset(secret string, user *User) error

Types

type AccessToken

type AccessToken struct {
	Id        string
	Token     string
	UserId    string
	CreatedAt time.Time
	UpdatedAt time.Time
}

An AccessToken is used for logins. It is used to call 1Backend daemon endpoints (not services running on 1Backend).

type AccessTokenDao

type AccessTokenDao struct {
	// contains filtered or unexported fields
}

func NewAccessTokenDao

func NewAccessTokenDao(db *gorm.DB) *AccessTokenDao

func (*AccessTokenDao) Create

func (at *AccessTokenDao) Create(model AccessToken) error

func (*AccessTokenDao) Delete

func (at *AccessTokenDao) Delete(id string) error

func (*AccessTokenDao) DeleteByToken

func (at *AccessTokenDao) DeleteByToken(token string) error

func (*AccessTokenDao) GetByToken

func (at *AccessTokenDao) GetByToken(token string) (AccessToken, error)

type Build

type Build struct {
	Id        string
	Output    string
	Success   bool
	ProjectId string
	// Version of the project at the time of the build
	Version    string
	InProgress bool
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

A Build is pretty much what the name says: a verification of the project when it's saved.

type Charge

type Charge struct {
	Id          string
	Amount      int
	UserId      string
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

A Charge is just a bookkeeping entitity - 1Backend saves one when a user pays for platform usage (if the given 1Backend installation is configured as a cloud provider)

type Comment

type Comment struct {
	Id        string
	IssueId   string
	Content   string
	UserId    string
	User      User
	Issue     Issue
	CreatedAt time.Time
	UpdatedAt time.Time
}

A Comment represents one comment out of the many that can belong to an `Issue`

type Dependency

type Dependency struct {
	Id        string
	ProjectId string
	Config    string
	Type      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

A Dependency is an infrastructural element (eg. SQL server)

type Endpoint

type Endpoint struct {
	Id          string
	Url         string
	Description string
	Method      string
	Code        string
	// JSON that defines the input structure
	Input string
	// JSON that defines the output structure
	Output    string
	ProjectId string
	CreatedAt time.Time
	UpdatedAt time.Time
}

An Endpoint is a lambda as a HTTP endpoint

type Issue

type Issue struct {
	Id           string
	ProjectId    string
	Title        string
	UserId       string
	User         User
	Comments     []Comment
	CommentCount int
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

An Issue is just like a GitHub repo issue, except it's for 1Backend services.

type Post

type Post struct {
	Id        string
	Title     string
	Slug      string
	Content   string
	UserId    string
	User      User
	CreatedAt time.Time
	UpdatedAt time.Time
}

A Post is a blog post that users can publish under their profile.

type Project

type Project struct {
	Id string
	// Password for infrastructural elements like mysql, redis etc
	InfraPassword string `json:"-"`
	// A secret value used to map projects to namespaces
	CallerId string `json:"-"`
	// Author name.
	Author string
	// Project name - make it nice, because it appears everywhere
	Name string
	// Project namespace. Defaults to `$AUTHOR:default`
	Namespace string
	Stars     int
	// Semver version of the project.
	Version string
	// A readme that appears on the front page
	ReadMe string
	// The port of the running instance for internal use.
	// Might have to extend this contept to support multiple instances.
	Port int
	// Private repos can only be read by their owner (no organisations yet)
	Public bool
	// Source code is visible to those who can view the project
	OpenSource bool
	// Short description of the project)
	Description string
	// Eg. go, nodejs, docker
	Mode string
	// Different setups inside the same tech (see language)
	Recipe string
	// Secrets as envars for open source applications with private keys
	Secrets string
	// eg. requires for nodejs or github imports for go apps
	Imports string
	// eg. package.json for nodejs apps
	Packages string
	// JSON that defines the types belonging to this project
	Types string
	// Source contains source code if the project mode/recipe does not use the code from the endpoints
	Source string
	// Github ssh for private code
	Endpoints    []Endpoint
	Builds       []Build
	Dependencies []Dependency
	Issues       []Issue
	CreatedAt    time.Time
	UpdatedAt    time.Time
	// Very stupid, I know
	Starrers []User `gorm:"many2many:stars;"`
}

A Project is a Go, Node, TypeScript etc. application

type Reset

type Reset struct {
	Id        string
	Secret    string
	UserId    string
	CreatedAt time.Time
	Used      bool
}

A Reset is used for password resets.

type ResetDao

type ResetDao struct {
	// contains filtered or unexported fields
}

func NewResetDao

func NewResetDao(db *gorm.DB) *ResetDao

func (*ResetDao) Create

func (ud *ResetDao) Create(u Reset) error

func (*ResetDao) GetById

func (ud *ResetDao) GetById(id string) (Reset, error)

func (*ResetDao) GetByIds

func (ud *ResetDao) GetByIds(ids []string) ([]Reset, error)

func (*ResetDao) GetBySecret

func (ud *ResetDao) GetBySecret(secret string) (Reset, error)

func (*ResetDao) Update

func (ud *ResetDao) Update(u Reset) error

type Star

type Star struct {
	Id        string
	UserId    string
	ProjectId string
}

A Star is used to express interest in a project (just like GitHub starring).

type Token

type Token struct {
	Id          string
	Token       string
	UserId      string
	Name        string // eg. "test", "xyz-app" etc. max 32 chars
	Description string
	Quota       int64 `gorm:"-"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

A Token or a service access token is like a service key used to call services running on 1Backend (not the 1Backend daemon itself).

type User

type User struct {
	Id         string
	Password   string `json:"-"`
	Nick       string
	Name       string
	Email      string
	AvatarLink string
	Tokens     []Token
	Posts      []Post
	Premium    bool
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

A User is a registered user of a 1Backend installation

type UserDao

type UserDao struct {
	// contains filtered or unexported fields
}

func NewUserDao

func NewUserDao(db *gorm.DB) *UserDao

func (*UserDao) Create

func (ud *UserDao) Create(u User) error

func (*UserDao) GetByEmail

func (ud *UserDao) GetByEmail(email string) (User, error)

func (*UserDao) GetById

func (ud *UserDao) GetById(id string) (User, error)

func (*UserDao) GetByIds

func (ud *UserDao) GetByIds(ids []string) ([]User, error)

func (*UserDao) GetByNick

func (ud *UserDao) GetByNick(nick string) (User, error)

func (*UserDao) OLDUpdate

func (ud *UserDao) OLDUpdate(u User) error

fck this

func (*UserDao) Update

func (ud *UserDao) Update(u User) error

Jump to

Keyboard shortcuts

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