Files v2 - FILES field update/create in common API (#17400)
## FILES Field update interface
```
mutation {
updateCompany(
id: "company-uuid"
data: {
filesfield: [
{ fileId: "new-file-uuid", label: "new-document.pdf" }
]
}
) {
id
filesfield {
fileId
label
extension
}
}
}
```
This commit is contained in:
+6
@@ -3,8 +3,10 @@ import {
|
||||
OnApplicationShutdown,
|
||||
OnModuleInit,
|
||||
} from '@nestjs/common';
|
||||
import { InjectDataSource } from '@nestjs/typeorm';
|
||||
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { GlobalWorkspaceDataSource } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-datasource';
|
||||
@@ -21,6 +23,8 @@ export class GlobalWorkspaceDataSourceService
|
||||
constructor(
|
||||
private readonly twentyConfigService: TwentyConfigService,
|
||||
private readonly workspaceEventEmitter: WorkspaceEventEmitter,
|
||||
@InjectDataSource()
|
||||
private readonly coreDataSource: DataSource,
|
||||
) {}
|
||||
|
||||
async onModuleInit(): Promise<void> {
|
||||
@@ -49,6 +53,7 @@ export class GlobalWorkspaceDataSourceService
|
||||
},
|
||||
},
|
||||
this.workspaceEventEmitter,
|
||||
this.coreDataSource,
|
||||
);
|
||||
|
||||
await this.globalWorkspaceDataSource.initialize();
|
||||
@@ -83,6 +88,7 @@ export class GlobalWorkspaceDataSourceService
|
||||
},
|
||||
},
|
||||
this.workspaceEventEmitter,
|
||||
this.coreDataSource,
|
||||
);
|
||||
await this.globalWorkspaceDataSourceReplica.initialize();
|
||||
}
|
||||
|
||||
+3
@@ -33,15 +33,18 @@ type CreateQueryBuilderOptions = {
|
||||
|
||||
export class GlobalWorkspaceDataSource extends DataSource {
|
||||
readonly eventEmitterService: WorkspaceEventEmitter;
|
||||
readonly coreDataSource: DataSource;
|
||||
private _isConstructing = true;
|
||||
dataSourceWithOverridenCreateQueryBuilder: GlobalWorkspaceDataSource;
|
||||
|
||||
constructor(
|
||||
options: DataSourceOptions,
|
||||
eventEmitterService: WorkspaceEventEmitter,
|
||||
coreDataSource: DataSource,
|
||||
) {
|
||||
super(options);
|
||||
this.eventEmitterService = eventEmitterService;
|
||||
this.coreDataSource = coreDataSource;
|
||||
this._isConstructing = false;
|
||||
|
||||
Object.defineProperty(this, 'manager', {
|
||||
|
||||
Reference in New Issue
Block a user