Private
Public Access
cmbiamos algunos imports y cambiamos productos por repuestos
This commit is contained in:
1 parent
96048d7776
commit
e4542e48e6
26 files changed
+66
-74
No files matched your search
@@ -14,7 +14,6 @@ type Factura struct {
|
||||
Cliente string `gorm:"type:varchar(100)" json:"cliente"`
|
||||
Total float64 `gorm:"not null;default:0" json:"total"`
|
||||
Detalles []FacturaDetalle `gorm:"type:json" json:"detalles,omitempty"`
|
||||
Empresa models_seguridad.Empresa `gorm:"foreignKey:EmpresaID" json:"empresa,omitempty"`
|
||||
Usuario models_seguridad.Usuario `gorm:"foreignKey:UsuarioID" json:"usuario,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package models
|
||||
|
||||
type FacturaDetalle struct {
|
||||
ProductoID uint64 `json:"productoId"`
|
||||
RepuestoID uint64 `json:"repuestoId"`
|
||||
Cantidad uint `json:"cantidad"`
|
||||
PrecioUnitario float64 `json:"precioUnitario"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
type Marca struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(3)" json:"id"`
|
||||
Razon string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
||||
Productos []Producto `gorm:"foreignKey:MarcaID"`
|
||||
Repuestos []Repuesto `gorm:"foreignKey:MarcaID"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
@@ -14,7 +14,6 @@ type OrdenCompra struct {
|
||||
Proveedor string `gorm:"type:varchar(100)" json:"proveedor"`
|
||||
Total float64 `gorm:"not null;default:0" json:"total"`
|
||||
Detalles []OrdenCompraDetalle `gorm:"type:json" json:"detalles,omitempty"`
|
||||
Empresa models_seguridad.Empresa `gorm:"foreignKey:EmpresaID" json:"empresa,omitempty"`
|
||||
Usuario models_seguridad.Usuario `gorm:"foreignKey:UsuarioID" json:"usuario,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package models
|
||||
|
||||
type OrdenCompraDetalle struct {
|
||||
ProductoID uint64 `json:"productoId"`
|
||||
RepuestoID uint64 `json:"repuestoId"`
|
||||
Cantidad uint `json:"cantidad"`
|
||||
PrecioUnitario float64 `json:"precioUnitario"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
models_seguridad "repuestera_back/models/seguridad"
|
||||
)
|
||||
|
||||
|
||||
type Producto struct {
|
||||
type Repuesto struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Nombre string `gorm:"type:varchar(50);not null" json:"nombre"`
|
||||
Precio float64 `gorm:"not null;type:decimal(10,2)" json:"precio"`
|
||||
@@ -13,9 +9,8 @@ type Producto struct {
|
||||
Descripcion string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
||||
MarcaID string `gorm:"type:varchar(3);index" json:"marcaId"`
|
||||
Aliases []string `gorm:"type:json" json:"aliases,omitempty"`
|
||||
Empresas []models_seguridad.Empresa`gorm:"many2many:producto_empresa;" json:"empresas,omitempty"`
|
||||
Stocks []Stock `gorm:"foreignKey:ProductoID" json:"stocks,omitempty"`
|
||||
Stocks []Stock `gorm:"foreignKey:RepuestoID" json:"stocks,omitempty"`
|
||||
}
|
||||
func (Producto) TableName() string {
|
||||
return "producto"
|
||||
func (Repuesto) TableName() string {
|
||||
return "repuesto"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package models_seguridad
|
||||
|
||||
type Empresa struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(3)" json:"id"`
|
||||
Razon string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
||||
Direccion string `gorm:"type:text" json:"direccion,omitempty"`
|
||||
Telefono string `gorm:"type:varchar(20)" json:"telefono,omitempty"`
|
||||
Email string `gorm:"type:varchar(100)" json:"email,omitempty"`
|
||||
}
|
||||
|
||||
func (Empresa) TableName() string {
|
||||
return "empresa"
|
||||
}
|
||||
@@ -12,7 +12,7 @@ type Usuario struct {
|
||||
Password string `gorm:"not null" json:"-"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Grupos []Grupo `gorm:"many2many:user_groups;" json:"grupos,omitempty"`
|
||||
Empresas []Empresa `gorm:"many2many:user_empresa;" json:"empresas,omitempty"`
|
||||
// Empresas []Empresa `gorm:"many2many:user_empresa;" json:"empresas,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
@@ -2,11 +2,11 @@ package models
|
||||
|
||||
type Stock struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
ProductoID uint64 `gorm:"index;not null" json:"productoId"`
|
||||
RepuestoID uint64 `gorm:"index;not null" json:"repuestoId"`
|
||||
CajonID string `gorm:"type:varchar(30);index;not null" json:"cajonId"`
|
||||
Cantidad uint `gorm:"not null;default:0" json:"cantidad"`
|
||||
|
||||
Producto Producto `gorm:"foreignKey:ProductoID" json:"producto,omitempty"`
|
||||
Repuesto Repuesto `gorm:"foreignKey:RepuestoID" json:"repuesto,omitempty"`
|
||||
Cajon Cajon `gorm:"foreignKey:CajonID" json:"cajon,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user