type-fix-7

This commit is contained in:
Untone 2024-03-02 14:44:34 +03:00
parent f244330401
commit 29026ed6fb

View File

@ -242,23 +242,22 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
combinedData := "{" combinedData := "{"
// Use authorProfileMap["id"] here if necessary // Use authorProfileMap["id"] here if necessary
authorId, err := int(authorProfileMap["id"].(float64)) // convert float64 to int authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
if err != nil { if authorId != nil {
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString) combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
} }
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
authorFollowsAuthorsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)) if authorFollowsAuthorsString != nil {
if err != nil {
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString) combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
} }
authorFollowsTopicsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)) authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
if err != nil { if authorFollowsTopicsString != nil {
combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString) combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString)
} }
authorFollowers, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)) authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
if err != nil { if authorFollowers != nil {
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers) combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
} }