diff --git a/server/controllers/profileController/createProfile/createProfile.ts b/server/controllers/profileController/createProfile/createProfile.ts deleted file mode 100644 index 5f324cf..0000000 --- a/server/controllers/profileController/createProfile/createProfile.ts +++ /dev/null @@ -1,80 +0,0 @@ -import Profile from '../../../models/profileModel'; -import { Request, Response, NextFunction } from 'express'; - -// ENDPOINT POST api/profiles/create -// PURPOSE Create a new profile -// ACCESS Private -const createProfile = async (req: Request, res: Response, next: NextFunction) => { - const { - user, - fullName, - nickname, - profilePhoto, - cohort, - graduationYear, - email, - linkedInProfile, - gitHubProfile, - professionalSummary, - skills, - specializations, - careerInformation, - education, - projects, - personalBio, - testimonials, - socialMediaLinks, - availabilityForNetworking, - bootcampExperience, - achievementsAndCertifications, - volunteerWork, - eventParticipation, - gallery, - blogOrWriting, - } = req.body; - - try { - const profile = await Profile.create({ - user, - fullName, - nickname, - profilePhoto, - cohort, - graduationYear, - email, - linkedInProfile, - gitHubProfile, - professionalSummary, - skills, - specializations, - careerInformation, - education, - projects, - personalBio, - testimonials, - socialMediaLinks, - availabilityForNetworking, - bootcampExperience, - achievementsAndCertifications, - volunteerWork, - eventParticipation, - gallery, - blogOrWriting, - }); - - if (profile) { - return res.status(201).json(profile); - } - } catch (error) { - console.error(error); - return next({ - log: 'Express error in createProfile Middleware', - status: 500, - message: { - err: 'An error occurred during profile creation. Please try again.', - }, - }); - } -}; - -export default createProfile; diff --git a/server/controllers/profileController/index.ts b/server/controllers/profileController/index.ts index 1fd77ca..52f63ff 100644 --- a/server/controllers/profileController/index.ts +++ b/server/controllers/profileController/index.ts @@ -1,6 +1,5 @@ -import createProfile from './createProfile/createProfile'; import getAllProfiles from './getAllProfiles/getAllProfiles'; import getProfileById from './getProfileById/getProfileById'; import updateProfile from './updateProfile/updateProfile'; -export { createProfile, getAllProfiles, getProfileById, updateProfile }; +export { getAllProfiles, getProfileById, updateProfile }; diff --git a/server/routes/profileRoutes.ts b/server/routes/profileRoutes.ts index b2979a6..6455220 100644 --- a/server/routes/profileRoutes.ts +++ b/server/routes/profileRoutes.ts @@ -1,17 +1,11 @@ import express from 'express'; import { protect } from '../middleware/authMiddleware'; -import { - createProfile, - getAllProfiles, - getProfileById, - updateProfile, -} from '../controllers/profileController'; +import { getAllProfiles, getProfileById, updateProfile } from '../controllers/profileController'; const router = express.Router(); router.use(protect); /* Require Auth for ALL routes below */ -router.post('/', createProfile); router.put('/:userID', updateProfile); router.get('/:userID', getProfileById); router.get('/', getAllProfiles);