Skip to content

Commit aadc828

Browse files
authored
Merge pull request #357 from hwakabh/feat/353/resume
feat(api): enabled to fetch Resume data from external API
2 parents 133e3d7 + b60494a commit aadc828

File tree

4 files changed

+41
-212
lines changed

4 files changed

+41
-212
lines changed

api-server/fixtures/payloads/certifications.json5

Lines changed: 0 additions & 77 deletions
This file was deleted.

api-server/fixtures/payloads/projects.json5

Lines changed: 0 additions & 115 deletions
This file was deleted.

api-server/routes/cv.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
const express = require('express');
22
const router = express.Router();
3+
const axios = require('axios');
34

4-
require('json5/lib/register');
5+
const rapidApiUrl = 'https://linkedin-api8.p.rapidapi.com/';
6+
const linkedInUsername = 'hiroyuki-wakabayashi-61b661157';
7+
const url = rapidApiUrl + '?username=' + linkedInUsername;
8+
9+
axios.defaults.headers.common['x-rapidapi-host'] = 'linkedin-api8.p.rapidapi.com';
10+
axios.defaults.headers.common['x-rapidapi-key'] = process.env.RAPID_API_KEY;
511

612

713
router.get('/', (req, res, next) => {
@@ -15,16 +21,24 @@ router.get('/', (req, res, next) => {
1521
});
1622
});
1723

18-
router.get('/certifications', function(req, res, next) {
24+
router.get('/certifications', async (req, res, next) => {
1925
// #swagger.tags = ['CV']
2026
// #swagger.summary = '/api/v1/cv/certifications'
2127
// #swagger.description = 'returns list of certifications with static contents'
22-
const certifications = require(__dirname + "/../fixtures/payloads/certifications.json5");
28+
const certificates = await axios.get(url)
29+
.then(response => {
30+
return response.data.certifications
31+
})
32+
.catch(error => {
33+
console.log(error);
34+
})
2335

24-
res.header('Content-Type', 'application/json; charset=utf-8');
36+
res.header({
37+
'Content-Type': 'application/json; charset=utf-8',
38+
});
2539
res.json({
2640
"path": req.originalUrl,
27-
"content": certifications.list.reverse()
41+
"content": certificates
2842
});
2943
});
3044

@@ -41,16 +55,22 @@ router.get('/educations', function(req, res, next) {
4155
});
4256
});
4357

44-
router.get('/projects', function(req, res, next) {
58+
router.get('/projects', async (req, res, next) => {
4559
// #swagger.tags = ['CV']
4660
// #swagger.summary = 'returns list of projects with static contents'
4761
// #swagger.description = '/api/v1/cv/projects'
48-
const projects = require(__dirname + "/../fixtures/payloads/projects.json5");
62+
const projects = await axios.get(url)
63+
.then(response => {
64+
return response.data.projects
65+
})
66+
.catch(error => {
67+
console.log(error);
68+
})
4969

5070
res.header('Content-Type', 'application/json; charset=utf-8');
5171
res.json({
5272
"path": req.originalUrl,
53-
"content": projects.list.reverse()
73+
"content": projects
5474
});
5575
});
5676

@@ -65,7 +85,6 @@ router.get('/publications', function(req, res, next) {
6585
// TODO: make dynamically change with http/https
6686
elm.link = 'http://' + req.headers.host + '/api/v1/cv/publications/' + elm.filename
6787
});
68-
console.log(publications.list);
6988

7089
res.header('Content-Type', 'application/json; charset=utf-8');
7190
res.json({

web-frontend/src/pages/Cv.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,35 @@ axios.get('/api/v1/cv/certifications')
4343
<h3>
4444
Selected Accomplishments
4545
</h3>
46+
<p>
47+
All of the project data has been fetched from <a href="https://www.linkedin.com/in/hiroyuki-wakabayashi-61b661157/" target="_blank" rel="noopener noreferrer">LinkedIn profiles</a>.
48+
</p>
4649

47-
<div v-for="(p, idx) in projectData"
50+
<div v-for="(p, idx) in projectData.items"
4851
:key="idx"
4952
class="project-detail" >
5053
<p>
5154
<h5> {{ p.title }} </h5>
52-
<li v-for="(d, idx) in p.descriptions">
53-
{{ d }}
54-
</li>
55+
<div> {{ p.description }} </div>
5556
<br>
56-
<div> Period: {{ p.start }} - {{ p.end }} </div>
57+
<div> Period: {{ p.start.year }}/{{ p.start.month }} - {{ p.end.year }}/{{ p.end.month }} </div>
5758
<!-- TODO: loop with v-for -->
58-
Skills: {{ p.skills }}
59+
<!-- Since we can not retrieve skills associated to projects from responses of RapidApi, need to consider design -->
60+
<!-- Skills: {{ p.skills }} -->
5961
</p>
6062
</div>
6163

6264
<h3>
6365
Certifications
6466
</h3>
67+
<p>
68+
Certified badges are all stored in <a href="https://www.credly.com/users/hiroyuki-wakabayashi.056b817e" target="_blank" rel="noopener noreferrer">Credly Public Profile</a>
69+
</p>
6570
<li v-for="(c, idx) in certificationData"
6671
:key="idx"
6772
class="certification-detail" >
68-
<div v-if="c.credential">
69-
{{ c.date }}: <a :href="c.credential" target="_blank"> {{ c.title }} </a>
70-
</div>
71-
<div v-else>
72-
{{ c.date }}: {{ c.title }}
73+
<div>
74+
{{ c.start.year }}/{{ c.start.month }}: {{ c.name }}
7375
</div>
7476
</li>
7577

0 commit comments

Comments
 (0)