2024-10-01 05:44:21 +01:00
|
|
|
package executors
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"codeflow.dananglin.me.uk/apollo/gator/internal/database"
|
|
|
|
"codeflow.dananglin.me.uk/apollo/gator/internal/state"
|
|
|
|
)
|
|
|
|
|
2024-10-03 03:37:52 +01:00
|
|
|
func following(s *state.State, _ executor, user database.User) error {
|
2024-10-01 05:44:21 +01:00
|
|
|
following, err := s.DB.GetFeedFollowsForUser(context.Background(), user.ID)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("unable to get the list of feeds from the database: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(following) == 0 {
|
|
|
|
fmt.Println("You are not following any feeds.")
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("\nYou are following:\n\n")
|
|
|
|
|
|
|
|
for _, feed := range following {
|
|
|
|
fmt.Printf("- %s\n", feed)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|