From 4351f5cd32b020a759282f4b4e1e9826ecf314d0 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 2 Mar 2024 14:51:37 +0300 Subject: [PATCH] type-fix-8 --- server/memorystore/providers/redis/store.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/memorystore/providers/redis/store.go b/server/memorystore/providers/redis/store.go index 6dbd21c..440fd7d 100644 --- a/server/memorystore/providers/redis/store.go +++ b/server/memorystore/providers/redis/store.go @@ -219,6 +219,7 @@ func (c *provider) GetBoolStoreEnvVariable(key string) (bool, error) { return data == "1", nil } + type AuthorProfile struct { ID int `json:"id"` // Add other fields as necessary @@ -243,21 +244,20 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) { // Use authorProfileMap["id"] here if necessary authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int - if authorId != nil { - combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString) - } - authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)) - if authorFollowsAuthorsString != nil { + combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString) + + authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)).Val() + if authorFollowsAuthorsString != "" { combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString) } - authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)) - if authorFollowsTopicsString != nil { + authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)).Val() + if authorFollowsTopicsString != "" { combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString) } - authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)) - if authorFollowers != nil { + authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)).Val() + if authorFollowers != "" { combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers) }