fix: collectino post background
This commit is contained in:
@@ -200,7 +200,10 @@ func (r *CollectionRepo) CollectionsContaining(ctx context.Context, postID, user
|
||||
return ids, rows.Err()
|
||||
}
|
||||
|
||||
// PostsIn returns the posts (with images + author) inside a collection.
|
||||
// PostsIn returns the posts inside a collection, ordered by collection
|
||||
// position then added_at. Images are NOT hydrated — call
|
||||
// PostRepo.ImagesFor on the returned ids if your caller renders the
|
||||
// post visually. The CollectionService.Get path already does this.
|
||||
func (r *CollectionRepo) PostsIn(ctx context.Context, collectionID string) ([]model.Post, error) {
|
||||
rows, err := r.pg.Pool.Query(ctx, `
|
||||
SELECT p.id, p.user_id, p.caption, p.source_url, COALESCE(p.source_title, ''),
|
||||
@@ -234,8 +237,6 @@ func (r *CollectionRepo) PostsIn(ctx context.Context, collectionID string) ([]mo
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, fmt.Errorf("iterate collection posts: %w", err)
|
||||
}
|
||||
// Defer image hydration to caller via PostRepo if needed; for v1 we just
|
||||
// return without images here (the management page can fetch separately).
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user