type-fix-8

This commit is contained in:
Untone 2024-03-02 14:51:37 +03:00
parent 29026ed6fb
commit 4351f5cd32

View File

@ -219,6 +219,7 @@ func (c *provider) GetBoolStoreEnvVariable(key string) (bool, error) {
return data == "1", nil
}
type AuthorProfile struct {
ID int `json:"id"`
// Add other fields as necessary
@ -243,21 +244,20 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
// Use authorProfileMap["id"] here if necessary
authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int
if authorId != nil {
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
}
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId))
if authorFollowsAuthorsString != nil {
combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString)
authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)).Val()
if authorFollowsAuthorsString != "" {
combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString)
}
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId))
if authorFollowsTopicsString != nil {
authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%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))
if authorFollowers != nil {
authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)).Val()
if authorFollowers != "" {
combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers)
}