ORM

package
v0.0.0-...-6235a54 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UipathBearerTokenMap sync.Map // sync map because there's a lot of goroutines reading and writing to it
)

Functions

This section is empty.

Types

type Cliente

type Cliente struct {
	gorm.Model
	Nombre         string `gorm:"not null"`
	Apellido       string `gorm:"not null"`
	Email          string `gorm:"not null"`
	OrganizacionID uint   `gorm:"not null"`
	Organizacion   *Organizacion
	Procesos       []*Proceso `gorm:"many2many:procesos_clientes;"`
}

func (*Cliente) Get

func (this *Cliente) Get(db *gorm.DB, id uint)

func (Cliente) GetAll

func (Cliente) GetAll(db *gorm.DB) []*Cliente

func (Cliente) TableName

func (Cliente) TableName() string

type JobHistory

type JobHistory struct {
	gorm.Model
	Proceso          *Proceso  `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
	ProcesoID        uint      `gorm:"not null"`
	CreationTime     time.Time `gorm:"type:timestamptz(3);precision:3"`
	StartTime        time.Time `gorm:"type:timestamptz(3);precision:3"`
	EndTime          time.Time `gorm:"type:timestamptz(3);precision:3"`
	HostMachineName  string
	Source           string           `gorm:"not null"`
	State            string           `gorm:"not null"`
	JobKey           string           `gorm:"not null;unique"`
	JobID            int              `gorm:"not null;unique"`
	Duration         time.Duration    `gorm:"not null"`
	MonitorException bool             `gorm:"not null;default:false"`
	Logs             []*LogJobHistory `gorm:"foreignKey:JobID"`
}

func (*JobHistory) Get

func (jh *JobHistory) Get(db *gorm.DB, id uint)

type LogJobHistory

type LogJobHistory struct {
	gorm.Model
	Level           string      `gorm:"not null"`
	WindowsIdentity string      `gorm:"not null"`
	ProcessName     string      `gorm:"not null"`
	TimeStamp       time.Time   `gorm:"type:timestamptz(3);precision:3"`
	Message         string      `gorm:"not null"`
	JobKey          string      `gorm:"not null"`
	RawMessage      string      `gorm:"not null"`
	RobotName       string      `gorm:"not null"`
	HostMachineName string      `gorm:"not null"`
	MachineId       int         `gorm:"not null"`
	MachineKey      string      `gorm:"not null"`
	JobID           int         `gorm:"not null"`
	Job             *JobHistory `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
}

type Organizacion

type Organizacion struct {
	gorm.Model
	Nombre     string `gorm:"not null"`
	Uipathname string `gorm:"not null"`
	Tenantname string `gorm:"not null"`
	AppID      string `gorm:"not null;default:''"`
	AppSecret  string `gorm:"not null;default:''"`
	AppScope   string `gorm:"not null;default:''"`
	BaseURL    string `gorm:"not null;default:'https://cloud.uipath.com/'"`
	Clientes   []*Cliente
	Procesos   []*Proceso
	Usuarios   []*Usuario `gorm:"many2many:usuarios_organizaciones;"`
}

func (*Organizacion) CheckAccessAPI

func (o *Organizacion) CheckAccessAPI() error

func (*Organizacion) Get

func (o *Organizacion) Get(db *gorm.DB, id uint)

func (*Organizacion) GetAll

func (o *Organizacion) GetAll(db *gorm.DB) []*Organizacion

func (*Organizacion) GetFromApi

func (o *Organizacion) GetFromApi(structType interface{}, folderid ...int) error

func (*Organizacion) GetUrl

func (o *Organizacion) GetUrl() string

func (*Organizacion) RefreshUiPathToken

func (o *Organizacion) RefreshUiPathToken() error

func (*Organizacion) RequestAPI

func (o *Organizacion) RequestAPI(method, path string, body io.Reader, conds ...interface{}) (*http.Response, error)

func (Organizacion) TableName

func (Organizacion) TableName() string

type Proceso

type Proceso struct {
	gorm.Model
	Nombre           string            `gorm:"not null"`
	Alias            string            `gorm:"not null,default:''"`
	UipathProcessID  uint              `gorm:"not null,default:0"`
	Folderid         uint              `gorm:"not null"`
	Foldername       string            `gorm:"not null,default:''"`
	OrganizacionID   uint              `gorm:"not null"`
	WarningTolerance int               `gorm:"not null;default:10"`
	ErrorTolerance   int               `gorm:"not null;default:0"`
	FatalTolerance   int               `gorm:"not null;default:0"`
	ActiveMonitoring bool              `gorm:"not null;default:false"`
	Priority         int               `gorm:"not null;default:1"`
	MaxQueueTime     int               `gorm:"not null;default:30"`
	Organizacion     *Organizacion     `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
	TicketsProcesos  []*TicketsProceso `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;" json:"IncidentesProceso"`
	Clientes         []*Cliente        `gorm:"many2many:procesos_clientes;"`
	Usuarios         []*Usuario        `gorm:"many2many:procesos_usuarios;"`
	JobsHistory      []*JobHistory     `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
}

func GetListByUser

func GetListByUser(db *gorm.DB, userID uint) []*Proceso

func (*Proceso) AddClients

func (p *Proceso) AddClients(db *gorm.DB, list []int) error

func (Proceso) AddUsers

func (p Proceso) AddUsers(db *gorm.DB, list []int) error

func (*Proceso) Get

func (p *Proceso) Get(db *gorm.DB, id uint)

func (Proceso) GetAll

func (Proceso) GetAll(db *gorm.DB) []*Proceso

func (Proceso) GetByFolder

func (Proceso) GetByFolder(db *gorm.DB, folderID uint) []*Proceso

func (*Proceso) GetEmails

func (p *Proceso) GetEmails() []string

func (*Proceso) RemoveClients

func (p *Proceso) RemoveClients(db *gorm.DB, list []int) error

func (Proceso) RemoveUsers

func (p Proceso) RemoveUsers(db *gorm.DB, list []int) error

func (Proceso) TableName

func (Proceso) TableName() string

type Rol

type Rol struct {
	gorm.Model
	Nombre      string     `gorm:"not null"`
	Usuarios    []*Usuario `gorm:"many2many:usuarios_roles;"`
	Rutas       []*Route   `gorm:"many2many:roles_routes;"`
	Description string     `gorm:"not null default:''"`
}

func (*Rol) Get

func (r *Rol) Get(db *gorm.DB, id uint)

func (Rol) GetAll

func (Rol) GetAll(db *gorm.DB) []*Rol

func (*Rol) GetUsuarios

func (r *Rol) GetUsuarios(db *gorm.DB)

func (Rol) TableName

func (Rol) TableName() string

type Route

type Route struct {
	gorm.Model
	Method string `gorm:"not null"`
	Route  string `gorm:"not null"`
	Roles  []*Rol `gorm:"many2many:roles_routes;"`
}

func (*Route) Get

func (r *Route) Get(db *gorm.DB, id uint)

func (Route) GetAll

func (Route) GetAll(db *gorm.DB) []*Route

type TicketsDetalle

type TicketsDetalle struct {
	gorm.Model
	TicketID    int       `gorm:"not null"`
	Detalle     string    `gorm:"type:text" json:"Detalle"`
	FechaInicio time.Time `gorm:"precision:6"`
	FechaFin    time.Time `gorm:"precision:6"`
	UsuarioID   int       `gorm:"not null"`
	Diagnostico bool      `gorm:"default:false" json:"IsDiagnostic"`
}

func (*TicketsDetalle) Get

func (td *TicketsDetalle) Get(db *gorm.DB, id uint)

func (TicketsDetalle) TableName

func (TicketsDetalle) TableName() string

TableName TableName IncidentesDetalles Tablename: incidentes_detalle

type TicketsProceso

type TicketsProceso struct {
	gorm.Model
	ProcesoID        uint              `gorm:"not null"`
	Proceso          *Proceso          `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT"`
	Descripcion      string            `gorm:"type:text" json:"Descripcion"`
	Tipo             *TicketsTipo      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT" json:"TipoDetail"`
	TipoID           uint              `gorm:"not null" json:"Tipo"`
	Prioridad        uint              `gorm:"not null;default:5"`
	Estado           string            `gorm:"not null;type:estado_enum;default:'Iniciado'" json:"Estado"`
	UsuarioCreador   *Usuario          `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT" json:"UsuarioCreadorDetail"`
	UsuarioCreadorID int               `gorm:"not null" json:"UsuarioCreadorID"`
	Detalles         []*TicketsDetalle `gorm:"foreignKey:TicketID;constraint:OnUpdate:CASCADE,OnDelete:RESTRICT"`
}

