models

package
v0.0.0-...-2c98600 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const KEYS_NUMBER = 5
View Source
const MAX_FILESIZE = 1000000000 //in bytes = 1 GB

Variables

View Source
var ACCEPTABLE_FILETYPES = map[string][]string{

	"image": {
		"png",
		"jpg",
		"jp2",
		"jpeg",
		"gif",
		"bmp",
		"wbmp",
		"pgm",
	},

	"video": {
		"webm",
		"mkv",
		"flv",
		"vob",
		"ogv",
		"ogg",
		"gifv",
		"avi",
		"mng",
		"mov",
		"wmv",
		"mp4",
		"m4p",
		"m4v",
		"mpg",
		"mp2",
		"mpeg",
		"mpe",
		"mpv",
		"m2v",
		"m4v",
	},

	"audio": {
		"3gp",
		"aa",
		"aac",
		"aiff",
		"dvf",
		"flac",
		"gsm",
		"m4a",
		"m4b",
		"m4p",
		"mmf",
		"mp3",
		"ogg",
		"oga",
		"mogg",
		"raw",
		"tta",
		"voc",
		"vox",
		"wav",
		"wma",
		"wv",
		"webm",
	},
}

DB is a connection to your database to be used throughout your application.

View Source
var TRUSTEE_RELATIONSHIP_TYPES = []string{
	"father",
	"mother",
	"other_relative",
	"best_friend",
	"school_friend",
	"college_friend",
	"other_friend",
	"husband",
	"wife",
	"girlfriend",
	"boyfriend",
	"fiance",
	"acquaintance",
}

Functions

func NullableToString

func NullableToString(s nulls.String) *string

Types

type File

type File struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	OwnerID  uuid.UUID `json:"owner_id" db:"owner_id"`
	Url      string    `json:"url" db:"url"`
	Filename string    `json:"filename" db:"filename"`
	Path     string    `json:"path" db:"path"`
	Type     string    `json:"type" db:"type"`
	FileSize int64     `json:"file_size" db:"file_size"`
}

func (*File) Create

func (f *File) Create(tx *pop.Connection, userID uuid.UUID) (*validate.Errors, error)

Creates file entry in the DB

func (File) String

func (f File) String() string

String is not required by pop and may be deleted

func (*File) Validate

func (f *File) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*File) ValidateCreate

func (f *File) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*File) ValidateUpdate

func (f *File) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Files

type Files []File

Files is not required by pop and may be deleted

func (Files) String

func (f Files) String() string

String is not required by pop and may be deleted

type Instruction

type Instruction struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	Index   uint   `json:"index" db:"index"`
	Text    string `json:"text" db:"content"`
	Picture *File  `json:"picture" db:"-"`
	Audio   *File  `json:"audio" db:"-"`
	Video   *File  `json:"video" db:"-"`

	WillID uuid.UUID `json:"will_id" db:"will_id"`
}

func (*Instruction) Create

func (i *Instruction) Create(tx *pop.Connection, w Will) (*validate.Errors, error)

Creates instruction entry in the DB

func (Instruction) String

func (i Instruction) String() string

String is not required by pop and may be deleted

func (*Instruction) Validate

func (i *Instruction) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Instruction) ValidateCreate

func (i *Instruction) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Instruction) ValidateUpdate

func (i *Instruction) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Instructions

type Instructions []Instruction

Instructions is not required by pop and may be deleted

func (*Instructions) Create

func (is *Instructions) Create(tx *pop.Connection, w Will) (*validate.Errors, error)

func (Instructions) String

func (i Instructions) String() string

String is not required by pop and may be deleted

type Session

type Session struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	UserID uuid.UUID `json:"user_id" db:"user_id"`

	UniqueToken nulls.String `json:"unique_token" db:"unique_token"` //used only in registration/login

	RefreshToken     string `json:"refresh_token" db:"-"`
	RefreshTokenHash []byte `json:"-" db:"refresh_token"`
}

func (*Session) Create

func (s *Session) Create(tx *pop.Connection, u *User, protected bool) error

func (*Session) ResetUniqueToken

func (s *Session) ResetUniqueToken(tx *pop.Connection) error

func (Session) String

func (s Session) String() string

String is not required by pop and may be deleted

func (*Session) TableName

func (s *Session) TableName() string

func (*Session) Validate

func (s *Session) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Session) ValidateCreate

func (s *Session) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Session) ValidateUpdate

func (s *Session) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Sessions

type Sessions []Session

Sessions is not required by pop and may be deleted

func (Sessions) String

func (s Sessions) String() string

String is not required by pop and may be deleted

type Trustee

type Trustee struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	UserID uuid.UUID `json:"user_id" db:"user_id"`

	Name           string       `json:"name" db:"name"`
	Relationship   string       `json:"relationship" db:"relationship"`
	Phone          string       `json:"phone" db:"phone"`
	Email          string       `json:"email" db:"email"`
	FacebookLink   nulls.String `json:"facebook_link" db:"facebook_link"`
	TwitterLink    nulls.String `json:"twitter_link" db:"twitter_link"`
	AdditionalInfo nulls.String `json:"additional_info" db:"additional_information"`
}

