Commit caae35d8 authored by H.M.C. Nadunithara Wijerathne's avatar H.M.C. Nadunithara Wijerathne

Merge branch 'it1924312' into 'master'

Update organization profle

See merge request !8
parents e37019ea 1bcc625c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"dev": "yarn build && nodemon lib/index.js", "dev": "yarn build && nodemon lib/index.js",
"burnthemall": "rm -rf node_modules package-lock.json && npm i" "burnthemall": "rm -rf node_modules package-lock.json && npm i"
}, },
"author": "Namit Nathwani", "author": "H.M.C. Nadunithara Wijerathne",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"axios": "^1.3.4", "axios": "^1.3.4",
......
...@@ -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