Add AI English name translation and aggregate website view analytics.

Website views chart uses kind=all across page kinds; home hits also count static-images loads.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-28 20:39:37 +03:30
co-authored by Cursor
parent 0d9c2fd8ea
commit 0c1c3f7ff9
6 changed files with 108 additions and 27 deletions
@@ -14,6 +14,7 @@ import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { RequireBusinessPermission } from '../auth/decorators/require-business-permission.decorator';
import { BusinessPermissionGuard } from '../auth/guards/business-permission.guard';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { WebsiteAnalyticsService } from '../website-analytics/website-analytics.service';
import {
CreateWebsiteStaticImageSlotDto,
ListWebsiteStaticImageSlotsDto,
@@ -24,14 +25,22 @@ import { WebsiteStaticImagesService } from './website-static-images.service';
@Controller('tenants/:host/website/static-images')
export class PublicWebsiteStaticImagesController {
constructor(private readonly service: WebsiteStaticImagesService) {}
constructor(
private readonly service: WebsiteStaticImagesService,
private readonly analytics: WebsiteAnalyticsService,
) {}
@Get()
list(
async list(
@Param('host') host: string,
@Query() query: PublicWebsiteStaticImagesQueryDto,
) {
return this.service.listPublic(host, query.pageKey);
const result = await this.service.listPublic(host, query.pageKey);
const pageKey = query.pageKey?.trim() || 'home';
if (pageKey === 'home') {
this.analytics.trackPublicPage(host, 'home');
}
return result;
}
@Get(':key')