Fixed: delete component unkown error

This commit is contained in:
Muhsin Shah 2024-07-02 20:04:04 +05:30
parent a5458eeeaa
commit 8489b5355d

View file

@ -68,12 +68,12 @@ export class ComponentsService {
}
async update(componentDiff: object, appVersionId: string) {
return dbTransactionForAppVersionAssociationsUpdate(async (manager:EntityManager) => {
return dbTransactionForAppVersionAssociationsUpdate(async (manager: EntityManager) => {
for (const componentId in componentDiff) {
const { component } = componentDiff[componentId];
const componentData: Component = await manager.findOne(Component, {
where: { id: componentId }
where: { id: componentId },
});
if (!componentData) {
@ -123,7 +123,9 @@ export class ComponentsService {
async delete(componentIds: string[], appVersionId: string, isComponentCut = false) {
return dbTransactionForAppVersionAssociationsUpdate(async (manager: EntityManager) => {
const components = await manager.find(Component, { where: In(componentIds)});
const components = await manager.find(Component, {
where: { id: In(componentIds) },
});
if (!components.length) {
return {
@ -139,7 +141,7 @@ export class ComponentsService {
});
}
await manager.delete(Component, componentIds);
await manager.delete(Component, { id: In(componentIds) });
}, appVersionId);
}
@ -162,7 +164,7 @@ export class ComponentsService {
const { layouts, component } = componenstLayoutDiff[componentId];
for (const type in layouts) {
const componentLayout = await manager.findOne(Layout, { where: {componentId, type} });
const componentLayout = await manager.findOne(Layout, { where: { componentId, type } });
if (componentLayout) {
const layout = {