- src/lib/redis.ts: @upstash/redis singleton (server-only)
- src/lib/feed-helpers.ts: feedKey, fanOutPost, backfillOnFollow, getFeedPage, trimFeed, FEED_RETENTION_MS
- src/lib/media-url.ts: getMediaUrl (mirrors getAvatarUrl signature, client-safe)
- src/lib/milestone-thresholds.ts: FOLLOWER_MILESTONE_THRESHOLDS constant (D-09, A3)
- Router stubs: posts, stories, milestones, follows, blocks, reports, feed (all NOT_IMPLEMENTED)
- All 9 routers registered in _app.ts (pets, media + 7 new)
- feed.getFeed input includes cursor: z.number().nullish() per Pitfall 6
- Rule 1 fix: @upstash/redis zrange requires {offset, count} not just count
- npx tsc --noEmit exits 0
12 lines
516 B
TypeScript
12 lines
516 B
TypeScript
/**
|
|
* Constructs the public CDN URL for media stored in Supabase Storage.
|
|
* Safe to use in both server and client components (uses NEXT_PUBLIC_ env var).
|
|
*
|
|
* Mirrors getAvatarUrl signature. Used for post images and story media
|
|
* stored under the posts/ and stories/ path prefixes in the pet-avatars bucket.
|
|
*/
|
|
export function getMediaUrl(key: string | null | undefined): string | null {
|
|
if (!key) return null;
|
|
return `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/pet-avatars/${key}`;
|
|
}
|