Logs show page (#4611)

* Being implementing events on the frontend

* Rename JSON to RAW JSON

* Fix handling of json field on frontend

* Log user id

* Add frontend tests

* Update packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/save-event-to-db.job.ts

Co-authored-by: Weiko <corentin@twenty.com>

* Move db calls to a dedicated repository

* Add server-side tests

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
Félix Malfait
2024-03-22 14:01:16 +01:00
committed by GitHub
parent aee6d49ea9
commit d876b40056
38 changed files with 488 additions and 95 deletions

View File

@ -0,0 +1,30 @@
import { Injectable } from '@nestjs/common';
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
@Injectable()
export class EventRepository {
constructor(
private readonly workspaceDataSourceService: WorkspaceDataSourceService,
) {}
public async insert(
name: string,
properties: string,
workspaceMemberId: string | null,
objectName: string,
objectId: string,
workspaceId: string,
): Promise<void> {
const dataSourceSchema =
this.workspaceDataSourceService.getSchemaName(workspaceId);
await this.workspaceDataSourceService.executeRawQuery(
`INSERT INTO ${dataSourceSchema}."event"
("name", "properties", "workspaceMemberId", "${objectName}Id")
VALUES ($1, $2, $3, $4)`,
[name, properties, workspaceMemberId, objectId],
workspaceId,
);
}
}

View File

@ -39,7 +39,7 @@ export class EventObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({
standardId: eventStandardFieldIds.properties,
type: FieldMetadataType.JSON,
type: FieldMetadataType.RAW_JSON,
label: 'Event details',
description: 'Json value for event details',
icon: 'IconListDetails',