change datatype parent_id

This commit is contained in:
dpurbosakti
2025-10-02 16:12:43 +07:00
parent 01ea6b0961
commit 6d50ca233a
3 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
h1:kkT6c88mNI2KVSF5h2r1qdgxouqRlqt6scn0lhxl9+Q= h1:jZ9sh96fN1qtT2OItPgP+Anzvi92I1twBDGmU2RWlVU=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -21,4 +21,4 @@ h1:kkT6c88mNI2KVSF5h2r1qdgxouqRlqt6scn0lhxl9+Q=
20250929034428.sql h1:i+pROD9p+g5dOmmZma6WF/0Hw5g3Ha28NN85iTo1K34= 20250929034428.sql h1:i+pROD9p+g5dOmmZma6WF/0Hw5g3Ha28NN85iTo1K34=
20250930025550.sql h1:+F+CsCUXD/ql0tHGEow70GhPBX1ZybVn+bh/T4YMh7Y= 20250930025550.sql h1:+F+CsCUXD/ql0tHGEow70GhPBX1ZybVn+bh/T4YMh7Y=
20250930140351.sql h1:9AAEG1AnOAH+o0+oHL5G7I8vqlWOhwRlCGyyCpT/y1Q= 20250930140351.sql h1:9AAEG1AnOAH+o0+oHL5G7I8vqlWOhwRlCGyyCpT/y1Q=
20251002085604.sql h1:ml+jTtNkj5T12/loEW77jMScHbt+XAx4mN80heqo7+Q= 20251002085604.sql h1:3xZ68eYp4urXRnvotNH1XvG2mYOSDV/j3zHEZ/txg5E=
@@ -5,15 +5,15 @@ import (
) )
type CreateDto struct { type CreateDto struct {
Code string `json:"code" validate:"maxLength=10"` Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"` Name string `json:"name" validate:"maxLength=50"`
Parent_Id *int16 `json:"parent_id"` Parent_Id *uint16 `json:"parent_id"`
} }
type ReadListDto struct { type ReadListDto struct {
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"` Parent_Id *uint16 `json:"parent_id"`
Page int `json:"page"` Page int `json:"page"`
PageSize int `json:"page_size"` PageSize int `json:"page_size"`
@@ -42,9 +42,9 @@ type MetaDto struct {
type ResponseDto struct { type ResponseDto struct {
ecore.SmallMain ecore.SmallMain
Code string `json:"code"` Code string `json:"code"`
Name string `json:"name"` Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"` Parent_Id *uint16 `json:"parent_id"`
} }
func (d Division) ToResponse() ResponseDto { func (d Division) ToResponse() ResponseDto {
@@ -8,7 +8,7 @@ type Division struct {
ecore.SmallMain // adjust this according to the needs ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"` Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"` Name string `json:"name" gorm:"size:50"`
Parent_Id *int16 `json:"parent_id"` Parent_Id *uint16 `json:"parent_id"`
Parent *Division `gorm:"foreignKey:Parent_Id;references:Id"` Parent *Division `gorm:"foreignKey:Parent_Id;references:Id"`
Childrens []Division `gorm:"foreignKey:Parent_Id"` // may need references to self Childrens []Division `gorm:"foreignKey:Parent_Id"` // may need references to self
} }