ObjectMetadataServiceV2.updateOne (#13891)
# Introduction Last service to get migrated, `updateOne` object metadata service v2
This commit is contained in:
+9
-8
@@ -110,7 +110,6 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
workspaceId: createObjectInput.workspaceId,
|
||||
});
|
||||
|
||||
// Since V2 returns FlatObjectMetadata, we need to fetch the created entity
|
||||
const createdObjectMetadata = await this.objectMetadataRepository.findOne(
|
||||
{
|
||||
where: {
|
||||
@@ -288,7 +287,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
}
|
||||
|
||||
public async updateOneObject(
|
||||
input: UpdateOneObjectInput,
|
||||
updateObjectInput: UpdateOneObjectInput,
|
||||
workspaceId: string,
|
||||
): Promise<ObjectMetadataEntity> {
|
||||
const mainDataSource =
|
||||
@@ -306,14 +305,16 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
await this.workspaceMetadataCacheService.getExistingOrRecomputeMetadataMaps(
|
||||
{ workspaceId },
|
||||
);
|
||||
const inputId = input.id;
|
||||
const inputId = updateObjectInput.id;
|
||||
const inputPayload = {
|
||||
...input.update,
|
||||
...(isDefined(input.update.labelSingular)
|
||||
? { labelSingular: capitalize(input.update.labelSingular) }
|
||||
...updateObjectInput.update,
|
||||
...(isDefined(updateObjectInput.update.labelSingular)
|
||||
? {
|
||||
labelSingular: capitalize(updateObjectInput.update.labelSingular),
|
||||
}
|
||||
: {}),
|
||||
...(isDefined(input.update.labelPlural)
|
||||
? { labelPlural: capitalize(input.update.labelPlural) }
|
||||
...(isDefined(updateObjectInput.update.labelPlural)
|
||||
? { labelPlural: capitalize(updateObjectInput.update.labelPlural) }
|
||||
: {}),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user