Implement object fields and settings new layout (#7979)

### Description

- This PR has as the base branch the TWNTY-5491 branch, but we also had
to include updates from the main branch, and currently, there are
conflicts in the TWNTY-5491, that cause errors on typescript in this PR,
so, we can update once the conflicts are resolved on the base branch,
but the functionality can be reviewed anyway
- We Implemented a new layout of object details settings and new, the
data is auto-saved in `Settings `tab of object detail
- There is no indication to the user that data are saved automatically
in the design, currently we are disabling the form

### Demo\

<https://www.loom.com/share/4198c0aa54b5450780a570ceee574838?sid=b4ef0a42-2d41-435f-9f5f-1b16816939f7>

### Refs

#TWNTY-5491

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: gitstart-twenty <140154534+gitstart-twenty@users.noreply.github.com>
Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
gitstart-app[bot]
2024-11-07 14:50:53 +01:00
committed by GitHub
parent 3be30651b7
commit 7bab65b569
25 changed files with 496 additions and 391 deletions

View File

@ -428,11 +428,13 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
await this.objectMetadataMigrationService.createRenameTableMigration(
existingObjectMetadata,
objectMetadataForUpdate,
objectMetadataForUpdate.workspaceId,
);
await this.objectMetadataMigrationService.createRelationsUpdatesMigrations(
existingObjectMetadata,
objectMetadataForUpdate,
objectMetadataForUpdate.workspaceId,
);
}

View File

@ -93,6 +93,7 @@ export class ObjectMetadataMigrationService {
public async createRenameTableMigration(
existingObjectMetadata: ObjectMetadataEntity,
objectMetadataForUpdate: ObjectMetadataEntity,
workspaceId: string,
) {
const newTargetTableName = computeObjectTargetTable(
objectMetadataForUpdate,
@ -103,7 +104,7 @@ export class ObjectMetadataMigrationService {
this.workspaceMigrationService.createCustomMigration(
generateMigrationName(`rename-${existingObjectMetadata.nameSingular}`),
objectMetadataForUpdate.workspaceId,
workspaceId,
[
{
name: existingTargetTableName,
@ -117,6 +118,7 @@ export class ObjectMetadataMigrationService {
public async createRelationsUpdatesMigrations(
existingObjectMetadata: ObjectMetadataEntity,
updatedObjectMetadata: ObjectMetadataEntity,
workspaceId: string,
) {
const existingTableName = computeObjectTargetTable(existingObjectMetadata);
const newTableName = computeObjectTargetTable(updatedObjectMetadata);
@ -128,6 +130,7 @@ export class ObjectMetadataMigrationService {
isForeignKey: true,
},
name: `${existingObjectMetadata.nameSingular}Id`,
workspaceId: workspaceId,
};
const fieldsWihStandardRelation = await this.fieldMetadataRepository.find(
@ -150,7 +153,7 @@ export class ObjectMetadataMigrationService {
fieldsWihStandardRelation.map(async (fieldWihStandardRelation) => {
const relatedObject = await this.objectMetadataRepository.findOneBy({
id: fieldWihStandardRelation.objectMetadataId,
workspaceId: updatedObjectMetadata.workspaceId,
workspaceId: workspaceId,
});
if (relatedObject) {
@ -175,7 +178,7 @@ export class ObjectMetadataMigrationService {
generateMigrationName(
`rename-${existingObjectMetadata.nameSingular}-to-${updatedObjectMetadata.nameSingular}-in-${relatedObject.nameSingular}`,
),
updatedObjectMetadata.workspaceId,
workspaceId,
[
{
name: relationTableName,