Private
Public Access
22 lines
960 B
Go
22 lines
960 B
Go
package models
|
|
|
|
import (
|
|
models_seguridad "repuestera_back/models/seguridad"
|
|
)
|
|
|
|
|
|
type Producto 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"`
|
|
StockMinimo int64 `gorm:"not null;type:bigint" json:"stockMinimo"`
|
|
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"`
|
|
}
|
|
func (Producto) TableName() string {
|
|
return "producto"
|
|
}
|