Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(global): 🐛 fix API #46

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions service/controllers/profile.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const putDeleteEducation = async (req: any, res: any) => {
res.status(status).json({ data, message: message });
} catch (error: any) {
console.error("Error :: ", error);
res.status(500).json({ message: error.message });
res.status(500).json({ message: error });
}
};

Expand Down Expand Up @@ -178,7 +178,7 @@ const putDeleteExperience = async (req: any, res: any) => {
res.status(status).json({ data, message: message });
} catch (error: any) {
console.error("Error :: ", error);
res.status(500).json({ message: error.message });
res.status(500).json({ message: error });
}
};

Expand Down
31 changes: 14 additions & 17 deletions service/functions/profile.function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
coreConstant,
} from "@wrappid/service-core";

const getContactInfoFunc = async (req: any, res: any) => {

Check warning on line 10 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const userID = req.user.userId;

Expand Down Expand Up @@ -39,7 +39,7 @@
}
};

const getAddressTypeFunc = async (req: any, res: any) => {

Check warning on line 42 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'req' is defined but never used

Check warning on line 42 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const data = await databaseActions.findAll("application", "AddressTypes", {
attributes: ["id", "type"],
Expand All @@ -59,7 +59,7 @@
}
};

const getDepartmentFunc = async (req: any, res: any) => {

Check warning on line 62 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const data = await databaseActions.findAll("application", "Departments", {
where: { ...req.query },
Expand All @@ -79,7 +79,7 @@
}
};

const getPersonContactsFunc = async (req: any, res: any) => {

Check warning on line 82 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const person = await databaseActions.findOne("application", "Persons", {
where: { userId: req.user.userId },
Expand Down Expand Up @@ -119,7 +119,7 @@
}
};

const putBasicDetailsFunc = async (req: any, res: any) => {

Check warning on line 122 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
let file_url = null;
const personId = req.params.id;
Expand Down Expand Up @@ -156,11 +156,11 @@
return { message: "Basic details updated", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

const getRegistrationInfoFunc = async (req: any, res: any) => {

Check warning on line 163 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const userID = req.user.userId;

Expand Down Expand Up @@ -209,14 +209,11 @@
}
} catch (err) {
console.error(err);
return {
error: err,
message: "Error while fetch person registration info data",
};
throw err;
}
};

const putRegistrationDetailsFunc = async (req: any, res: any) => {

Check warning on line 216 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const del_urls: any = [];
let file_url: any = null;
Expand Down Expand Up @@ -332,11 +329,11 @@
return { message: "Registration details updated", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

const postAddEducationFunc = async (req: any, res: any) => {

Check warning on line 336 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const data: any = req.body;
const personId = req.params.id;
Expand Down Expand Up @@ -366,11 +363,11 @@
return { message: "Education create success", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

const putUpdateEducationFunc = async (req: any, res: any) => {

Check warning on line 370 in service/functions/profile.function.ts

View workflow job for this annotation

GitHub Actions / Validate service code style

'res' is defined but never used
try {
const data = req.body;

Expand Down Expand Up @@ -400,7 +397,7 @@
return { message: "Education update success", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

Expand All @@ -422,16 +419,16 @@
);

if (nrows == 0) {
throw "Experience update success";
throw "Education Delete error: No Row Update";
}
}
);

console.log("education deleted: ", req.params.id);
console.log("Education deleted: ", req.params.id);
return { message: "Education delete success", status: 200 };
} catch (error) {
console.log("education Delete error", error);
return { message: error, status: 500 };
console.log("Education Delete error: ", error);
throw error;
}
};

Expand Down Expand Up @@ -465,7 +462,7 @@
return { message: "Experience create success", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

Expand Down Expand Up @@ -499,7 +496,7 @@
return { message: "Experience update success", status: 200 };
} catch (err) {
console.log(err);
return { message: err, status: 500 };
throw err;
}
};

Expand All @@ -521,16 +518,16 @@
);

if (nrows == 0) {
throw "Experience delete error";
throw "Experience delete error: No Row Update";
}
}
);

console.log("Experiences deleted: ", req.params.id);
return { message: "Experience delete success", status: 200 };
} catch (error) {
console.log("education Delete error", error);
return { message: error, status: 500 };
console.log("Experience Delete error", error);
throw error;
}
};

Expand Down
Loading