diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 38ffad8..2e7e57b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,9 @@
-
+
-
+
@@ -45,35 +45,35 @@
- {
+ "keyToString": {
+ "DefaultGoTemplateProperty": "Go File",
+ "Go Build.Backend.executor": "Debug",
+ "Go 构建.Backend.executor": "Run",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.git.unshallow": "true",
+ "RunOnceActivity.go.formatter.settings.were.checked": "true",
+ "RunOnceActivity.go.migrated.go.modules.settings": "true",
+ "RunOnceActivity.go.modules.automatic.dependencies.download": "true",
+ "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
+ "git-widget-placeholder": "master",
+ "go.import.settings.migrated": "true",
+ "go.sdk.automatically.set": "true",
+ "last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hypernet/Passport",
+ "node.js.detected.package.eslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "run.code.analysis.last.selected.profile": "pProject Default",
+ "settings.editor.selected.configurable": "preferences.intentionPowerPack",
+ "ts.external.directory.path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/node_modules/typescript/lib",
+ "vue.rearranger.settings.migration": "true"
},
- "keyToStringList": {
- "DatabaseDriversLRU": [
- "postgresql"
+ "keyToStringList": {
+ "DatabaseDriversLRU": [
+ "postgresql"
]
}
-}]]>
+}
@@ -159,7 +159,6 @@
-
@@ -184,7 +183,8 @@
-
+
+
diff --git a/pkg/internal/http/api/userinfo_api.go b/pkg/internal/http/api/userinfo_api.go
index 9961a50..185c5cf 100644
--- a/pkg/internal/http/api/userinfo_api.go
+++ b/pkg/internal/http/api/userinfo_api.go
@@ -3,8 +3,8 @@ package api
import (
"fmt"
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
- "github.com/spf13/viper"
"gorm.io/gorm"
+ "strconv"
"strings"
"git.solsynth.dev/hypernet/passport/pkg/internal/database"
@@ -15,13 +15,18 @@ import (
func getOtherUserinfo(c *fiber.Ctx) error {
alias := c.Params("alias")
+ tx := database.C.Where("name = ?")
+
+ numericId, err := strconv.Atoi(alias)
+ if err == nil {
+ tx = tx.Where("id = ?", numericId)
+ }
+
var account models.Account
- if err := database.C.
- Where(&models.Account{Name: alias}).
+ if err := tx.
Preload("Profile").
Preload("Badges", func(db *gorm.DB) *gorm.DB {
- prefix := viper.GetString("database.prefix")
- return db.Order(fmt.Sprintf("%sbadges.type DESC", prefix))
+ return db.Order("badges.type DESC")
}).
First(&account).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())