Add page-view analytics, product counters, SSL expiry, and business renewal.
Auto-count storefront page views with 6-month event retention and lifetime counters, track product visit/cart/sale stats, persist SSL cert expiry with daily probes, and support owner titles plus annual contract renewal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
6cd0b009ef
commit
92601ae729
@@ -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 { BlogsService } from './blogs.service';
|
||||
import {
|
||||
CreateBlogCommentDto,
|
||||
@@ -92,16 +93,23 @@ export class BlogsController {
|
||||
|
||||
@Controller('tenants/:host/blogs')
|
||||
export class PublicBlogsController {
|
||||
constructor(private readonly service: BlogsService) {}
|
||||
constructor(
|
||||
private readonly service: BlogsService,
|
||||
private readonly analytics: WebsiteAnalyticsService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
list(@Param('host') host: string, @Query() query: ListPublicBlogsDto) {
|
||||
return this.service.listPublic(host, query);
|
||||
async list(@Param('host') host: string, @Query() query: ListPublicBlogsDto) {
|
||||
const result = await this.service.listPublic(host, query);
|
||||
this.analytics.trackPublicPage(host, 'blog_list');
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get('by-id/:blogId')
|
||||
getById(@Param('host') host: string, @Param('blogId') blogId: string) {
|
||||
return this.service.getPublicById(host, blogId);
|
||||
async getById(@Param('host') host: string, @Param('blogId') blogId: string) {
|
||||
const result = await this.service.getPublicById(host, blogId);
|
||||
this.analytics.trackPublicPage(host, 'blog_detail', result.blog.id);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Get(':blogId/comments')
|
||||
@@ -119,7 +127,9 @@ export class PublicBlogsController {
|
||||
}
|
||||
|
||||
@Get(':slug')
|
||||
getBySlug(@Param('host') host: string, @Param('slug') slug: string) {
|
||||
return this.service.getPublicBySlug(host, slug);
|
||||
async getBySlug(@Param('host') host: string, @Param('slug') slug: string) {
|
||||
const result = await this.service.getPublicBySlug(host, slug);
|
||||
this.analytics.trackPublicPage(host, 'blog_detail', result.blog.id);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,18 @@ import { AuthModule } from '../auth/auth.module';
|
||||
import { BusinessSettingsModule } from '../business-settings/business-settings.module';
|
||||
import { SitemapModule } from '../sitemap/sitemap.module';
|
||||
import { TenantModule } from '../tenant/tenant.module';
|
||||
import { WebsiteAnalyticsModule } from '../website-analytics/website-analytics.module';
|
||||
import { BlogsController, PublicBlogsController } from './blogs.controller';
|
||||
import { BlogsService } from './blogs.service';
|
||||
|
||||
@Module({
|
||||
imports: [AuthModule, BusinessSettingsModule, SitemapModule, TenantModule],
|
||||
imports: [
|
||||
AuthModule,
|
||||
BusinessSettingsModule,
|
||||
SitemapModule,
|
||||
TenantModule,
|
||||
WebsiteAnalyticsModule,
|
||||
],
|
||||
controllers: [BlogsController, PublicBlogsController],
|
||||
providers: [BlogsService],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user