premerge
This commit is contained in:
parent
c8ba8c1453
commit
6a4b3553af
|
@ -228,7 +228,7 @@ type AuthorProfile struct {
|
|||
// GetUserAppDataFromRedis retrieves user profile and follows from Redis, combines them into a JSON format,
|
||||
// and assigns the JSON string to the provided user's ID.
|
||||
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf(`user:%s`, userId)).Result()
|
||||
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:user:%s`, userId)).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -246,17 +246,17 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
|||
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
|
||||
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
|
||||
|
||||
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)).Val()
|
||||
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d`, authorId)).Val()
|
||||
if authorFollowsAuthorsString != "" {
|
||||
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
|
||||
}
|
||||
|
||||
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)).Val()
|
||||
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:follows-authors:%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)).Val()
|
||||
authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:followers:%d`, authorId)).Val()
|
||||
if authorFollowers != "" {
|
||||
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user