fix issues

This commit is contained in:
Salihu
2026-08-13 23:43:09 +01:00
parent 76ca723d90
commit 79bf2c3cd7
3 changed files with 15 additions and 10 deletions
@@ -13,7 +13,7 @@ export enum WorkspaceCaslSubject {
Attachment = 'attachment',
API = 'api_key',
Audit = 'audit',
PageAnalytics = "page_analytics"
PageAnalytics = 'page_analytics'
}
export type IWorkspaceAbility =
+10 -9
View File
@@ -51,7 +51,8 @@ export class ShareController {
private readonly pageAccessService: PageAccessService,
private readonly licenseCheckService: LicenseCheckService,
@Inject(AUDIT_SERVICE) private readonly auditService: IAuditService,
@Inject(PAGE_VIEW_SERVICE) private readonly pageViewService: IPageViewService,
@Inject(PAGE_VIEW_SERVICE)
private readonly pageViewService: IPageViewService,
) {}
@HttpCode(HttpStatus.OK)
@@ -76,14 +77,6 @@ export class ShareController {
const shareData = await this.shareService.getSharedPage(dto, workspace.id);
void this.pageViewService.track({
pageId: shareData.page.id,
workspaceId: workspace.id,
spaceId: shareData.page.spaceId,
shareId: shareData.share.id,
userId: null,
});
const sharingAllowed = await this.shareService.isSharingAllowed(
workspace.id,
shareData.share.spaceId,
@@ -92,6 +85,14 @@ export class ShareController {
throw new NotFoundException('Shared page not found');
}
void this.pageViewService.track({
pageId: shareData.page.id,
workspaceId: workspace.id,
spaceId: shareData.page.spaceId,
shareId: shareData.share.id,
userId: null,
});
return {
...shareData,
features: this.licenseCheckService.resolveFeatures(
@@ -16,6 +16,10 @@ export async function up(db: Kysely<any>): Promise<void> {
.addColumn('space_id', 'uuid', (col) =>
col.references('spaces.id').onDelete('cascade'),
)
.addColumn('user_id', 'uuid', (col) =>
col.references('users.id').onDelete('set null'),
)
.addColumn('share_id', 'uuid')
.addColumn('visitor_id', 'varchar', (col) => col.notNull())
.addColumn('view_date', 'varchar', (col) => col.notNull())
.addColumn('hits', 'int8', (col) => col.notNull().defaultTo(1))