MCPcopy Create free account
hub / github.com/RealDevSquad/website-backend / addUserIntro

Function addUserIntro

controllers/users.js:868–912  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

866 logger.error(`Error while rejecting profile diff: ${error}`);
867 return res.boom.badImplementation(INTERNAL_SERVER_ERROR);
868 }
869};
870
871const addUserIntro = async (req, res) => {
872 try {
873 const rawData = req.body;
874 const joinData = await userQuery.getJoinData(req.userData.id);
875
876 if (joinData.length === 1) {
877 return res.status(409).json({
878 message: "User data is already present!",
879 });
880 }
881
882 const data = {
883 userId: req.userData.id,
884 biodata: {
885 firstName: rawData.firstName,
886 lastName: rawData.lastName,
887 },
888 location: {
889 city: rawData.city,
890 state: rawData.state,
891 country: rawData.country,
892 },
893 professional: {
894 institution: rawData.college,
895 skills: rawData.skills,
896 },
897 intro: {
898 introduction: rawData.introduction,
899 funFact: rawData.funFact,
900 forFun: rawData.forFun,
901 whyRds: rawData.whyRds,
902 numberOfHours: rawData.numberOfHours,
903 },
904 foundFrom: rawData.foundFrom,
905 };
906 await userQuery.addJoinData(data);
907
908 return res.status(201).json({
909 message: "User join data and newstatus data added and updated successfully",
910 });
911 } catch (err) {
912 logger.error("Could not save user data");
913 return res.boom.badImplementation(INTERNAL_SERVER_ERROR);
914 }
915};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected