feat/sso-auth: entities adjustment

This commit is contained in:
2025-11-10 23:00:31 +07:00
parent fe804dabb3
commit eb57a01a94
5 changed files with 60 additions and 50 deletions
@@ -45,7 +45,7 @@ type MetaDto struct {
}
type ResponseDto struct {
ecore.Main
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
SecretKey string `json:"secretKey"`
@@ -57,7 +57,7 @@ func (d AuthPartner) ToResponse() ResponseDto {
Name: d.Name,
SecretKey: d.SecretKey,
}
resp.Main = d.Main
resp.SmallMain = d.SmallMain
return resp
}
@@ -5,8 +5,8 @@ import (
)
type AuthPartner struct {
ecore.Main // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"unique;size:100"`
SecretKey string `json:"secretKey" gorm:"size:255"`
ecore.SmallMain // adjust this according to the needs
Code string `json:"code" gorm:"unique;size:50"`
Name string `json:"name" gorm:"unique;size:100"`
SecretKey string `json:"secretKey" gorm:"size:255"`
}
@@ -9,9 +9,12 @@ import (
type UserFes struct {
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"size:100"`
AuthPartner_Code string `json:"authPartner_code" gorm:"size:30"`
Name string `json:"name" gorm:"size:100;uniqueIndex:idx-userFes-name-authPartner_code"`
AuthPartner_Code string `json:"authPartner_code" gorm:"size:50;uniqueIndex:idx-userFes-name-authPartner_code"`
AuthPartner *eap.AuthPartner `json:"authPartner,omitempty" gorm:"foreignKey:AuthPartner_Code;references:Code"`
User_Name string `json:"user_name" gorm:"size:50"`
User *eau.User `json:"user,omitempty" gorm:"foreignKey:User_Name;references:Name"`
// Even tried this one, still failed to preload
// AuthPartner_Id uint16 `json:"authPartner_id"`
// AuthPartner *eap.AuthPartner `json:"authPartner,omitempty" gorm:"foreignKey:AuthPartner_Id;references:Id"`
User_Name string `json:"user_name" gorm:"size:50"`
User *eau.User `json:"user,omitempty" gorm:"foreignKey:User_Name;references:Name"`
}