Private
Public Access
termine de crear los modelos por una segunda vez
This commit is contained in:
1 parent
152a40ca19
commit
8a1ea71805
12 files changed
+49
-17
No files matched your search
@@ -3,7 +3,7 @@ package models
|
||||
type Almacen struct {
|
||||
ID string `gorm:"primaryKey;type:varchar(5)" json:"id"`
|
||||
Ubicacion string `gorm:"type:varchar(40)" json:"ubicacion"`
|
||||
Stocks []Stock `gorm:"foreignKey:RepuestoID" json:"stocks,omitempty"`
|
||||
Stocks []Stock `gorm:"foreignKey:repuestoID" json:"stocks,omitempty"`
|
||||
}
|
||||
|
||||
func (Almacen) TableName() string {
|
||||
|
||||
@@ -12,5 +12,6 @@ type Comprobante struct {
|
||||
Numero string `gorm:"size:50;not null" json:"numero"`
|
||||
Estado string `gorm:"type:varchar(20);not null" json:"estado"`
|
||||
Total float64 `gorm:"type:decimal(15,2);not null" json:"total"`
|
||||
Responsable models_seguridad.Usuario `gorm:"foreignKey:UsuarioID" json:"usuario"`
|
||||
ResponsableID uint `gorm:"column:usuarioID"`
|
||||
Responsable models_seguridad.Usuario `gorm:"foreignKey:usuarioID" json:"usuario"`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package contabilidad
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type AsientoContable struct {
|
||||
gorm.Model
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:movimientoID"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package contabilidad
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type CuentaContable struct {
|
||||
gorm.Model
|
||||
Nombre string `gorm:"type:varchar(30),not null"`
|
||||
Tipo string `gorm:"type:varchar(12),not null"`
|
||||
Movimientos []MovimientoContable `gorm:"foreignKey:movimientoID"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package contabilidad
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type MovimientoContable struct {
|
||||
gorm.Model
|
||||
AsientoID uint `gorm:"column:asientoID"`
|
||||
Asiento AsientoContable `gorm:"foreignKey:asientoID"`
|
||||
CuentaID uint `gorm:"column:cuentaID"`
|
||||
Cuenta CuentaContable `gorm:"foreignKey:cuentaID"`
|
||||
Debe float64 `gorm:"type:decimal(10,2)"`
|
||||
Haber float64 `gorm:"type:decimal(10,2)"`
|
||||
Descripcion string `gorm:"type:varchar(50)"`
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package models
|
||||
|
||||
type Factura struct {
|
||||
Comprobante
|
||||
ClienteID uint `gorm:"column:ClienteID"`
|
||||
Cliente Cliente `gorm:"foreignKey:ClienteID" json:"cliente"`
|
||||
Total float64 `gorm:"not null;default:0" json:"total"`
|
||||
Detalles []FacturaDetalle `gorm:"type:json" json:"detalles,omitempty"`
|
||||
|
||||
@@ -2,8 +2,9 @@ package models
|
||||
|
||||
type NotaCredito struct {
|
||||
Comprobante
|
||||
Motivo string `gorm:"type:varchar(40),not null"`
|
||||
FacturaOrigen Factura `gorm:"foreignKey:FacturaID" json:"factura"`
|
||||
Motivo string `gorm:"type:varchar(40),not null"`
|
||||
FacturaOrigen Factura `gorm:"foreignKey:facturaID" json:"factura"`
|
||||
FacturaOrigenID uint `gorm:"column:facturaID"`
|
||||
}
|
||||
func (NotaCredito) TableName() string {
|
||||
return "nota_credito"
|
||||
|
||||
@@ -2,8 +2,9 @@ package models
|
||||
|
||||
type NotaDebito struct {
|
||||
Comprobante
|
||||
Motivo string `gorm:"type:varchar(40),not null"`
|
||||
FacturaOrigen Factura `gorm:"foreignKey:FacturaID" json:"factura"`
|
||||
Motivo string `gorm:"type:varchar(40),not null"`
|
||||
FacturaOrigen Factura `gorm:"foreignKey:facturaID" json:"factura"`
|
||||
FacturaOrigenID uint `gorm:"column:facturaID"`
|
||||
}
|
||||
func (NotaDebito) TableName() string {
|
||||
return "nota_debito"
|
||||
|
||||
@@ -2,7 +2,8 @@ package models
|
||||
|
||||
type OrdenCompra struct {
|
||||
Comprobante
|
||||
Proveedor Proveedor `gorm:"foreignKey:ProveedorID" json:"Proveedor"`
|
||||
Proveedor Proveedor `gorm:"foreignKey:proveedorID" json:"Proveedor"`
|
||||
ProveedorID uint `gorm:"column:proveedorID"`
|
||||
Detalles []OrdenCompraDetalle `gorm:"type:json" json:"detalles,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -4,8 +4,9 @@ import "gorm.io/gorm"
|
||||
|
||||
type Pago struct {
|
||||
gorm.Model
|
||||
FormaDePago FormaDePago `gorm:"foreignKey:FormaDePagoID"`
|
||||
Importe float64 `gorm:"type:decimal(10,2)"`
|
||||
FormaDePagoID uint `gorm:"column:formaDePagoID"`
|
||||
FormaDePago FormaDePago `gorm:"foreignKey:FormaDePagoID"`
|
||||
Importe float64 `gorm:"type:decimal(10,2)"`
|
||||
}
|
||||
|
||||
func (Pago) TableName() string {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Repuesto struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
gorm.Model
|
||||
Nombre string `gorm:"type:varchar(50);not null" json:"nombre" binding:"required"`
|
||||
Precio float64 `gorm:"not null;type:decimal(10,2)" json:"precio" binding:"required"`
|
||||
StockMinimo int64 `gorm:"not null;type:bigint" json:"stockMinimo" binding:"required"`
|
||||
@@ -16,9 +14,6 @@ type Repuesto struct {
|
||||
Marca Marca `gorm:"foreignKey:marcaId"`
|
||||
Aliases datatypes.JSONSlice[string] `gorm:"type:json" json:"aliases,omitempty"`
|
||||
Stocks []Stock `gorm:"foreignKey:RepuestoID" json:"stocks,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
||||
}
|
||||
|
||||
func (Repuesto) TableName() string {
|
||||
|
||||
@@ -2,9 +2,8 @@ package models
|
||||
|
||||
type Stock struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
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"`
|
||||
RepuestoID uint64 `gorm:"index;not null" json:"repuestoId"`
|
||||
Repuesto Repuesto `gorm:"foreignKey:RepuestoID" json:"repuesto"`
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user