Accept marketplace banners at 18:6 (3:1) aspect ratio.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
e0cd2327eb
commit
a9e29b79fd
@@ -549,7 +549,7 @@ export class BusinessProfileService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Recommended banner aspect 18:4.5 (4:1). Soft-check when dimensions exist. */
|
/** Recommended banner aspect 18:6 (3:1). Soft-check when dimensions exist. */
|
||||||
private async assertBannerMedia(businessId: bigint, mediaId: bigint) {
|
private async assertBannerMedia(businessId: bigint, mediaId: bigint) {
|
||||||
const media = await this.prisma.media.findFirst({
|
const media = await this.prisma.media.findFirst({
|
||||||
where: { id: mediaId, businessId },
|
where: { id: mediaId, businessId },
|
||||||
@@ -562,10 +562,10 @@ export class BusinessProfileService {
|
|||||||
|
|
||||||
if (media.width && media.height && media.height > 0) {
|
if (media.width && media.height && media.height > 0) {
|
||||||
const ratio = media.width / media.height;
|
const ratio = media.width / media.height;
|
||||||
const target = 18 / 4.5; // 4
|
const target = 18 / 6; // 3
|
||||||
if (Math.abs(ratio - target) / target > 0.12) {
|
if (Math.abs(ratio - target) / target > 0.12) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
'Banner aspect ratio should be about 18:4.5 (4:1)',
|
'Banner aspect ratio should be about 18:6 (3:1)',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export type BusinessProfile = {
|
|||||||
logoDarkUrl: string | null;
|
logoDarkUrl: string | null;
|
||||||
faviconMediaId: string | null;
|
faviconMediaId: string | null;
|
||||||
faviconUrl: string | null;
|
faviconUrl: string | null;
|
||||||
/** Recommended aspect ratio 18:4.5 (4:1). */
|
/** Recommended aspect ratio 18:6 (3:1). */
|
||||||
bannerMediaId: string | null;
|
bannerMediaId: string | null;
|
||||||
bannerUrl: string | null;
|
bannerUrl: string | null;
|
||||||
categoryIds: string[];
|
categoryIds: string[];
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export class UpdateBusinessProfileDto {
|
|||||||
@IsInt()
|
@IsInt()
|
||||||
faviconMediaId?: number | null;
|
faviconMediaId?: number | null;
|
||||||
|
|
||||||
/** Marketplace/storefront banner; recommended aspect 18:4.5 (4:1). */
|
/** Marketplace/storefront banner; recommended aspect 18:6 (3:1). */
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@Type(() => Number)
|
@Type(() => Number)
|
||||||
@IsInt()
|
@IsInt()
|
||||||
|
|||||||
Reference in New Issue
Block a user