video conference

parent caae35d8
...@@ -14,3 +14,5 @@ export const DEFAULT_CONTROLS = { ...@@ -14,3 +14,5 @@ export const DEFAULT_CONTROLS = {
}, },
}; };
export const UTILITY_SERVER = "http://127.0.0.1:8000"; export const UTILITY_SERVER = "http://127.0.0.1:8000";
export const API_KEY = '5b9267df-e7bc-4fb8-906d-5bacf5fb62e5';
export const SECRETE_KEY = '72764420a20cdaa4313f21cf8ae6df86a7c25a9b6813e23359c0f58b0a619c7a'
...@@ -53,7 +53,7 @@ router.post( ...@@ -53,7 +53,7 @@ router.post(
applicationId: _application.id, applicationId: _application.id,
}); });
} catch (error) { } catch (error) {
return res.json({ success: false, error }); return res.status(400).send(error);
} }
} }
); );
...@@ -67,7 +67,7 @@ router.put( ...@@ -67,7 +67,7 @@ router.put(
{ {
applicationId: string; applicationId: string;
update: Partial<ApplicationType>; update: Partial<ApplicationType>;
candidateId: string; candidateId?: string;
} }
>, >,
res res
...@@ -97,6 +97,34 @@ router.put( ...@@ -97,6 +97,34 @@ router.put(
} }
); );
router.put(
"/update/action",
authMiddleware,
async (
req: TypedRequest<
{},
{
applicationId: string;
update: Partial<ApplicationType>;
}
>,
res
) => {
let update = req.body.update;
Application.findByIdAndUpdate(req.body.applicationId, {
$set: update,
})
.then((_application) => {
res.json({
success: true,
application: { ..._application, ...update },
});
})
.catch((err) => res.send(err));
}
);
router.put( router.put(
"/update/voice-verification", "/update/voice-verification",
async ( async (
......
...@@ -23,7 +23,12 @@ import { ...@@ -23,7 +23,12 @@ import {
processAttempt, processAttempt,
updatePasswordFromProcessedData, updatePasswordFromProcessedData,
} from "../utilities/keystroke"; } from "../utilities/keystroke";
import { DEFAULT_CONTROLS, JWT_SECRET } from "../config/contants"; import {
API_KEY,
DEFAULT_CONTROLS,
JWT_SECRET,
SECRETE_KEY,
} from "../config/contants";
import { authMiddleware } from "../middlewares/auth"; import { authMiddleware } from "../middlewares/auth";
const router = Router(); const router = Router();
...@@ -255,4 +260,24 @@ router.post( ...@@ -255,4 +260,24 @@ router.post(
} }
); );
router.get("/conference/key", authMiddleware, async (req, res) => {
try {
const payload = {
apikey: API_KEY,
permissions: [`allow_join`], // `ask_join` || `allow_mod`
version: 2,
roles: ["CRAWLER"],
};
const token = await jwt.sign(payload, SECRETE_KEY, {
expiresIn: "5h",
algorithm: "HS256",
});
return res.json({ token });
} catch (error) {
return res.status(400).send(error);
}
});
module.exports = router; module.exports = router;
...@@ -26,7 +26,7 @@ router.get( ...@@ -26,7 +26,7 @@ router.get(
jobs = await Jobs.find() jobs = await Jobs.find()
.populate({ .populate({
path: "applications", path: "applications",
select: ["candidate", "status"], select: ["candidate", "status", "interview"],
}) })
.populate({ path: "organization" }); .populate({ path: "organization" });
} else { } else {
...@@ -102,4 +102,23 @@ router.delete( ...@@ -102,4 +102,23 @@ router.delete(
} }
); );
router.get("/search", authMiddleware, (req:TypedRequest<{key:string}, null>, res)=>{
console.log(req.query.key)
const pipeline = [
{
$search: {
index: "searchJobs",
text: {
query: req.query.key,
path: {"wildcard":"*"},
fuzzy: {},
},
},
}
];
Jobs.aggregate(pipeline).then((data) => res.status(200).json({ data })).catch(()=>{
res.status(200).json({ data:[] })
});
})
module.exports = router; module.exports = router;
import nltk
nltk.download('stopwords')
\ No newline at end of file
...@@ -45,6 +45,7 @@ def enroll(payload:EnrollVoice): ...@@ -45,6 +45,7 @@ def enroll(payload:EnrollVoice):
@router.post("/verify") @router.post("/verify")
async def verify(payload:VerifyVoice): async def verify(payload:VerifyVoice):
try:
video_filename = 'videos/interviews/'+payload.application_id+'.mp4' video_filename = 'videos/interviews/'+payload.application_id+'.mp4'
urllib.request.urlretrieve(payload.video_url, video_filename) urllib.request.urlretrieve(payload.video_url, video_filename)
...@@ -65,6 +66,8 @@ async def verify(payload:VerifyVoice): ...@@ -65,6 +66,8 @@ async def verify(payload:VerifyVoice):
await SingletonAiohttp.put_url(url, payload) await SingletonAiohttp.put_url(url, payload)
return 'success' return 'success'
except:
return 'failed'
@router.post("/analyse") @router.post("/analyse")
def analys(payload:AnalyseVoice): def analys(payload:AnalyseVoice):
......
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