Add website favicon API and manual favicon profile updates.

Expose GET /tenants/{domain}/website/favicon for storefront tab icons, allow faviconMediaId on profile PATCH, and sync website API docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-26 00:51:11 +03:30
co-authored by Cursor
parent 6ce6f959ac
commit ead16080b8
13 changed files with 318 additions and 13 deletions
+40
View File
@@ -0,0 +1,40 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { TenantService } from '../tenant/tenant.service';
@Injectable()
export class WebsiteFaviconService {
constructor(
private readonly prisma: PrismaService,
private readonly tenant: TenantService,
) {}
async getPublic(host: string) {
const business = await this.tenant.resolveBusinessByDomain(host);
const record = await this.prisma.business.findUnique({
where: { id: business.id },
select: {
faviconMediaId: true,
logoMedia: { select: { publicUrl: true } },
logoDarkMedia: { select: { publicUrl: true } },
faviconMedia: { select: { publicUrl: true } },
},
});
if (!record) {
throw new NotFoundException('Business not found');
}
const logoUrl = record.logoMedia?.publicUrl ?? null;
const logoDarkUrl = record.logoDarkMedia?.publicUrl ?? null;
const faviconUrl = record.faviconMedia?.publicUrl ?? logoUrl;
return {
faviconUrl,
logoUrl,
logoDarkUrl,
hasDedicatedFavicon: record.faviconMediaId != null,
};
}
}