func (*Trustee) Create

func (t *Trustee) Create(tx *pop.Connection, userID uuid.UUID) (*validate.Errors, error)

Creates trustee entry in the DB

func (Trustee) String

func (t Trustee) String() string

String is not required by pop and may be deleted

func (Trustee) ToGraphQL

func (t Trustee) ToGraphQL() *model.Trustee

func (*Trustee) Update

func (t *Trustee) Update(tx *pop.Connection) (*validate.Errors, error)

Updates trustee entry in the DB

func (*Trustee) Validate

func (t *Trustee) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Trustee) ValidateCreate

func (t *Trustee) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Trustee) ValidateUpdate

func (t *Trustee) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Trustees

type Trustees []Trustee

Trustees is not required by pop and may be deleted

func (*Trustees) GetForUser

func (t *Trustees) GetForUser(tx *pop.Connection, userID uuid.UUID, orderBy string, order string) error

func (Trustees) String

func (t Trustees) String() string

String is not required by pop and may be deleted

func (Trustees) ToGraphQL

func (ts Trustees) ToGraphQL() []*model.Trustee

type User

type User struct {
	ID uuid.UUID `json:"id" db:"id"`

	ProviderID string `json:"-" db:"provider_id"`
	Provider   string `json:"provider" db:"provider"`
	Name       string `json:"name" db:"username"`

	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

func (*User) Create

func (u *User) Create(tx *pop.Connection) (*validate.Errors, error)

Creates user and userConfirmation DB entries

func (User) String

func (u User) String() string

String is not required by pop and may be deleted

func (User) TableName

func (u User) TableName() string

func (*User) Validate

func (u *User) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*User) ValidateCreate

func (u *User) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*User) ValidateUpdate

func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type UserConfirmation

type UserConfirmation struct {
	ID uuid.UUID `json:"id" db:"id"`

	UserID uuid.UUID `json:"user_id" db:"user_id"`

	Keys                 string `json:"-" db:"-"`
	KeysEncrypted        []byte `json:"-" db:"keys"`
	KeysSent             bool   `json:"keys_sent" db:"keys_sent"`
	KeysSeenConfirmation bool   `json:"keys_seen_confirmation" db:"keys_seen"`
	Confirmed            bool   `json:"confirmed" db:"confirmed"`

	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}

func (*UserConfirmation) CheckKeysMatch

func (u *UserConfirmation) CheckKeysMatch(keys string) (bool, error)

func (*UserConfirmation) Confirm

func (u *UserConfirmation) Confirm(tx *pop.Connection) error

func (*UserConfirmation) Create

func (u *UserConfirmation) Create(tx *pop.Connection, user *User) error

func (*UserConfirmation) SendKeys

func (u *UserConfirmation) SendKeys(tx *pop.Connection) error

func (*UserConfirmation) SetSeen

func (u *UserConfirmation) SetSeen(tx *pop.Connection) error

func (UserConfirmation) String

func (u UserConfirmation) String() string

String is not required by pop and may be deleted

func (*UserConfirmation) Validate

func (u *UserConfirmation) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*UserConfirmation) ValidateCreate

func (u *UserConfirmation) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*UserConfirmation) ValidateUpdate

func (u *UserConfirmation) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type UserConfirmations

type UserConfirmations []UserConfirmation

UserConfirmations is not required by pop and may be deleted

func (UserConfirmations) String

func (u UserConfirmations) String() string

String is not required by pop and may be deleted

type Users

type Users []User

Users is not required by pop and may be deleted

func (Users) String

func (u Users) String() string

String is not required by pop and may be deleted

type Will

type Will struct {
	ID        uuid.UUID `json:"id" db:"id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	Title    string       `json:"title" db:"title"`
	Priority nulls.UInt32 `json:"importance" db:"priority"`

	Instructions *Instructions `json:"instructions" db:"-"`
	Pictures     *File         `json:"pictures" db:"-"`
	Videos       *File         `json:"videos" db:"-"`
	Audios       *File         `json:"audios" db:"-"`

	UserID   uuid.UUID `json:"user_id" db:"user_id"`
	Trustees *Trustees `json:"trustees" db:"-"`
}

func (*Will) Create

func (w *Will) Create(tx *pop.Connection) (*validate.Errors, error)

Creates instruction entry in the DB

func (Will) String

func (w Will) String() string

String is not required by pop and may be deleted

func (*Will) Validate

func (w *Will) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method. This method is not required and may be deleted.

func (*Will) ValidateCreate

func (w *Will) ValidateCreate(tx *pop.Connection) (*validate.Errors, error)

ValidateCreate gets run every time you call "pop.ValidateAndCreate" method. This method is not required and may be deleted.

func (*Will) ValidateUpdate

func (w *Will) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method. This method is not required and may be deleted.

type Wills

type Wills []Will

Wills is not required by pop and may be deleted

func (Wills) String

func (w Wills) String() string

String is not required by pop and may be deleted

Jump to

Keyboard shortcuts

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