POC: chore: use Nx workspace lint rules (#3163)
* chore: use Nx workspace lint rules Closes #3162 * Fix lint * Fix lint on BE * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -36,18 +36,24 @@ export const mapObjectMetadataByUniqueIdentifier = <
|
||||
>(
|
||||
arr: T[],
|
||||
): Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }> => {
|
||||
return arr.reduce((acc, curr) => {
|
||||
acc[curr.nameSingular] = {
|
||||
...curr,
|
||||
fields: curr.fields.reduce((acc, curr) => {
|
||||
acc[curr.name] = curr;
|
||||
return arr.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.nameSingular] = {
|
||||
...curr,
|
||||
fields: curr.fields.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.name] = curr;
|
||||
|
||||
return acc;
|
||||
}, {} as Record<string, U>),
|
||||
};
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, U>,
|
||||
),
|
||||
};
|
||||
|
||||
return acc;
|
||||
}, {} as Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }>);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }>,
|
||||
);
|
||||
};
|
||||
|
||||
export const convertStringifiedFieldsToJSON = <
|
||||
|
||||
@ -405,7 +405,7 @@ export class WorkspaceSyncMetadataService {
|
||||
WorkspaceMigrationColumnActionType.CREATE,
|
||||
field,
|
||||
),
|
||||
} satisfies WorkspaceMigrationTableAction),
|
||||
}) satisfies WorkspaceMigrationTableAction,
|
||||
),
|
||||
];
|
||||
|
||||
@ -420,11 +420,14 @@ export class WorkspaceSyncMetadataService {
|
||||
// TODO: handle object delete migrations.
|
||||
// Note: we need to delete the relation first due to the DB constraint.
|
||||
|
||||
const objectsInDbById = objectsInDB.reduce((result, currentObject) => {
|
||||
result[currentObject.id] = currentObject;
|
||||
const objectsInDbById = objectsInDB.reduce(
|
||||
(result, currentObject) => {
|
||||
result[currentObject.id] = currentObject;
|
||||
|
||||
return result;
|
||||
}, {} as Record<string, ObjectMetadataEntity>);
|
||||
return result;
|
||||
},
|
||||
{} as Record<string, ObjectMetadataEntity>,
|
||||
);
|
||||
|
||||
if (fieldsToCreate.length > 0) {
|
||||
fieldsToCreate.map((field) => {
|
||||
|
||||
Reference in New Issue
Block a user