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
@@ -5,15 +5,15 @@ import (
)
type CreateDto struct {
Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"`
Parent_Id *int16 `json:"parent_id"`
Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"`
Parent_Id *uint16 `json:"parent_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *uint16 `json:"parent_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -42,9 +42,9 @@ type MetaDto struct {
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *uint16 `json:"parent_id"`
}
func (d Division) ToResponse() ResponseDto {
@@ -8,7 +8,7 @@ type Division struct {
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:10"`
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"`
Childrens []Division `gorm:"foreignKey:Parent_Id"` // may need references to self
}