api/v2 routing added for the userDatas
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import projectModel from "../../model/project/project-model.ts";
|
||||
import userModel from "../../model/user-Model.ts";
|
||||
import versionModel from "../../model/version/versionModel.ts";
|
||||
import UsersDataModel from "../../V1Models/Auth/user.ts";
|
||||
import cameraModel from "../../V1Models/Builder/cameraModel.ts";
|
||||
import { existingProjectById } from "../helpers/ProjecthelperFn.ts";
|
||||
import { existingProjectById } from "../helpers/v1projecthelperFns.ts";
|
||||
interface IcameraData {
|
||||
userId: string;
|
||||
role: string;
|
||||
position: Object;
|
||||
target: Object;
|
||||
rotation: Object;
|
||||
@@ -16,6 +14,7 @@ interface IcameraData {
|
||||
interface IgetCameras {
|
||||
organization: string;
|
||||
userId?: string;
|
||||
role: string;
|
||||
}
|
||||
export const SetCamera = async (
|
||||
data: IcameraData
|
||||
@@ -23,6 +22,7 @@ export const SetCamera = async (
|
||||
try {
|
||||
const {
|
||||
userId,
|
||||
role,
|
||||
position,
|
||||
target,
|
||||
rotation,
|
||||
@@ -65,7 +65,7 @@ export const SetCamera = async (
|
||||
});
|
||||
|
||||
return {
|
||||
status: "Creation Success",
|
||||
status: "Success",
|
||||
data: newCamera,
|
||||
};
|
||||
}
|
||||
@@ -84,13 +84,13 @@ export const SetCamera = async (
|
||||
export const GetCamers = async (
|
||||
data: IgetCameras
|
||||
): Promise<{ status: string; data?: Object }> => {
|
||||
const { userId, organization } = data;
|
||||
const { userId, organization, role } = data;
|
||||
try {
|
||||
const findCamera = await cameraModel(organization).findOne({
|
||||
userId: userId,
|
||||
});
|
||||
if (!findCamera) {
|
||||
return { status: "user not found" };
|
||||
return { status: "Camera not found" };
|
||||
} else {
|
||||
return { status: "Success", data: findCamera };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user