Update organization profle

parent faf2da78
...@@ -82,7 +82,7 @@ export type OrganizationType = { ...@@ -82,7 +82,7 @@ export type OrganizationType = {
description: string; description: string;
contacts: { contacts: {
email: string; email: string;
phone: string[]; phone: string;
address: AddressType; address: AddressType;
website: string; website: string;
}; };
......
import { Router } from "express"; import { Router } from "express";
import { import {
ApplicationType,
JobType, JobType,
TypedRequest, TypedRequest,
USER_TYPE, USER_TYPE,
} from "../config/types"; } from "../config/types";
import { import {
authMiddleware, authMiddleware,
candidateMiddleware,
organizationMiddleware, organizationMiddleware,
} from "../middlewares/auth"; } from "../middlewares/auth";
import Application from "../models/Application";
import Auth from "../models/Auth"; import Auth from "../models/Auth";
import Jobs from "../models/Job"; import Jobs from "../models/Job";
import ResumeAPI from "../utilities/apis/resume";
const router = Router(); const router = Router();
......
import { Router } from "express"; import { Router } from "express";
import { CandidateType, TypedRequest } from "../config/types"; import { CandidateType, OrganizationType, TypedRequest } from "../config/types";
import { authMiddleware } from "../middlewares/auth"; import { authMiddleware } from "../middlewares/auth";
import Candidates from "../models/Candidate"; import Candidates from "../models/Candidate";
import ResumeAPI from "../utilities/apis/resume"; import ResumeAPI from "../utilities/apis/resume";
import VoiceAPI from "../utilities/apis/voice"; import VoiceAPI from "../utilities/apis/voice";
import Organizations from "../models/Organization";
const router = Router(); const router = Router();
...@@ -38,4 +39,20 @@ router.post( ...@@ -38,4 +39,20 @@ router.post(
} }
); );
router.post(
"/organization",
authMiddleware,
async (req: TypedRequest<{ userId: string }, OrganizationType>, res) => {
try {
const update = req.body;
await Organizations.findByIdAndUpdate(req.query.userId, { $set: update });
return res.status(200).json({ data: req.body });
} catch (error) {
return res.status(400).send(error);
}
}
);
module.exports = router; module.exports = router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment