Private
Public Access
feat: hecha parte del back para crear clientes y correjida alta de
miembros Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
37f1741a77
commit
405eaca25c
20 files changed
+417
-112
No files matched your search
@@ -1,17 +1,15 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Cliente struct {
|
||||
gorm.Model
|
||||
EmpresaID uint `gorm:"not null;default:1;index;uniqueIndex:uq_cliente_empresa_cuit,priority:1" json:"empresaId"`
|
||||
Nombre string `gorm:"type:varchar(40)" json:"nombre"`
|
||||
Cuit string `gorm:"type:varchar(11);not null;uniqueIndex:uq_cliente_empresa_cuit,priority:2" json:"cuit"`
|
||||
Email sql.NullString `gorm:"type:varchar(80)" json:"email"`
|
||||
Facturas []Factura `gorm:"foreignKey:ClienteID" json:"facturas,omitempty"`
|
||||
Recibos []Recibo `gorm:"foreignKey:ClienteID" json:"recibos,omitempty"`
|
||||
EmpresaID uint `gorm:"not null;default:1;index;uniqueIndex:uq_cliente_empresa_cuit,priority:1" json:"empresaId"`
|
||||
Nombre string `gorm:"type:varchar(40)" json:"nombre"`
|
||||
Cuit string `gorm:"type:varchar(11);not null;uniqueIndex:uq_cliente_empresa_cuit,priority:2" json:"cuit"`
|
||||
Email string `gorm:"type:varchar(80)" json:"email,omitempty"`
|
||||
Facturas []Factura `gorm:"foreignKey:ClienteID" json:"facturas,omitempty"`
|
||||
Recibos []Recibo `gorm:"foreignKey:ClienteID" json:"recibos,omitempty"`
|
||||
}
|
||||
@@ -46,12 +46,13 @@ func (r RolEmpresa) EsAdministrador() bool {
|
||||
|
||||
// EmpresaUsuario es la membresía de un usuario global dentro de una empresa.
|
||||
type EmpresaUsuario struct {
|
||||
EmpresaID uint `gorm:"primaryKey" json:"empresa_id"`
|
||||
UsuarioID uint `gorm:"primaryKey" json:"usuario_id"`
|
||||
Rol RolEmpresa `gorm:"type:varchar(20);not null;default:'MEMBER'" json:"rol"`
|
||||
Activo bool `gorm:"not null;default:true" json:"activo"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
EmpresaID uint `gorm:"primaryKey" json:"empresa_id"`
|
||||
UsuarioID uint `gorm:"primaryKey" json:"usuario_id"`
|
||||
Rol RolEmpresa `gorm:"type:varchar(20);not null;default:'MEMBER'" json:"rol"`
|
||||
Activo bool `gorm:"not null;default:true" json:"activo"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Empresa Empresa `gorm:"foreignKey:EmpresaID" json:"empresa,omitempty"`
|
||||
Usuario Usuario `gorm:"foreignKey:UsuarioID" json:"usuario,omitempty"`
|
||||
|
||||
Reference in new issue
Block a user