clear the testing commits
This commit is contained in:
@@ -29,7 +29,7 @@ interface ITemplateToZone {
|
||||
organization: string;
|
||||
templateID: string;
|
||||
projectId: string;
|
||||
zoneId: string;
|
||||
zoneUuid: string;
|
||||
userId: string;
|
||||
}
|
||||
interface ITemplate {
|
||||
@@ -102,7 +102,7 @@ export const AddTemplateToZone = async (
|
||||
data: ITemplateToZone
|
||||
): Promise<IResult> => {
|
||||
try {
|
||||
const { organization, templateID, projectId, zoneId, userId } = data;
|
||||
const { organization, templateID, projectId, zoneUuid, userId } = data;
|
||||
const UserExists = await existingUser(userId, organization);
|
||||
if (!UserExists) return { status: "User not found" };
|
||||
const LivingProject = await existingProjectById(
|
||||
@@ -112,7 +112,7 @@ export const AddTemplateToZone = async (
|
||||
);
|
||||
if (!LivingProject) return { status: "Project not found" };
|
||||
const existingZone = await zoneModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
});
|
||||
@@ -135,7 +135,7 @@ export const AddTemplateToZone = async (
|
||||
existingZone.panelOrder = existingTemplate.panelOrder;
|
||||
await existingZone.save();
|
||||
const archivePanelDatas = await panelModel(organization).find({
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
for (const panelData of archivePanelDatas) {
|
||||
@@ -145,18 +145,18 @@ export const AddTemplateToZone = async (
|
||||
});
|
||||
}
|
||||
await panelModel(organization).deleteMany({
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
await floatWidgetModel(organization).deleteMany({
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
}
|
||||
existingZone.panelOrder = existingTemplate.panelOrder;
|
||||
await existingZone.save();
|
||||
const existingPanels = await panelModel(organization).find({
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
const existingPanelNames = existingPanels.map(
|
||||
@@ -169,7 +169,7 @@ export const AddTemplateToZone = async (
|
||||
await Promise.all(
|
||||
missingPanels.map((panelName: any) =>
|
||||
panelModel(organization).create({
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
panelName,
|
||||
widgets: [],
|
||||
isArchive: false,
|
||||
@@ -180,7 +180,7 @@ export const AddTemplateToZone = async (
|
||||
for (const widgetData of existingTemplate.widgets) {
|
||||
const addedExistingPanel = await panelModel(organization).findOne({
|
||||
panelName: widgetData.panel,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
if (!addedExistingPanel) continue;
|
||||
@@ -195,7 +195,7 @@ export const AddTemplateToZone = async (
|
||||
const newWidget = await widgetModel(organization).create({
|
||||
widgetID: widgetData.id,
|
||||
elementType: widgetData.type,
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
widgetName: widgetData.widgetName || "Widget",
|
||||
panelID: addedExistingPanel._id,
|
||||
widgetside: widgetData.panel,
|
||||
@@ -208,7 +208,7 @@ export const AddTemplateToZone = async (
|
||||
const existingFloatWidget = await floatWidgetModel(organization).findOne({
|
||||
floatWidgetID: floatData.id,
|
||||
isArchive: false,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
});
|
||||
if (existingFloatWidget) continue;
|
||||
|
||||
@@ -219,7 +219,7 @@ export const AddTemplateToZone = async (
|
||||
position: floatData.position,
|
||||
per: floatData.per,
|
||||
value: floatData.value,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
});
|
||||
}
|
||||
const templateZoneDatas = {
|
||||
@@ -231,7 +231,7 @@ export const AddTemplateToZone = async (
|
||||
snapshot: existingTemplate.snapshot,
|
||||
floatingWidget: existingTemplate.floatWidgets,
|
||||
},
|
||||
zoneId: existingZone.zoneId,
|
||||
zoneUuid: existingZone.zoneUuid,
|
||||
zoneName: existingZone.zoneName,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user