Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
Easy Quest - Smart Recruitment Tool with AI - Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23 - J 36
Easy Quest - Smart Recruitment Tool with AI - Backend
Commits
19d12043
Commit
19d12043
authored
May 13, 2023
by
H.M.C. Nadunithara Wijerathne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video conference
parent
caae35d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
21 deletions
+101
-21
NodeServer/src/config/contants.ts
NodeServer/src/config/contants.ts
+2
-0
NodeServer/src/routes/application.ts
NodeServer/src/routes/application.ts
+30
-2
NodeServer/src/routes/auth.ts
NodeServer/src/routes/auth.ts
+26
-1
NodeServer/src/routes/jobs.ts
NodeServer/src/routes/jobs.ts
+21
-2
PythonServer/nlt.py
PythonServer/nlt.py
+3
-0
PythonServer/routes/voice.py
PythonServer/routes/voice.py
+19
-16
No files found.
NodeServer/src/config/contants.ts
View file @
19d12043
...
@@ -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
'
NodeServer/src/routes/application.ts
View file @
19d12043
...
@@ -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
(
...
...
NodeServer/src/routes/auth.ts
View file @
19d12043
...
@@ -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
;
NodeServer/src/routes/jobs.ts
View file @
19d12043
...
@@ -3,7 +3,7 @@ import {
...
@@ -3,7 +3,7 @@ import {
JobType
,
JobType
,
TypedRequest
,
TypedRequest
,
USER_TYPE
,
USER_TYPE
,
}
from
"
../config/types
"
;
}
from
"
../config/types
"
;
import
{
import
{
authMiddleware
,
authMiddleware
,
organizationMiddleware
,
organizationMiddleware
,
...
@@ -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
;
PythonServer/nlt.py
0 → 100644
View file @
19d12043
import
nltk
nltk
.
download
(
'stopwords'
)
\ No newline at end of file
PythonServer/routes/voice.py
View file @
19d12043
...
@@ -45,26 +45,29 @@ def enroll(payload:EnrollVoice):
...
@@ -45,26 +45,29 @@ def enroll(payload:EnrollVoice):
@
router
.
post
(
"/verify"
)
@
router
.
post
(
"/verify"
)
async
def
verify
(
payload
:
VerifyVoice
):
async
def
verify
(
payload
:
VerifyVoice
):
video_filename
=
'videos/interviews/'
+
payload
.
application_id
+
'.mp4'
try
:
urllib
.
request
.
urlretrieve
(
payload
.
video_url
,
video_filename
)
video_filename
=
'videos/interviews/'
+
payload
.
application_id
+
'.mp4'
urllib
.
request
.
urlretrieve
(
payload
.
video_url
,
video_filename
)
# Download video and save audio
# Download video and save audio
video
=
moviepy
.
editor
.
VideoFileClip
(
video_filename
)
video
=
moviepy
.
editor
.
VideoFileClip
(
video_filename
)
audio
=
video
.
audio
audio
=
video
.
audio
audio_filename
=
'voices/interviews/'
+
payload
.
application_id
+
'.wav'
audio_filename
=
'voices/interviews/'
+
payload
.
application_id
+
'.wav'
audio
.
write_audiofile
(
audio_filename
,
codec
=
'pcm_s16le'
,
bitrate
=
'50k'
)
audio
.
write_audiofile
(
audio_filename
,
codec
=
'pcm_s16le'
,
bitrate
=
'50k'
)
model
=
load_model
(
MODEL_FILE
)
model
=
load_model
(
MODEL_FILE
)
test_result
=
get_embedding
(
model
,
audio_filename
,
MAX_SEC
)
test_result
=
get_embedding
(
model
,
audio_filename
,
MAX_SEC
)
test_embs
=
np
.
array
(
test_result
.
tolist
())
test_embs
=
np
.
array
(
test_result
.
tolist
())
enroll_embs
=
np
.
load
(
"voices/auth/embed/"
+
payload
.
user_id
+
".npy"
)
enroll_embs
=
np
.
load
(
"voices/auth/embed/"
+
payload
.
user_id
+
".npy"
)
distance
=
euclidean
(
test_embs
,
enroll_embs
)
distance
=
euclidean
(
test_embs
,
enroll_embs
)
url
=
"http://localhost:5000/applications/update/voice-verification"
url
=
"http://localhost:5000/applications/update/voice-verification"
payload
=
{
'update'
:
round
(
1
-
distance
,
5
),
'applicationId'
:
payload
.
application_id
}
payload
=
{
'update'
:
round
(
1
-
distance
,
5
),
'applicationId'
:
payload
.
application_id
}
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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment