Revert "feat: fix OIDC address field (#3013)"

This reverts commit 2f48d457730ece630405b555ec9253333648df3a.
This commit is contained in:
Eric Luo 2024-06-25 16:13:51 +08:00 committed by GitHub
parent 2f48d45773
commit 599ab9aae8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,7 @@ type UserWithoutThirdIdp struct {
CountryCode string `xorm:"varchar(6)" json:"countryCode"`
Region string `xorm:"varchar(100)" json:"region"`
Location string `xorm:"varchar(100)" json:"location"`
Address Address `json:"address"`
Address []string `json:"address"`
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
Title string `xorm:"varchar(100)" json:"title"`
IdCardType string `xorm:"varchar(100)" json:"idCardType"`
@ -148,15 +148,6 @@ type ClaimsWithoutThirdIdp struct {
jwt.RegisteredClaims
}
type Address struct {
Formatted string `json:"formatted"`
StreetAddress string `json:"street_address"`
Locality string `json:"locality"`
Region string `json:"region"`
PostalCode string `json:"postal_code"`
Country string `json:"country"`
}
func getShortUser(user *User) *UserShort {
res := &UserShort{
Owner: user.Owner,
@ -171,13 +162,6 @@ func getShortUser(user *User) *UserShort {
return res
}
func getStreetAddress(user *User) string {
if len(user.Address) > 0 {
return user.Address[0]
}
return ""
}
func getUserWithoutThirdIdp(user *User) *UserWithoutThirdIdp {
res := &UserWithoutThirdIdp{
Owner: user.Owner,
@ -203,14 +187,7 @@ func getUserWithoutThirdIdp(user *User) *UserWithoutThirdIdp {
CountryCode: user.CountryCode,
Region: user.Region,
Location: user.Location,
Address: Address{
Formatted: "",
StreetAddress: getStreetAddress(user),
Locality: "",
Region: "",
PostalCode: "",
Country: "",
},
Address: user.Address,
Affiliation: user.Affiliation,
Title: user.Title,
IdCardType: user.IdCardType,