Skip to content

Commit

Permalink
fix(marketing): add postgres filter by date_published ascending to ch…
Browse files Browse the repository at this point in the history
…angelog
  • Loading branch information
prodkt committed Oct 3, 2024
1 parent 9451ab2 commit abc5da8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/marketing/src/pages/changelog/index.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function fetchChangelogData(
'*,id,title,content,project_id,publish_date,published,summary,author_id(*),slug,image(filename_disk),improvements',
)
.neq('published', false)
.order('publish_date', { ascending: false })

// Type guard to check if response.error exists
if (response.error) {
Expand All @@ -37,7 +38,7 @@ async function fetchChangelogData(
*/
export async function GET(context: APIContext) {
const supabaseResult = await supabase(context)
if (!supabaseResult?.supabase) {
if (!supabaseResult.supabase) {
console.error('Failed to initialize Supabase client')
return new Response(JSON.stringify({ error: 'Internal server error' }), {
status: 500,
Expand Down

0 comments on commit abc5da8

Please sign in to comment.