deleted grade in recording egg unfinished: daily gain question, and confirm counting about fcr, adg, mortality and others

This commit is contained in:
ragilap
2025-12-05 21:58:51 +07:00
parent 1bca29cd31
commit 70b2a5a2d1
6 changed files with 2 additions and 9 deletions
@@ -5,8 +5,7 @@ ALTER TABLE recording_eggs
DROP CONSTRAINT IF EXISTS chk_recording_eggs_qty; DROP CONSTRAINT IF EXISTS chk_recording_eggs_qty;
ALTER TABLE recording_eggs ALTER TABLE recording_eggs
DROP COLUMN IF EXISTS weight, DROP COLUMN IF EXISTS weight;
DROP COLUMN IF EXISTS grade;
ALTER TABLE recording_eggs ALTER TABLE recording_eggs
ADD CONSTRAINT chk_recording_eggs_qty CHECK (qty >= 0); ADD CONSTRAINT chk_recording_eggs_qty CHECK (qty >= 0);
@@ -5,8 +5,7 @@ DROP INDEX IF EXISTS idx_grading_eggs_recording_egg;
DROP TABLE IF EXISTS grading_eggs; DROP TABLE IF EXISTS grading_eggs;
ALTER TABLE recording_eggs ALTER TABLE recording_eggs
ADD COLUMN IF NOT EXISTS weight NUMERIC(10,3), ADD COLUMN IF NOT EXISTS weight NUMERIC(10,3);
ADD COLUMN IF NOT EXISTS grade VARCHAR;
ALTER TABLE recording_eggs ALTER TABLE recording_eggs
DROP CONSTRAINT IF EXISTS chk_recording_eggs_qty; DROP CONSTRAINT IF EXISTS chk_recording_eggs_qty;
-1
View File
@@ -8,7 +8,6 @@ type RecordingEgg struct {
ProductWarehouseId uint `gorm:"column:product_warehouse_id;not null"` ProductWarehouseId uint `gorm:"column:product_warehouse_id;not null"`
Qty int `gorm:"column:qty;not null"` Qty int `gorm:"column:qty;not null"`
Weight *float64 `gorm:"column:weight"` Weight *float64 `gorm:"column:weight"`
Grade *string `gorm:"column:grade;type:varchar(50)"`
CreatedBy uint `gorm:"column:created_by"` CreatedBy uint `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"autoCreateTime"` CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"`
@@ -69,7 +69,6 @@ type RecordingEggDTO struct {
ProductWarehouseId uint `json:"product_warehouse_id"` ProductWarehouseId uint `json:"product_warehouse_id"`
Qty int `json:"qty"` Qty int `json:"qty"`
Weight *float64 `json:"weight,omitempty"` Weight *float64 `json:"weight,omitempty"`
Grade *string `json:"grade,omitempty"`
ProductWarehouse productWarehouseDTO.ProductWarehouseDTO `json:"product_warehouse"` ProductWarehouse productWarehouseDTO.ProductWarehouseDTO `json:"product_warehouse"`
} }
@@ -241,7 +240,6 @@ func ToRecordingEggDTOs(eggs []entity.RecordingEgg) []RecordingEggDTO {
ProductWarehouseId: egg.ProductWarehouseId, ProductWarehouseId: egg.ProductWarehouseId,
Qty: egg.Qty, Qty: egg.Qty,
Weight: egg.Weight, Weight: egg.Weight,
Grade: egg.Grade,
ProductWarehouse: mapProductWarehouseDTO(&egg.ProductWarehouse), ProductWarehouse: mapProductWarehouseDTO(&egg.ProductWarehouse),
} }
} }
@@ -22,7 +22,6 @@ type (
ProductWarehouseId uint `json:"product_warehouse_id" validate:"required,number,min=1"` ProductWarehouseId uint `json:"product_warehouse_id" validate:"required,number,min=1"`
Qty int `json:"qty" validate:"required,number,min=0"` Qty int `json:"qty" validate:"required,number,min=0"`
Weight *float64 `json:"weight,omitempty" validate:"omitempty,gte=0"` Weight *float64 `json:"weight,omitempty" validate:"omitempty,gte=0"`
Grade *string `json:"grade,omitempty" validate:"omitempty"`
} }
) )
@@ -81,7 +81,6 @@ func MapEggs(recordingID uint, createdBy uint, items []validation.Egg) []entity.
ProductWarehouseId: item.ProductWarehouseId, ProductWarehouseId: item.ProductWarehouseId,
Qty: item.Qty, Qty: item.Qty,
Weight: item.Weight, Weight: item.Weight,
Grade: item.Grade,
CreatedBy: createdBy, CreatedBy: createdBy,
}) })
} }