Private
Public Access
añadida entidad de reserva y actualizado diagrama de dominio
This commit is contained in:
1 parent
7ecbd2a643
commit
e0345bc3dd
3 files changed
+66
-13
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Reserva struct {
|
||||
gorm.Model
|
||||
|
||||
RepuestoID uint `gorm:"not null;index:idx_reserva_repuesto_almacen" json:"repuesto_id"`
|
||||
Repuesto Repuesto `gorm:"foreignKey:RepuestoID" json:"repuesto,omitempty"`
|
||||
AlmacenID uint `gorm:"not null;index:idx_reserva_repuesto_almacen" json:"almacen_id"`
|
||||
Almacen Almacen `gorm:"foreignKey:AlmacenID" json:"almacen,omitempty"`
|
||||
Cantidad float64 `gorm:"not null;check:cantidad > 0" json:"cantidad"`
|
||||
Estado EstadoReserva `gorm:"type:varchar(20);not null;default:'activa';index" json:"estado"`
|
||||
ClienteID *uint `json:"cliente_id,omitempty"`
|
||||
Cliente *Cliente `gorm:"foreignKey:ClienteID" json:"cliente,omitempty"`
|
||||
FechaVencimiento time.Time `gorm:"index" json:"fecha_vencimiento,omitempty"`
|
||||
}
|
||||
|
||||
type EstadoReserva string
|
||||
|
||||
const (
|
||||
ReservaActiva EstadoReserva = "activa"
|
||||
ReservaVencida EstadoReserva = "vencida"
|
||||
ReservaLiberada EstadoReserva = "liberada"
|
||||
ReservaConsumida EstadoReserva = "consumida"
|
||||
)
|
||||
Reference in new issue
Block a user