models

package
v0.0.0-...-db524d0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EmptyOrganisation empty org var
	EmptyOrganisation = Organisation{}
)
View Source
var (

	// EmptyUser em user
	EmptyUser = User{}
)

Functions

func IsValidAlphaNum

func IsValidAlphaNum(s string, allowUnderscores bool) bool

IsValidAlphaNum Check that string is correct lower case alpha numeric chain

func IsValidEmail

func IsValidEmail(email string) bool

IsValidEmail check email validity

func IsValidOrganisationIdentifier

func IsValidOrganisationIdentifier(s string) bool

IsValidOrganisationIdentifier check if string provided is a correct organisation identifier

func IsValidUsername

func IsValidUsername(user string) bool

IsValidUsername will check if provided userName is correct

Types

type Organisation

type Organisation struct {
	// id of the organisation
	//
	// min: 0
	IDOrganisation uint64 `gorm:"primary_key;column:idOrganisation;AUTO_INCREMENT" json:"id,omitempty"`
	// Stack into docker swarm
	//
	// required: true
	//min: 0
	DockerStack int `gorm:"column:dockerStack;not null;unique" json:"docker_stack,omitempty"`
	// required: true
	OrganisationName string `gorm:"column:organisationName;not null;unique" json:"name,omitempty"`
	// State if organisation is free to join or not. Default is private (false).
	Public      bool   `gorm:"column:public; not null" json:"public"`
	Description string `gorm:"column:description" json:"description,omitempty"`
	Avatar      string `gorm:"column:avatar" json:"avatar,omitempty"`
	// Domain name of the organisation
	Domain string `gorm:"column:domain" json:"domain,omitempty"`
}

Organisation object

Describe organisation you are in. It is an unique object in the database.

swagger:model

func OganisationFromJSON

func OganisationFromJSON(data io.Reader) *Organisation

OganisationFromJSON Try to parse a json object as emoji

func (*Organisation) Bind

func (organisation *Organisation) Bind(r *http.Request) error

Bind method used in API

func (*Organisation) IsValid

func (organisation *Organisation) IsValid() *u.AppError

IsValid is used to check validity of Organisation objects

func (*Organisation) PreSave

func (organisation *Organisation) PreSave()

PreSave is used to add some default values to organisation before saving in DB (creation).

func (*Organisation) ToJSON

func (organisation *Organisation) ToJSON() string

ToJSON transfoorm an Organisation into JSON

type User

type User struct {
	// id of the user
	//
	// min: 0
	IDUser uint64 `gorm:"primary_key;column:idUser;AUTO_INCREMENT" json:"id,omitempty"`
	// User name
	//
	// required: true
	// max length: 64
	Username string `gorm:"column:userName; not null; unique;" json:"username,omitempty"`
	// User email
	//
	// required: true
	// max lenght: 128
	Email string `gorm:"column:email; not null; unique;" json:"email,omitempty"`
	// State if email was verified
	//
	// required: true
	EmailVerified bool `gorm:"column:emailVerified; not null;" json:"email_verified,omitempty"`
	// User is deleted from organisation but still in database
	//
	// required: true
	Deleted bool `gorm:"column:deleted; not null;" json:"deleted,omitempty"`
	// Avatar used by user
	Avatar string `gorm:"column:avatar;" json:"avatar, omitempty"`
	// User nickname
	NickName string `gorm:"column:nickName; unique" json:"nickname, omitempty"`
	// First name
	FirstName string `gorm:"column:firstName;" json:"first_name, omitempty"`
	// User Lastname
	LastName     string         `gorm:"column:lastName;" json:"last_name, omitempty"`
	Organisation []Organisation `gorm:"ForeignKey:IDOrganisation;AssociationForeignKey:Refer" db:"-" json:"-"`
	// Org key of user in the organisation
	//
	// required: true
	IDOrganisation uint64 `gorm:"column:idOrganisation; not null;" json:"id_organisation,omitempty"`
}

User object.

An user is an account who have an access to a specific organisation. Each user is unique inside a given organisation, but users are not shared between organisations. Required apply only for creation of the object.

swagger:model

func UserFromJSON

func UserFromJSON(data io.Reader) *User

UserFromJSON will decode the input and return a user

func (*User) Bind

func (user *User) Bind(r *http.Request) error

Bind method used in API to manage request.

func (*User) IsValid

func (user *User) IsValid(isUpdate bool) *u.AppError

IsValid valwebIDates the user and returns an error if it isn't configured correctly.

func (*User) PreSave

func (user *User) PreSave()

PreSave have to be run before saving user in DB. It will fill necessary information (webID, username, etc. ) and hash password

func (*User) ToJSON

func (user *User) ToJSON() string

ToJSON convert a user to a json string

Jump to

Keyboard shortcuts

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