clear the testing commits
This commit is contained in:
@@ -11,28 +11,28 @@ interface IResult {
|
||||
}
|
||||
interface IAddPanel {
|
||||
organization: string;
|
||||
zoneId: string;
|
||||
zoneUuid: string;
|
||||
panelOrder: string[];
|
||||
userId: string;
|
||||
projectId: string;
|
||||
}
|
||||
interface IPanel {
|
||||
organization: string;
|
||||
zoneId: string;
|
||||
zoneUuid: string;
|
||||
panelName: string;
|
||||
userId: string;
|
||||
projectId: string;
|
||||
}
|
||||
interface ILockedPanel {
|
||||
organization: string;
|
||||
zoneId: string;
|
||||
zoneUuid: string;
|
||||
lockedPanel: string[];
|
||||
userId: string;
|
||||
projectId: string;
|
||||
}
|
||||
export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
||||
try {
|
||||
const { organization, zoneId, panelOrder, userId, projectId } = data;
|
||||
const { organization, zoneUuid, panelOrder, userId, projectId } = data;
|
||||
const UserExists = await existingUser(userId, organization);
|
||||
if (!UserExists) return { status: "User not found" };
|
||||
const LivingProject = await existingProjectById(
|
||||
@@ -42,18 +42,18 @@ export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
||||
);
|
||||
if (!LivingProject) return { status: "Project not found" };
|
||||
const existingZone = await zoneModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
});
|
||||
if (!existingZone) return { status: "Zone not found" };
|
||||
await zoneModel(organization).findOneAndUpdate(
|
||||
{ zoneId: zoneId, isArchive: false },
|
||||
{ zoneUuid: zoneUuid, isArchive: false },
|
||||
{ panelOrder: panelOrder },
|
||||
{ new: true }
|
||||
);
|
||||
const existingPanels = await panelModel(organization).find({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
||||
const createdPanels = [];
|
||||
for (const panelName of missingPanels) {
|
||||
const newPanel = await panelModel(organization).create({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
panelName: panelName,
|
||||
widgets: [],
|
||||
isArchive: false,
|
||||
@@ -82,7 +82,7 @@ export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
||||
|
||||
const zoneAndPanelData = await getZoneAndPanelData(
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId
|
||||
);
|
||||
if (!zoneAndPanelData) {
|
||||
@@ -103,7 +103,7 @@ export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
||||
};
|
||||
export const DelPanel = async (data: IPanel): Promise<IResult> => {
|
||||
try {
|
||||
const { organization, zoneId, panelName, userId, projectId } = data;
|
||||
const { organization, zoneUuid, panelName, userId, projectId } = data;
|
||||
const UserExists = await existingUser(userId, organization);
|
||||
if (!UserExists) return { status: "User not found" };
|
||||
const LivingProject = await existingProjectById(
|
||||
@@ -113,13 +113,13 @@ export const DelPanel = async (data: IPanel): Promise<IResult> => {
|
||||
);
|
||||
if (!LivingProject) return { status: "Project not found" };
|
||||
const existingZone = await zoneModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
});
|
||||
if (!existingZone) return { status: "Zone not found" };
|
||||
const existingPanel = await panelModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
panelName: panelName,
|
||||
isArchive: false,
|
||||
});
|
||||
@@ -147,7 +147,7 @@ export const DelPanel = async (data: IPanel): Promise<IResult> => {
|
||||
}
|
||||
const zoneAndPanelData = await getZoneAndPanelData(
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId
|
||||
);
|
||||
if (!zoneAndPanelData) {
|
||||
@@ -168,7 +168,7 @@ export const DelPanel = async (data: IPanel): Promise<IResult> => {
|
||||
};
|
||||
export const ClearPanel = async (data: IPanel): Promise<IResult> => {
|
||||
try {
|
||||
const { organization, zoneId, panelName, userId, projectId } = data;
|
||||
const { organization, zoneUuid, panelName, userId, projectId } = data;
|
||||
const UserExists = await existingUser(userId, organization);
|
||||
if (!UserExists) return { status: "User not found" };
|
||||
const LivingProject = await existingProjectById(
|
||||
@@ -178,13 +178,13 @@ export const ClearPanel = async (data: IPanel): Promise<IResult> => {
|
||||
);
|
||||
if (!LivingProject) return { status: "Project not found" };
|
||||
const existingZone = await zoneModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
});
|
||||
if (!existingZone) return { status: "Zone not found" };
|
||||
const existingPanel = await panelModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
panelName: panelName,
|
||||
isArchive: false,
|
||||
});
|
||||
@@ -212,7 +212,7 @@ export const ClearPanel = async (data: IPanel): Promise<IResult> => {
|
||||
|
||||
const zoneAndPanelData = await getZoneAndPanelData(
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId
|
||||
);
|
||||
if (!zoneAndPanelData) {
|
||||
@@ -237,7 +237,7 @@ export const ClearPanel = async (data: IPanel): Promise<IResult> => {
|
||||
};
|
||||
export const LockedPanel = async (data: ILockedPanel): Promise<IResult> => {
|
||||
try {
|
||||
const { organization, zoneId, lockedPanel, userId, projectId } = data;
|
||||
const { organization, zoneUuid, lockedPanel, userId, projectId } = data;
|
||||
const UserExists = await existingUser(userId, organization);
|
||||
if (!UserExists) return { status: "User not found" };
|
||||
const LivingProject = await existingProjectById(
|
||||
@@ -247,14 +247,14 @@ export const LockedPanel = async (data: ILockedPanel): Promise<IResult> => {
|
||||
);
|
||||
if (!LivingProject) return { status: "Project not found" };
|
||||
const existingZone = await zoneModel(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
});
|
||||
if (!existingZone) return { status: "Zone not found" };
|
||||
else {
|
||||
const updateLockedPanel = await zoneModel(organization).findOneAndUpdate(
|
||||
{ zoneId: zoneId, isArchive: false },
|
||||
{ zoneUuid: zoneUuid, isArchive: false },
|
||||
{
|
||||
lockedPanel: lockedPanel,
|
||||
},
|
||||
@@ -262,7 +262,7 @@ export const LockedPanel = async (data: ILockedPanel): Promise<IResult> => {
|
||||
);
|
||||
const zoneAndPanelData = await getZoneAndPanelData(
|
||||
organization,
|
||||
zoneId,
|
||||
zoneUuid,
|
||||
projectId
|
||||
);
|
||||
if (!zoneAndPanelData) {
|
||||
@@ -290,7 +290,7 @@ export const LockedPanel = async (data: ILockedPanel): Promise<IResult> => {
|
||||
};
|
||||
const getZoneAndPanelData = async (
|
||||
organization: string,
|
||||
zoneId: string,
|
||||
zoneUuid: string,
|
||||
projectId: string
|
||||
) => {
|
||||
try {
|
||||
@@ -298,18 +298,18 @@ const getZoneAndPanelData = async (
|
||||
|
||||
const existingZone = await zoneModel(organization)
|
||||
.findOne({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
projectId: projectId,
|
||||
})
|
||||
.select(
|
||||
"panelOrder zoneName zonePoints lockedPanel zoneId viewPortCenter viewPortposition"
|
||||
"panelOrder zoneName zonePoints lockedPanel zoneUuid viewPortCenter viewPortposition"
|
||||
);
|
||||
if (!existingZone) {
|
||||
return { status: "Zone not found" };
|
||||
} else {
|
||||
const panelData = await panelModel(organization).find({
|
||||
zoneId: zoneId,
|
||||
zoneUuid: zoneUuid,
|
||||
isArchive: false,
|
||||
});
|
||||
const zoneName = existingZone.zoneName as string;
|
||||
@@ -336,7 +336,7 @@ const getZoneAndPanelData = async (
|
||||
const objectData = {
|
||||
zoneName,
|
||||
viewPortposition: existingZone.viewPortposition,
|
||||
zoneId: existingZone.zoneId,
|
||||
zoneUuid: existingZone.zoneUuid,
|
||||
viewPortCenter: existingZone.viewPortCenter,
|
||||
activeSides: existingZone.panelOrder || [],
|
||||
panelOrder: existingZone.panelOrder || [],
|
||||
|
||||
Reference in New Issue
Block a user