#8 - list feeds, no content still

This commit is contained in:
2025-03-11 14:10:01 +02:00
parent e89bfba392
commit ed8b8860b7
5 changed files with 68 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ func AddFeedHandler(s *config.State, cmd config.Command) error {
}
f, err := s.DB.CreateFeed(ctx, database.CreateFeedParams{
ID: uuid.UUID{},
ID: uuid.New(),
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
UserID: user.ID,

View File

@@ -0,0 +1,21 @@
package handlers
import (
"context"
"fmt"
"github.com/rdarius/boot-dev-blog-aggregator/internal/config"
)
func ListFeedsHandler(s *config.State, cmd config.Command) error {
ctx := context.Background()
feeds, err := s.DB.ListFeeds(ctx)
if err != nil {
return err
}
for _, feed := range feeds {
fmt.Printf("Article: %s | Url: %s | User: %s\n", feed.Name, feed.Url, feed.UserName)
}
return nil
}