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) }