!role All fields are required updated

This commit is contained in:
2025-06-24 12:18:33 +05:30
parent 97eb5e6715
commit 51c45a6a68
7 changed files with 81 additions and 57 deletions

View File

@@ -66,14 +66,14 @@ export const GetProjects = async (
res: Response
): Promise<void> => {
try {
const { userId, organization, role } = req.user || {};
if (!userId || !organization || !role) {
const { userId, organization } = req.user || {};
if (!userId || !organization) {
res.status(400).json({
message: "All fields are required",
});
return;
}
const result = await GetAllProjects({ userId, organization, role });
const result = await GetAllProjects({ userId, organization });
switch (result?.status) {
case "User not found":
res.status(404).json({
@@ -158,7 +158,7 @@ export const updateProjectController = async (
const { userId, organization, role } = req.user || {};
const { projectId } = req.params;
const { projectName, thumbnail } = req.body;
if (!userId || !organization || !projectId || !role) {
if (!userId || !organization || !projectId) {
res.status(400).json({
message: "All fields are required",
});
@@ -170,7 +170,6 @@ export const updateProjectController = async (
userId,
projectName,
thumbnail,
role,
});
switch (result?.status) {
case "Project not found":
@@ -215,7 +214,7 @@ export const ViewData = async (
const { projectId } = req.params as {
projectId: string;
};
if (!userId || !organization || !projectId || !role) {
if (!userId || !organization || !projectId) {
res.status(400).json({
message: "All fields are required",
});
@@ -225,7 +224,6 @@ export const ViewData = async (
projectId,
organization,
userId,
role,
});
switch (result?.status) {
case "Project not found":

View File

@@ -12,13 +12,13 @@ export const GetTrashList = async (
): Promise<void> => {
try {
const { organization, role, userId } = req.user || {};
if (!organization || !role || !userId) {
if (!organization || !userId) {
res.status(400).json({
message: "All fields are required",
});
return;
}
const result = await TrashDatas({ organization, role, userId });
const result = await TrashDatas({ organization, userId });
switch (result.status) {
case "User not found":
@@ -60,7 +60,7 @@ export const RestoreTrash = async (
const { projectId } = req.query as {
projectId: string;
};
if (!organization || !projectId || !role || !userId) {
if (!organization || !projectId || !userId) {
res.status(400).json({
message: "All fields are required",
});
@@ -69,7 +69,6 @@ export const RestoreTrash = async (
const result = await RestoreTrashData({
organization,
projectId,
role,
userId,
});
@@ -116,7 +115,7 @@ export const DeleteTrashData = async (
const { projectId } = req.query as {
projectId: string;
};
if (!organization || !projectId || !role || !userId) {
if (!organization || !projectId || !userId) {
res.status(400).json({
message: "All fields are required",
});
@@ -125,7 +124,6 @@ export const DeleteTrashData = async (
const result = await TrashDelete({
organization,
projectId,
role,
userId,
});

View File

@@ -13,7 +13,7 @@ export const versionAddcontroller = async (
): Promise<void> => {
try {
const { organization, role, userId } = req.user || {};
if (!organization || !role || !userId) {
if (!organization || !userId) {
res.status(400).json({
message: "All fields are required",
});
@@ -69,7 +69,7 @@ export const GetversionList = async (
): Promise<void> => {
try {
const { organization, role, userId } = req.user || {};
if (!organization || !role || !userId) {
if (!organization || !userId) {
res.status(400).json({
message: "All fields are required",
});
@@ -121,7 +121,7 @@ export const rollbackcontroller = async (
): Promise<void> => {
try {
const { organization, role, userId } = req.user || {};
if (!organization || !role || !userId) {
if (!organization || !userId) {
res.status(400).json({
message: "All fields are required",
});
@@ -176,7 +176,7 @@ export const GetversionHistory = async (
): Promise<void> => {
try {
const { organization, role, userId } = req.user || {};
if (!organization || !role || !userId) {
if (!organization || !userId) {
res.status(400).json({
message: "All fields are required",
});