models

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

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Base
	Info         string `json:"info" gorm:"default:'initial release'"`
	Type         string `json:"type" gorm:"default:'build'"`
	Email        string `json:"email"`
	UserID       uint   `json:"user_id"`
	RepositoryId uint   `json:"repository_id"`
}

func (*Activity) Log

func (activity *Activity) Log(db *gorm.DB, repository_id uint, user User, activity_type, info string)

type Base

type Base struct {
	ID        uint      `gorm:"primary_key" json:"id"`
	UUID      uuid.UUID `gorm:"type:uuid" json:"uuid"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Base struct to be used for all the dnow models

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

type Build

type Build struct {
	Base
	CommitHash   string `json:"commit_hash"`
	RepositoryID uint   `json:"repository_id"`
	Email        string `json:"email"`
	UserID       uint   `json:"user_id"`
}

type EmailToken

type EmailToken struct {
	Base
	UserID uint `json:"user_id"`
	Status bool `json:"status"`
}

type GithubAccount

type GithubAccount struct {
	Base
	UserID      uint   `gorm:"unique" json:"user_id"`
	AccessToken string `gorm:"unique" json:"access_token"`
	Login       string `gorm:"unique" json:"login"`
	NodeID      string `json:"node_id"`
	URL         string `json:"url"`
	AvatarURL   string `json:"avatar_url"`
}

type Repository

type Repository struct {
	Base
	RepositoryName string     `gorm:"unique" json:"repository_name"`
	BuildPack      string     `json:"buildpack" gorm:"default:'nodeJS'"`
	Path           string     `json:"path"`
	PathDocker     string     `json:"path_docker"`
	Description    string     `json:"description"`
	State          string     `json:"state" gorm:"default:'stopped'"`
	UserID         uint       `json:"user_id"`
	UserName       string     `json:"user_name"`
	ContainerID    string     `json:"container_id" gorm:"default:'0'"`
	DNSID          string     `json:"dns_id"`
	Variables      []Variable `json:"variables"`
	GithubLinked   bool       `json:"github_linked"`
	GithubURL      string     `json:"github_url"`
}

func (*Repository) AfterCreate

func (repo *Repository) AfterCreate(scope *gorm.Scope) (err error)

func (*Repository) AfterDelete

func (repository *Repository) AfterDelete(scope *gorm.Scope) (err error)

AfterCreate will set a UUID rather than numeric ID.

//TODO
1) Clean associated dirs
2) Add hook files
3) Lauch default container
4) Change owner ship to www-data

func (*Repository) BeforeCreate

func (repo *Repository) BeforeCreate(scope *gorm.Scope) (err error)

BeforeCreate will set a UUID rather than numeric ID.

func (*Repository) BeforeDelete

func (repository *Repository) BeforeDelete(scope *gorm.Scope) (err error)

type User

type User struct {
	Base
	UserName      string `gorm:"unique" json:"user_name"`
	Email         string `gorm:"unique" json:"email"`
	Password      string `json:"password"`
	MD5           string `json:"password_md5"`
	Verified      bool   `json:"verified" gorm:"default:false"`
	Repositories  []Repository
	GithubAccount GithubAccount
}

func (*User) AfterCreate

func (user *User) AfterCreate(scope *gorm.Scope) (err error)

AfterCreate will create user dir with www-data user.

//TODO
1) Create bare repository
2) Add hook files
3) Lauch default container
4) Change owner ship to www-data

func (*User) AfterDelete

func (user *User) AfterDelete(scope *gorm.Scope) (err error)

func (*User) AfterUpdate

func (user *User) AfterUpdate(scope *gorm.Scope) error

func (*User) BeforeDelete

func (user *User) BeforeDelete(scope *gorm.Scope) (err error)

func (*User) BeforeSave

func (user *User) BeforeSave(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

type Variable

type Variable struct {
	Base
	Key          string `json:"key"`
	Value        string `json:"value"`
	RepositoryID uint   `json:"repository_id"`
}

Jump to

Keyboard shortcuts

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