✨ Preload api key's ticket
This commit is contained in:
parent
46c7b6dff1
commit
1bdeba58bc
@ -4,10 +4,9 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix api key wasn't in auto maintain range">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix api key missing account id">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/bot.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/bot.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/bot_token.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/bot_token.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/bot_token_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/bot_token_api.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -154,7 +153,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value=":bug: Fix model relation issue" />
|
||||
<MESSAGE value=":arrow_up: Upgrade dealer" />
|
||||
<MESSAGE value=":sparkles: Support stream controller event emit" />
|
||||
<MESSAGE value=":recycle: Use dealer postman instead of built-in feature to deliver email and notify" />
|
||||
@ -179,7 +177,8 @@
|
||||
<MESSAGE value=":bug: Fix bot related bot key apis path error" />
|
||||
<MESSAGE value=":bug: Fix path parameters misplaced" />
|
||||
<MESSAGE value=":bug: Fix api key wasn't in auto maintain range" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix api key wasn't in auto maintain range" />
|
||||
<MESSAGE value=":bug: Fix api key missing account id" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix api key missing account id" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<settings-migrated>true</settings-migrated>
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/server/exts"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func listBotKeys(c *fiber.Ctx) error {
|
||||
@ -16,7 +15,7 @@ func listBotKeys(c *fiber.Ctx) error {
|
||||
}
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
var tx *gorm.DB
|
||||
tx := database.C.Preload("Ticket")
|
||||
|
||||
botId, _ := c.ParamsInt("botId", 0)
|
||||
if botId > 0 {
|
||||
@ -55,7 +54,10 @@ func getBotKey(c *fiber.Ctx) error {
|
||||
id, _ := c.ParamsInt("id", 0)
|
||||
|
||||
var key models.ApiKey
|
||||
if err := database.C.Where("id = ? AND account_id = ?", id, user.ID).First(&key).Error; err != nil {
|
||||
if err := database.C.
|
||||
Where("id = ? AND account_id = ?", id, user.ID).
|
||||
Preload("Ticket").
|
||||
First(&key).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user