Add published user products to the storefront sitemap.
Expose /sitemap-user-products.xml when customer_products is enabled, invalidate on listing mutations, and proxy the new path from nginx provision scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
fb04425df7
commit
0d9c2fd8ea
@@ -26,6 +26,7 @@ import {
|
||||
UserProductTechnicalValueDto,
|
||||
} from './dto/user-product.dto';
|
||||
import { TenantService } from '../tenant/tenant.service';
|
||||
import { SitemapService } from '../sitemap/sitemap.service';
|
||||
|
||||
function slugify(value: string): string {
|
||||
return (
|
||||
@@ -109,6 +110,7 @@ export class UserProductsService {
|
||||
private readonly technicalFormService: CategoryTechnicalFormService,
|
||||
private readonly mediaService: MediaService,
|
||||
private readonly tenant: TenantService,
|
||||
private readonly sitemap: SitemapService,
|
||||
) {}
|
||||
|
||||
async listPublic(host: string, query: ListPublicUserProductsDto) {
|
||||
@@ -404,6 +406,8 @@ export class UserProductsService {
|
||||
include: userProductAdminListInclude,
|
||||
});
|
||||
|
||||
await this.sitemap.invalidateForBusiness(businessId);
|
||||
|
||||
return {
|
||||
message: 'User product created successfully',
|
||||
product: withUser
|
||||
@@ -621,6 +625,8 @@ export class UserProductsService {
|
||||
}
|
||||
await this.mediaService.deleteUnused(businessId, dropped);
|
||||
|
||||
await this.sitemap.invalidateForBusiness(businessId);
|
||||
|
||||
return {
|
||||
message: 'User product updated successfully',
|
||||
product: this.serializeAdminListItem(updated, category ?? undefined),
|
||||
@@ -680,6 +686,8 @@ export class UserProductsService {
|
||||
|
||||
await this.mediaService.deleteUnused(businessId, mediaIds);
|
||||
|
||||
await this.sitemap.invalidateForBusiness(businessId);
|
||||
|
||||
return { message: 'User product deleted successfully' };
|
||||
}
|
||||
|
||||
@@ -879,6 +887,8 @@ export class UserProductsService {
|
||||
updated.id,
|
||||
]);
|
||||
|
||||
await this.sitemap.invalidateForBusiness(businessId);
|
||||
|
||||
return {
|
||||
message: 'User product status updated successfully',
|
||||
product: this.serializeAdminListItem(
|
||||
@@ -961,6 +971,8 @@ export class UserProductsService {
|
||||
await tx.userProduct.delete({ where: { id: productId } });
|
||||
});
|
||||
|
||||
await this.sitemap.invalidateForBusiness(businessId);
|
||||
|
||||
return { message: 'User product deleted successfully' };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user