type-fix-5

This commit is contained in:
Untone 2024-03-02 14:35:40 +03:00
parent 8deba4849d
commit 132f965c8b

View File

@ -246,10 +246,26 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId))
// Combine user data into a JSON string
combinedData := fmt.Sprintf(`{"profile": %s, "authors": %s, "topics": %s, "followers": %s}`,
authorProfileString, authorFollowsAuthorsString, authorFollowsTopicsString, authorFollowers)
combinedData := "{"
log.Printf("%v", combinedData)
if authorProfileString != nil {
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
}
if authorFollowsAuthorsString != nil {
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
}
if authorFollowsTopicsString != nil {
combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString)
}
if authorFollowers != nil {
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
}
combinedData += "}"
// log.Printf("%v", combinedData)
return combinedData, nil
}