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 := "{"
// Use authorProfileMap["id"] here if necessary
authorId, err := int(authorProfileMap["id"].(float64)) // convert float64 to int
if err != nil {
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
if authorId != nil {
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
}
authorFollowsAuthorsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
if err != nil {
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
if authorFollowsAuthorsString != nil {
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
}
authorFollowsTopicsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
if err != nil {
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
if authorFollowsTopicsString != nil {
combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString)
}
authorFollowers, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
if err != nil {
authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
if authorFollowers != nil {
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
}