Private
Public Access
añadimos un par de campos que faltaban en las entidades de producto y
marca
This commit is contained in:
1 parent
336226a0d6
commit
9ee7aa11d0
2 files changed
+12
No files matched your search
@@ -1,9 +1,18 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
type Marca struct {
|
type Marca struct {
|
||||||
ID string `gorm:"primaryKey;type:varchar(3)" json:"id"`
|
ID string `gorm:"primaryKey;type:varchar(3)" json:"id"`
|
||||||
Razon string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
Razon string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
||||||
Productos []Producto `gorm:"foreignKey:MarcaID"`
|
Productos []Producto `gorm:"foreignKey:MarcaID"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Marca) TableName() string {
|
func (Marca) TableName() string {
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import (
|
|||||||
|
|
||||||
type Producto struct {
|
type Producto struct {
|
||||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
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"`
|
Descripcion string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"razon"`
|
||||||
MarcaID string `gorm:"type:varchar(3);index" json:"marcaId"`
|
MarcaID string `gorm:"type:varchar(3);index" json:"marcaId"`
|
||||||
Aliases []string `gorm:"type:json" json:"aliases,omitempty"`
|
Aliases []string `gorm:"type:json" json:"aliases,omitempty"`
|
||||||
|
|||||||
Reference in new issue
Block a user