chore(SlateLayout): remove layouts from other endpoints

This commit is contained in:
Aminejv 2021-08-12 17:00:03 +01:00
parent 3ff94ca857
commit d6a7265208
4 changed files with 2 additions and 18 deletions

View File

@ -34,7 +34,6 @@ export const sanitizeSlate = (entity) => {
name: entity.data?.name,
body: entity.data?.body,
preview: entity.data?.preview,
layouts: entity.data?.layouts,
tags: entity.data?.tags,
},
fileCount: entity.fileCount,
@ -110,7 +109,6 @@ export const cleanSlate = (entity) => {
// name: entity.data?.name,
// body: entity.data?.body,
// preview: entity.data?.preview,
// layouts: entity.data?.layouts,
// tags: entity.data?.tags,
// },
};

View File

@ -55,7 +55,6 @@ export default async (req, res) => {
public: slate.isPublic,
objects: reformattedObjects,
ownerId: slate.ownerId,
layouts: slate.data.layouts,
},
};

View File

@ -60,7 +60,6 @@ export default async (req, res) => {
public: slate.isPublic,
objects: reformattedObjects,
ownerId: slate.ownerId,
layouts: slate.data.layouts,
},
};
});

View File

@ -534,26 +534,14 @@ const cleanUsersTable = async () => {
const cleanSlatesTable = async () => {
const slates = await DB.select("*").from("slates");
for (let slate of slates) {
const id = slate.id;
let layouts = slate.data.layouts;
if (layouts && layouts.ver === "2.0" && layouts.layout) {
for (let position of layouts.layout) {
if (position.id) {
position.id = position.id.replace("data-", "");
}
}
} else {
layouts = null;
}
let data = {
layouts,
body: slate.data.body,
name: slate.data.name,
preview: slate.data.preview,
tags: slate.data.tags,
};
// Logging.log(layouts?.layout);
// Logging.log(data);
const { id } = slate;
await DB.from("slates").where("id", id).update({ data });
}
};