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,
|
// 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.
|
// and assigns the JSON string to the provided user's ID.
|
||||||
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
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 {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -246,17 +246,17 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||||
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
|
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
|
||||||
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)).Val()
|
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d`, authorId)).Val()
|
||||||
if authorFollowsAuthorsString != "" {
|
if authorFollowsAuthorsString != "" {
|
||||||
combinedData += fmt.Sprintf(`,"authors": %s`, 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 != "" {
|
if authorFollowsTopicsString != "" {
|
||||||
combinedData += fmt.Sprintf(`,"topics": %s`, 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 != "" {
|
if authorFollowers != "" {
|
||||||
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
|
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user