small change updated
This commit is contained in:
@@ -11,34 +11,10 @@ import {
|
||||
|
||||
const V1Line = express.Router();
|
||||
|
||||
V1Line.post(
|
||||
"/lines",
|
||||
tokenValidator,
|
||||
NewLineController
|
||||
);
|
||||
V1Line.post(
|
||||
"/points",
|
||||
tokenValidator,
|
||||
UpdateLineController
|
||||
);
|
||||
V1Line.patch(
|
||||
"/layers/delete",
|
||||
tokenValidator,
|
||||
DeleteLayerController
|
||||
);
|
||||
V1Line.patch(
|
||||
"/lines/delete",
|
||||
tokenValidator,
|
||||
DeleteLineController
|
||||
);
|
||||
V1Line.patch(
|
||||
"/points/delete",
|
||||
tokenValidator,
|
||||
DeleteLinePointsController
|
||||
);
|
||||
V1Line.get(
|
||||
"/lines/:projectId",
|
||||
tokenValidator,
|
||||
GetLinesController
|
||||
);
|
||||
V1Line.post("/lines", tokenValidator, NewLineController);
|
||||
V1Line.post("/points", tokenValidator, UpdateLineController);
|
||||
V1Line.patch("/layers/delete", tokenValidator, DeleteLayerController);
|
||||
V1Line.patch("/lines/delete", tokenValidator, DeleteLineController);
|
||||
V1Line.patch("/points/delete", tokenValidator, DeleteLinePointsController);
|
||||
V1Line.get("/lines/:projectId", tokenValidator, GetLinesController);
|
||||
export default V1Line;
|
||||
|
||||
@@ -80,7 +80,6 @@ export const setAssetModel = async (
|
||||
userId: userId,
|
||||
isArchive: false,
|
||||
});
|
||||
console.log("findvalue: ", findvalue);
|
||||
if (findvalue) {
|
||||
const updatevalue = await assetModel(organization).findOneAndUpdate(
|
||||
{
|
||||
|
||||
@@ -65,16 +65,16 @@ export const SetZone = async (data: ISetZone): Promise<IResult> => {
|
||||
});
|
||||
if (findZoneId) {
|
||||
const updateZone = await zoneModel(organization)
|
||||
.findOneAndUpdate(
|
||||
{ zoneUuid: zoneUuid, projectId: projectId, isArchive: false },
|
||||
{
|
||||
points: points,
|
||||
viewPortposition: viewPortposition,
|
||||
viewPortCenter: viewPortCenter,
|
||||
},
|
||||
{ new: true }
|
||||
)
|
||||
.select("-_id -__v");
|
||||
.findOneAndUpdate(
|
||||
{ zoneUuid: zoneUuid, projectId: projectId, isArchive: false },
|
||||
{
|
||||
points: points,
|
||||
viewPortposition: viewPortposition,
|
||||
viewPortCenter: viewPortCenter,
|
||||
},
|
||||
{ new: true }
|
||||
)
|
||||
.select("-_id -__v");
|
||||
return { status: "zone updated", data: updateZone };
|
||||
} else {
|
||||
const zoneCreate = await zoneModel(organization).create({
|
||||
|
||||
@@ -27,7 +27,6 @@ export const SetCameraHandleEvent = async (
|
||||
ErrorResponse(missingFields, socket, data.organization), connectedUsersByOrg);
|
||||
return;
|
||||
}
|
||||
console.log('data: ', data);
|
||||
const result = await SetCamera(data);
|
||||
const status = typeof result?.status === "string" ? result.status : "unknown";
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ app.get("/", (req: Request, res: Response) => {
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: ["GET", "POST"]
|
||||
}
|
||||
methods: ["GET", "POST"],
|
||||
},
|
||||
});
|
||||
|
||||
initSocketServer(io);
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
deleteLinPoiteItems,
|
||||
updateLineItems,
|
||||
createLineItems,
|
||||
|
||||
} from "../services/lines/line-Controller.ts";
|
||||
import {
|
||||
activeUserOffline,
|
||||
@@ -58,11 +57,7 @@ import {
|
||||
projecUpdateHandleEvent,
|
||||
} from "../controllers/projectController/projectController.ts";
|
||||
|
||||
const cameraHandleEvent = async (
|
||||
event: string,
|
||||
socket: Socket,
|
||||
data: any,
|
||||
) => {
|
||||
const cameraHandleEvent = async (event: string, socket: Socket, data: any) => {
|
||||
if (!data?.organization) {
|
||||
console.warn(`Missing organization for event: ${event}`);
|
||||
return;
|
||||
@@ -96,8 +91,7 @@ const cameraHandleEvent = async (
|
||||
const EnvironmentHandleEvent = async (
|
||||
event: string,
|
||||
socket: Socket,
|
||||
data: any,
|
||||
|
||||
data: any
|
||||
) => {
|
||||
if (!data?.organization) {
|
||||
console.warn(`Missing organization for event: ${event}`);
|
||||
@@ -462,11 +456,7 @@ const zoneHandleEvent = async (
|
||||
}
|
||||
}
|
||||
};
|
||||
const panelHandleEvent = async (
|
||||
event: string,
|
||||
socket: Socket,
|
||||
data: any,
|
||||
) => {
|
||||
const panelHandleEvent = async (event: string, socket: Socket, data: any) => {
|
||||
if (!data?.organization) {
|
||||
console.warn(`Missing organization for event: ${event}`);
|
||||
return;
|
||||
@@ -697,7 +687,7 @@ const floatHandleEvent = async (
|
||||
const templateHandleEvent = async (
|
||||
event: string,
|
||||
socket: Socket,
|
||||
data: any,
|
||||
data: any
|
||||
) => {
|
||||
if (!data?.organization) {
|
||||
console.warn(`Missing organization for event: ${event}`);
|
||||
@@ -856,7 +846,7 @@ const Widget3DHandleEvent = async (
|
||||
const modelAssetHandleEvent = async (
|
||||
event: string,
|
||||
socket: Socket,
|
||||
data: any,
|
||||
data: any
|
||||
) => {
|
||||
if (!data?.organization) {
|
||||
console.warn(`Missing organization for event: ${event}`);
|
||||
@@ -954,7 +944,6 @@ interface UserSocketInfo {
|
||||
role: string;
|
||||
}
|
||||
|
||||
|
||||
export const initSocketServer = (io: Server) => {
|
||||
const namespaces = {
|
||||
Builder: io.of("/Builder"),
|
||||
@@ -969,10 +958,10 @@ export const initSocketServer = (io: Server) => {
|
||||
namespace: any,
|
||||
...eventHandlers: Function[]
|
||||
) => {
|
||||
if (namespace._handlersRegistered) return;
|
||||
namespace._handlersRegistered = true;
|
||||
namespace.use((socket: Socket, next: (err?: Error) => void) => {
|
||||
const token = socket.handshake.auth.token;
|
||||
if (namespace._handlersRegistered) return;
|
||||
namespace._handlersRegistered = true;
|
||||
namespace.use((socket: Socket, next: (err?: Error) => void) => {
|
||||
const token = socket.handshake.auth.token;
|
||||
|
||||
if (!token) {
|
||||
console.log("No token provided");
|
||||
@@ -982,12 +971,10 @@ namespace.use((socket: Socket, next: (err?: Error) => void) => {
|
||||
});
|
||||
|
||||
namespace.on("connection", async (socket: Socket) => {
|
||||
|
||||
const { organization, email,} = socket.handshake.auth;
|
||||
const { organization, email } = socket.handshake.auth;
|
||||
|
||||
if (organization) {
|
||||
socket.join(organization);
|
||||
|
||||
}
|
||||
if (organization && email) {
|
||||
if (!onlineUsers[organization]) {
|
||||
|
||||
Reference in New Issue
Block a user