Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion api/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@ export const config = {
runtime: 'edge',
};

const OPAL_CANONICAL_LOGO = '/icons/opal2.png';

function normalizeOpalLogo<T extends { slug: string | null; logoUrl: string | null }>(app: T): T {
if (app.slug === 'opal') {
return {
...app,
logoUrl: OPAL_CANONICAL_LOGO,
};
}
return app;
}

export default async function handler(_request: Request) {
try {
const sqlClient = neon(process.env.DATABASE_URL!);
const db = drizzle(sqlClient);

// Get all official apps sorted by frequency
const officialApps = await db
const officialAppsRaw = await db
.select()
.from(apps)
.orderBy(desc(apps.frequency));
const officialApps = officialAppsRaw.map(normalizeOpalLogo);

// Get all approved submissions
const approvedSubmissions = await db
Expand Down
1 change: 1 addition & 0 deletions api/profile/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default async function handler(request: Request) {
description: item.submissionDescription,
tagline: null,
category: item.submissionCategory,
status: item.submissionStatus,
type: 'submitted' as const,
};
}
Expand Down