refactor(aisle): Change aisle dimensions and weight types from string to float/int

This commit is contained in:
Habib Fatkhul Rohman 2025-11-17 11:58:56 +07:00
parent ccb62d0159
commit 9fa1d4ec14
4 changed files with 54 additions and 54 deletions

View File

@ -6,13 +6,13 @@ type MAisleEntity struct {
ID uuid.UUID `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()" json:"id"` ID uuid.UUID `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()" json:"id"`
Code string `gorm:"type:varchar(50);not null;" json:"code"` Code string `gorm:"type:varchar(50);not null;" json:"code"`
Name string `gorm:"type:varchar(100);not null;" json:"name"` Name string `gorm:"type:varchar(100);not null;" json:"name"`
IsleX string `gorm:"type:varchar(50);" json:"isle_x"` IsleX int `gorm:"type:int;" json:"isle_x"`
BinY string `gorm:"type:varchar(50);" json:"bin_y"` BinY int `gorm:"type:int;" json:"bin_y"`
LevelZ string `gorm:"type:varchar(50);" json:"level_z"` LevelZ int `gorm:"type:int;" json:"level_z"`
DimLength string `gorm:"type:varchar(100);" json:"dim_length"` DimLength float64 `gorm:"type:float;" json:"dim_length"`
DimWidth string `gorm:"type:varchar(100);" json:"dim_width"` DimWidth float64 `gorm:"type:float;" json:"dim_width"`
DimHeight string `gorm:"type:varchar(100);" json:"dim_height"` DimHeight float64 `gorm:"type:float;" json:"dim_height"`
Weight string `gorm:"type:varchar(100);" json:"weight"` Weight float64 `gorm:"type:float;" json:"weight"`
QrCodeAisle string `gorm:"type:text;" json:"qr_code_aisle"` QrCodeAisle string `gorm:"type:text;" json:"qr_code_aisle"`
IsActive bool `gorm:"type:boolean;default:true;" json:"is_active"` IsActive bool `gorm:"type:boolean;default:true;" json:"is_active"`

View File

@ -28,13 +28,13 @@ var (
type AisleCreateRequest struct { type AisleCreateRequest struct {
Code string `json:"code" binding:"required"` Code string `json:"code" binding:"required"`
Name string `json:"name" binding:"required"` Name string `json:"name" binding:"required"`
IsleX string `json:"isle_x"` IsleX int `json:"isle_x"`
BinY string `json:"bin_y"` BinY int `json:"bin_y"`
LevelZ string `json:"level_z"` LevelZ int `json:"level_z"`
DimLength string `json:"dim_length"` DimLength float64 `json:"dim_length"`
DimWidth string `json:"dim_width"` DimWidth float64 `json:"dim_width"`
DimHeight string `json:"dim_height"` DimHeight float64 `json:"dim_height"`
Weight string `json:"weight"` Weight float64 `json:"weight"`
QrCodeAisle string `json:"qr_code_aisle"` QrCodeAisle string `json:"qr_code_aisle"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
ZoneID string `json:"zone_id" binding:"required"` ZoneID string `json:"zone_id" binding:"required"`
@ -46,13 +46,13 @@ type AisleCreateRequest struct {
type AisleUpdateRequest struct { type AisleUpdateRequest struct {
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
IsleX string `json:"isle_x"` IsleX int `json:"isle_x"`
BinY string `json:"bin_y"` BinY int `json:"bin_y"`
LevelZ string `json:"level_z"` LevelZ int `json:"level_z"`
DimLength string `json:"dim_length"` DimLength float64 `json:"dim_length"`
DimWidth string `json:"dim_width"` DimWidth float64 `json:"dim_width"`
DimHeight string `json:"dim_height"` DimHeight float64 `json:"dim_height"`
Weight string `json:"weight"` Weight float64 `json:"weight"`
QrCodeAisle string `json:"qr_code_aisle"` QrCodeAisle string `json:"qr_code_aisle"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
} }
@ -61,13 +61,13 @@ type AisleResponse struct {
ID string `json:"id"` ID string `json:"id"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
IsleX string `json:"isle_x"` IsleX int `json:"isle_x"`
BinY string `json:"bin_y"` BinY int `json:"bin_y"`
LevelZ string `json:"level_z"` LevelZ int `json:"level_z"`
DimLength string `json:"dim_length"` DimLength float64 `json:"dim_length"`
DimWidth string `json:"dim_width"` DimWidth float64 `json:"dim_width"`
DimHeight string `json:"dim_height"` DimHeight float64 `json:"dim_height"`
Weight string `json:"weight"` Weight float64 `json:"weight"`
QrCodeAisle string `json:"qr_code_aisle"` QrCodeAisle string `json:"qr_code_aisle"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
Zone pkgdto.IdNameResponse `json:"zone"` Zone pkgdto.IdNameResponse `json:"zone"`

View File

@ -168,25 +168,25 @@ func (s *aisleService) Update(ctx context.Context, req dto.AisleUpdateRequest, a
if req.Name != "" { if req.Name != "" {
aisle.Name = req.Name aisle.Name = req.Name
} }
if req.IsleX != "" { if req.IsleX != 0 {
aisle.IsleX = req.IsleX aisle.IsleX = req.IsleX
} }
if req.BinY != "" { if req.BinY != 0 {
aisle.BinY = req.BinY aisle.BinY = req.BinY
} }
if req.LevelZ != "" { if req.LevelZ != 0 {
aisle.LevelZ = req.LevelZ aisle.LevelZ = req.LevelZ
} }
if req.DimLength != "" { if req.DimLength != 0 {
aisle.DimLength = req.DimLength aisle.DimLength = req.DimLength
} }
if req.DimWidth != "" { if req.DimWidth != 0 {
aisle.DimWidth = req.DimWidth aisle.DimWidth = req.DimWidth
} }
if req.DimHeight != "" { if req.DimHeight != 0 {
aisle.DimHeight = req.DimHeight aisle.DimHeight = req.DimHeight
} }
if req.Weight != "" { if req.Weight != 0 {
aisle.Weight = req.Weight aisle.Weight = req.Weight
} }
if req.QrCodeAisle != "" { if req.QrCodeAisle != "" {

View File

@ -74,13 +74,13 @@ type ZonaAisleResponse struct {
ID string `json:"id"` ID string `json:"id"`
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
IsleX string `json:"isle_x"` IsleX int `json:"isle_x"`
BinY string `json:"bin_y"` BinY int `json:"bin_y"`
LevelZ string `json:"level_z"` LevelZ int `json:"level_z"`
DimLength string `json:"dim_length"` DimLength float64 `json:"dim_length"`
DimWidth string `json:"dim_width"` DimWidth float64 `json:"dim_width"`
DimHeight string `json:"dim_height"` DimHeight float64 `json:"dim_height"`
Weight string `json:"weight"` Weight float64 `json:"weight"`
QrCodeAisle string `json:"qr_code_aisle"` QrCodeAisle string `json:"qr_code_aisle"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
Zone pkgdto.IdNameResponse `json:"zone"` Zone pkgdto.IdNameResponse `json:"zone"`