swagger documentation for Api

This commit is contained in:
2025-01-30 12:44:04 +05:30
parent 5984f445f7
commit 465f713624
45 changed files with 5201 additions and 2308 deletions

View File

@@ -1,31 +1,31 @@
import { Request, Response } from "express";
import { Socket } from "socket.io";
import cameraModel from "../../../shared/model/camera/camera-Model";
export const createCamera = async (data: any,) => {
try {
const { userId, position, target, organization,rotation } = data
const findCamera = await cameraModel(organization).findOne({ userId: userId })
if (findCamera) {
const updateCamera = await cameraModel(organization).findOneAndUpdate(
{ userId: userId }, { position: position, target: target,rotation:rotation }, { new: true });
// io.emit('cameraUpdateResponse', { success: true, message: 'Camera updated', data: updateCamera });
return { success: true, message: 'Camera updated', data: updateCamera,organization:organization}
}
else {
const newCamera = await cameraModel(organization).create({ userId, position, target,rotation })
return { success: false, message: 'Camera created' ,data:newCamera,organization:organization}
}
// Send response with the created document
} catch (error) {
console.error('Error creating camera:', error);
return { success: false, message: 'Error creating or updating camera', error, }
}
}
import { Request, Response } from "express";
import { Socket } from "socket.io";
import cameraModel from "../../../shared/model/camera/camera-Model";
export const createCamera = async (data: any,) => {
try {
const { userId, position, target, organization,rotation } = data
const findCamera = await cameraModel(organization).findOne({ userId: userId })
if (findCamera) {
const updateCamera = await cameraModel(organization).findOneAndUpdate(
{ userId: userId }, { position: position, target: target,rotation:rotation }, { new: true });
// io.emit('cameraUpdateResponse', { success: true, message: 'Camera updated', data: updateCamera });
return { success: true, message: 'Camera updated', data: updateCamera,organization:organization}
}
else {
const newCamera = await cameraModel(organization).create({ userId, position, target,rotation })
return { success: false, message: 'Camera created' ,data:newCamera,organization:organization}
}
// Send response with the created document
} catch (error) {
console.error('Error creating camera:', error);
return { success: false, message: 'Error creating or updating camera', error, }
}
}