func (*TicketsProceso) Get

func (tp *TicketsProceso) Get(db *gorm.DB, id uint)

func (*TicketsProceso) GetTipo

func (tp *TicketsProceso) GetTipo(db *gorm.DB) string

func (TicketsProceso) TableName

func (TicketsProceso) TableName() string

TableName IncidenteProcesos Tablename: incidentes_procesos

type TicketsTipo

type TicketsTipo struct {
	gorm.Model
	Nombre              string `json:"nombre" gorm:"not null"`
	NecesitaDiagnostico bool   `gorm:"default:false"`
}

type Usuario

type Usuario struct {
	gorm.Model
	Nombre           string            `gorm:"not null"`
	Apellido         string            `gorm:"not null"`
	Email            string            `gorm:"not null"`
	Password         string            `gorm:"not null"`
	Roles            []*Rol            `gorm:"many2many:usuarios_roles;"`
	Procesos         []*Proceso        `gorm:"many2many:procesos_usuarios;"`
	Organizaciones   []*Organizacion   `gorm:"many2many:usuarios_organizaciones;"`
	Tickets_Procesos []*TicketsProceso `gorm:"foreignKey:UsuarioCreadorID;constraint:OnUpdate:CASCADE,OnDelete:RESTRICT"`
	Tickets_Detalle  []*TicketsDetalle `gorm:"foreignKey:UsuarioID;constraint:OnUpdate:CASCADE,OnDelete:RESTRICT"`
}

func (*Usuario) AverageDurationPerTicket

func (u *Usuario) AverageDurationPerTicket(db *gorm.DB) time.Duration

func (*Usuario) AverageTimeSpentPerDay

func (u *Usuario) AverageTimeSpentPerDay(db *gorm.DB) time.Duration

Average time spent in tickets a day

func (*Usuario) CheckPassword

func (u *Usuario) CheckPassword(password string) bool

func (*Usuario) FillEmptyFields

func (u *Usuario) FillEmptyFields(db *gorm.DB)

func (*Usuario) Get

func (u *Usuario) Get(db *gorm.DB, id uint)

func (*Usuario) GetAdmins

func (u *Usuario) GetAdmins(db *gorm.DB) []*Usuario

func (Usuario) GetAll

func (Usuario) GetAll(db *gorm.DB) []*Usuario

func (*Usuario) GetByEmail

func (u *Usuario) GetByEmail(db *gorm.DB, email string)

func (*Usuario) GetCantityTicketsClosed

func (u *Usuario) GetCantityTicketsClosed(db *gorm.DB) int64

func (*Usuario) GetCantityTicketsCreated

func (u *Usuario) GetCantityTicketsCreated(db *gorm.DB) int64

func (*Usuario) GetCantityTicketsPending

func (u *Usuario) GetCantityTicketsPending(db *gorm.DB) int64

func (*Usuario) GetComplete

func (u *Usuario) GetComplete(db *gorm.DB)

func (*Usuario) HasProcess

func (u *Usuario) HasProcess(process int) bool

func (*Usuario) HasRole

func (u *Usuario) HasRole(role string) bool

func (*Usuario) SetPassword

func (u *Usuario) SetPassword(password string)

func (Usuario) TableName

func (Usuario) TableName() string

Jump to

Keyboard shortcuts

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