models

package
v0.0.0-...-c210651 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AuthPayload

type AuthPayload struct {
	// JWT authorization token
	Token string `json:"token"`
	// Signed in user
	User *User `json:"user"`
}

type File

type File struct {
	ID            string `json:"id" gorm:"type:varchar(20);primaryKey;not null"`
	Name          string `json:"name" gorm:"type:varchar(255);not null"`
	MimeType      string `json:"mimeType" gorm:"type:varchar(127);not null"`
	Extension     string `json:"extension" gorm:"type:varchar(10);not null"`
	Size          int64  `json:"size" gorm:"type:bigint; not null"`
	FileTags      []FileTag
	Collaborators []FileCollaborator
	CreatedAt     time.Time  `json:"createdAt"`
	UpdatedAt     time.Time  `json:"updatedAt"`
	DeletedAt     *time.Time `json:"deletedAt"`
}

type FileCollaborator

type FileCollaborator struct {
	FileID         string     `json:"fileId" gorm:"foreignKey;uniqueIndex:file_collaborator;not null"`
	CollaboratorID string     `json:"collaboratorId" gorm:"foreignKey;uniqueIndex:file_collaborator;not null"`
	Permission     int8       `json:"permission" gorm:"type:tinyint;not null"`
	CreatedAt      time.Time  `json:"createdAt"`
	UpdatedAt      time.Time  `json:"updatedAt"`
	DeletedAt      *time.Time `json:"deletedAt"`
}

type FileCollaboratorConnection

type FileCollaboratorConnection struct {
	Edges    []*FileCollaboratorEdge `json:"edges"`
	Nodes    []*User                 `json:"nodes"`
	PageInfo *PageInfo               `json:"pageInfo"`
}

type FileCollaboratorEdge

type FileCollaboratorEdge struct {
	Cursor     string         `json:"cursor"`
	Node       *User          `json:"node"`
	Permission FilePermission `json:"permission"`
}

type FileCollaboratorInput

type FileCollaboratorInput struct {
	FileID         string         `json:"fileId" validate:"required,alphanum,len=20"`
	CollaboratorID string         `json:"collaboratorId" validate:"required,alphanum,len=20"`
	Permission     FilePermission `json:"permission"`
}

type FileConnection

type FileConnection struct {
	Edges    []*FileEdge `json:"edges"`
	Nodes    []*File     `json:"nodes"`
	PageInfo *PageInfo   `json:"pageInfo"`
}

type FileEdge

type FileEdge struct {
	Cursor string `json:"cursor"`
	Node   *File  `json:"node"`
}

type FileInput

type FileInput struct {
	Name string         `json:"name" validate:"omitempty,filename,min=1,max=255"`
	File graphql.Upload `json:"file" validate:"required"`
}

type FilePermission

type FilePermission string
const (
	FilePermissionAdmin    FilePermission = "ADMIN"
	FilePermissionMaintain FilePermission = "MAINTAIN"
	FilePermissionWrite    FilePermission = "WRITE"
	FilePermissionRead     FilePermission = "READ"
)

func (FilePermission) IsValid

func (e FilePermission) IsValid() bool

func (FilePermission) MarshalGQL

func (e FilePermission) MarshalGQL(w io.Writer)

func (FilePermission) String

func (e FilePermission) String() string

func (*FilePermission) UnmarshalGQL

func (e *FilePermission) UnmarshalGQL(v interface{}) error

type FileTag

type FileTag struct {
	FileID  string `json:"fileId" gorm:"foreignKey;uniqueIndex:file_tag;not null"`
	TagName string `json:"tagName" gorm:"foreignKey;uniqueIndex:file_tag;not null"`
}

type FileTagConnection

type FileTagConnection struct {
	Edges    []*FileTagEdge `json:"edges"`
	Nodes    []*Tag         `json:"nodes"`
	PageInfo *PageInfo      `json:"pageInfo"`
}

type FileTagEdge

type FileTagEdge struct {
	Cursor string `json:"cursor"`
	Node   *Tag   `json:"node"`
}

type FileTagsInput

type FileTagsInput struct {
	FileID   string   `json:"fileId" validate:"required,alphanum,len=20"`
	TagNames []string `json:"tagNames" validate:"required,dive,tagname,min=1,max=32"`
}

type FileUpdateInput

type FileUpdateInput struct {
	Name string         `json:"name" validate:"omitempty,filename,min=1,max=255"`
	File graphql.Upload `json:"file" validate:"omitempty"`
}

type PageInfo

type PageInfo struct {
	HasNextPage     bool `json:"hasNextPage"`
	HasPreviousPage bool `json:"hasPreviousPage"`
}

type Tag

type Tag struct {
	ID        string     `json:"id" gorm:"type:varchar(20);primaryKey;not null"`
	Name      string     `json:"name" gorm:"type:varchar(32);unique;not null"`
	FileTags  []FileTag  `gorm:"foreignKey:TagName;references:Name"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt"`
}

type TagConnection

type TagConnection struct {
	Edges    []*TagEdge `json:"edges"`
	Nodes    []*Tag     `json:"nodes"`
	PageInfo *PageInfo  `json:"pageInfo"`
}

type TagEdge

type TagEdge struct {
	Cursor string `json:"cursor"`
	Node   *Tag   `json:"node"`
}

type User

type User struct {
	ID            string             `json:"id"  gorm:"type:varchar(20);primaryKey;not null"`
	Username      string             `json:"username" gorm:"type:varchar(64);unique;not null"`
	Password      string             `gorm:"type:varchar(128);not null"`
	Kind          UserKind           `json:"kind" gorm:"type:varchar(8);not null"`
	Collaborators []FileCollaborator `gorm:"foreignKey:CollaboratorID"`
	CreatedAt     time.Time          `json:"createdAt"`
	UpdatedAt     time.Time          `json:"updatedAt"`
	DeletedAt     *time.Time         `json:"deletedAt"`
}

type UserConnection

type UserConnection struct {
	Edges    []*UserEdge `json:"edges"`
	Nodes    []*User     `json:"nodes"`
	PageInfo *PageInfo   `json:"pageInfo"`
}

type UserEdge

type UserEdge struct {
	Cursor string `json:"cursor"`
	Node   *User  `json:"node"`
}

type UserInput

type UserInput struct {
	Username string `json:"username" validate:"required,username,min=3,max=64,lowercase"`
	Password string `json:"password" validate:"required,password,min=8,max=512"`
}

type UserKind

type UserKind string
const (
	UserKindAdmin  UserKind = "ADMIN"
	UserKindUser   UserKind = "USER"
	UserKindBanned UserKind = "BANNED"
)

func (UserKind) IsValid

func (e UserKind) IsValid() bool

func (UserKind) MarshalGQL

func (e UserKind) MarshalGQL(w io.Writer)

func (UserKind) String

func (e UserKind) String() string

func (*UserKind) UnmarshalGQL

func (e *UserKind) UnmarshalGQL(v interface{}) error

type UserUpdateInput

type UserUpdateInput struct {
	Username string   `json:"username" validate:"omitempty,username,min=3,max=64,lowercase"`
	Password string   `json:"password" validate:"omitempty,password,min=8,max=512"`
	Kind     UserKind `json:"kind" validate:"omitempty"`
}

Jump to

Keyboard shortcuts

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