Compare commits

...

13 Commits

Author SHA1 Message Date
c7fffff495 chore(release): 3.2.3 2022-03-14 21:50:20 +01:00
42408ce8c5 feat(client/import): implement import json from reactive resume v2 2022-03-14 21:50:04 +01:00
ed78f8fc4e Merge pull request #687 from chandiwalaaadhar/fix/pikachu-masthead-asymmetric-basic-details
Fix-Pikachu Masthead Basic Details looks asymmetric Due to Centred Alignment
2022-03-14 15:51:16 +01:00
318145f007 Create CODE_OF_CONDUCT.md 2022-03-14 15:09:47 +01:00
c2a35a1066 Merge pull request #685 from chandiwalaaadhar/fix/work-experience-website-link-redirects-404
Fix - Work Experience Website Link Redirects to 404 if manually entered without http/https
2022-03-14 15:08:54 +01:00
541cfa784d Fix-Pikachu Masthead Asymmetric Basic Details 2022-03-14 19:38:49 +05:30
de53d8dfe7 Removed url && in the link prop 2022-03-14 19:32:12 +05:30
c28afbc75d Fix Work Experience Website Link redirects to 404 if entered without http or https 2022-03-14 19:12:36 +05:30
40e6227aa9 chore(release): 3.2.2 2022-03-14 10:28:29 +01:00
02e396bfdb fix(client/skills): make skill level optional 2022-03-14 10:26:57 +01:00
4dc83c1d7f docs(docker): update docs to add docker deployment example to droplet 2022-03-14 10:18:04 +01:00
143a123212 Create docker.mdx 2022-03-14 10:11:52 +01:00
c64b96619f docs(source-code): fix links to docker, local-build on source-code index page 2022-03-14 09:26:15 +01:00
23 changed files with 607 additions and 30 deletions

View File

@ -3,8 +3,8 @@ TZ=UTC
SECRET_KEY=change-me
# URLs
PUBLIC_URL=http://localhost:3000
PUBLIC_SERVER_URL=http://localhost:3100
PUBLIC_URL=http://<SERVER-IP>
PUBLIC_SERVER_URL=http://<SERVER-IP>/api
# Database
POSTGRES_HOST=localhost

View File

@ -2,6 +2,20 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [3.2.3](https://github.com/AmruthPillai/Reactive-Resume/compare/v3.2.2...v3.2.3) (2022-03-14)
### Features
* **client/import:** implement import json from reactive resume v2 ([42408ce](https://github.com/AmruthPillai/Reactive-Resume/commit/42408ce8c5ce55904854f9f6e0481889a01edfb8))
### [3.2.2](https://github.com/AmruthPillai/Reactive-Resume/compare/v3.2.1...v3.2.2) (2022-03-14)
### Bug Fixes
* **client/skills:** make skill level optional ([02e396b](https://github.com/AmruthPillai/Reactive-Resume/commit/02e396bfdbf07ae75661f1e7e4e55060cacee7d0))
### [3.2.1](https://github.com/AmruthPillai/Reactive-Resume/compare/v3.2.0...v3.2.1) (2022-03-14)

128
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
im.amruth@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -29,7 +29,7 @@ const defaultState: FormData = {
const schema = Joi.object<FormData>().keys({
id: Joi.string(),
name: Joi.string().required(),
level: Joi.string().required(),
level: Joi.string().allow(''),
levelNum: Joi.number().min(0).max(10).required(),
keywords: Joi.array().items(Joi.string().optional()),
});
@ -109,7 +109,6 @@ const SkillModal: React.FC = () => {
control={control}
render={({ field, fieldState }) => (
<TextField
required
label={t('builder.common.form.level.label')}
error={!!fieldState.error}
helperText={fieldState.error?.message}

View File

@ -24,6 +24,7 @@ const ImportExternalModal: React.FC = () => {
const linkedinInputRef = useRef<HTMLInputElement>(null);
const jsonResumeInputRef = useRef<HTMLInputElement>(null);
const reactiveResumeInputRef = useRef<HTMLInputElement>(null);
const reactiveResumeV2InputRef = useRef<HTMLInputElement>(null);
const { open: isOpen } = useAppSelector((state) => state.modal['dashboard.import-external']);
@ -49,6 +50,11 @@ const ImportExternalModal: React.FC = () => {
reactiveResumeInputRef.current.click();
reactiveResumeInputRef.current.value = '';
}
} else if (integration === 'reactive-resume-v2') {
if (reactiveResumeV2InputRef.current) {
reactiveResumeV2InputRef.current.click();
reactiveResumeV2InputRef.current.value = '';
}
}
};
@ -171,7 +177,7 @@ const ImportExternalModal: React.FC = () => {
<p className="mb-2">{t('modals.dashboard.import-external.reactive-resume.body')}</p>
<div>
<div className="flex gap-4">
<Button
variant="contained"
disabled={isLoading}
@ -181,6 +187,15 @@ const ImportExternalModal: React.FC = () => {
{t('modals.dashboard.import-external.reactive-resume.actions.upload-json')}
</Button>
<Button
variant="contained"
disabled={isLoading}
startIcon={<UploadFile />}
onClick={() => handleClick('reactive-resume-v2')}
>
{t('modals.dashboard.import-external.reactive-resume.actions.upload-json-v2')}
</Button>
<input
hidden
type="file"
@ -188,6 +203,14 @@ const ImportExternalModal: React.FC = () => {
onChange={(event) => handleChange(event, 'reactive-resume')}
accept="application/json"
/>
<input
hidden
type="file"
ref={reactiveResumeV2InputRef}
onChange={(event) => handleChange(event, 'reactive-resume-v2')}
accept="application/json"
/>
</div>
</div>
</BaseModal>

View File

@ -111,9 +111,10 @@
},
"reactive-resume": {
"actions": {
"upload-json": "Upload JSON"
"upload-json": "Upload JSON",
"upload-json-v2": "Upload JSON from v2"
},
"body": "If you have a JSON that was exported with the current version of Reactive Resume, you can import it back here to get an editable version again. Previous versions of Reactive Resume are unfortunately not supported at the moment.",
"body": "If you have a JSON that was exported with the current version of Reactive Resume, you can import it back here to get an editable version again.",
"heading": "Import From Reactive Resume"
}
},

View File

@ -9,7 +9,7 @@ import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import DataDisplay from '@/templates/shared/DataDisplay';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import Heading from './Heading';
@ -86,7 +86,7 @@ const Section: React.FC<SectionProps> = ({
{summary && <Markdown>{summary}</Markdown>}
{url && (
<DataDisplay icon={<Link />} link={url}>
<DataDisplay icon={<Link />} link={addHttp(url)}>
{url}
</DataDisplay>
)}

View File

@ -9,7 +9,7 @@ import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import DataDisplay from '@/templates/shared/DataDisplay';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import Heading from './Heading';
@ -87,7 +87,7 @@ const Section: React.FC<SectionProps> = ({
{summary && <Markdown>{summary}</Markdown>}
{url && (
<DataDisplay icon={<Link />} link={url}>
<DataDisplay icon={<Link />} link={addHttp(url)}>
{url}
</DataDisplay>
)}

View File

@ -9,7 +9,7 @@ import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import DataDisplay from '@/templates/shared/DataDisplay';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import BadgeDisplay from './BadgeDisplay';
import Heading from './Heading';
@ -80,7 +80,7 @@ const Section: React.FC<SectionProps> = ({
{summary && <Markdown>{summary}</Markdown>}
{url && (
<DataDisplay icon={<Link />} link={url}>
<DataDisplay icon={<Link />} link={addHttp(url)}>
{url}
</DataDisplay>
)}

View File

@ -8,7 +8,7 @@ import Markdown from '@/components/shared/Markdown';
import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import BadgeDisplay from './BadgeDisplay';
import Heading from './Heading';
@ -84,7 +84,7 @@ const Section: React.FC<SectionProps> = ({
{url && (
<div className="inline-flex justify-center">
<a href={url} target="_blank" rel="noreferrer">
<a href={addHttp(url)} target="_blank" rel="noreferrer">
{url}
</a>
</div>

View File

@ -9,7 +9,7 @@ import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import DataDisplay from '@/templates/shared/DataDisplay';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import Heading from './Heading';
@ -87,7 +87,7 @@ const Section: React.FC<SectionProps> = ({
{summary && <Markdown>{summary}</Markdown>}
{url && (
<DataDisplay icon={<Link />} link={url} className="text-xs">
<DataDisplay icon={<Link />} link={addHttp(url)} className="text-xs">
{url}
</DataDisplay>
)}

View File

@ -15,7 +15,7 @@ export const MastheadSidebar: React.FC = () => {
const { name, photo, email, phone, website, location, profiles } = useAppSelector((state) => state.resume.basics);
return (
<div className="col-span-2 grid justify-items-center gap-4">
<div className="col-span-2 grid justify-items-left gap-4">
{photo.visible && !isEmpty(photo.url) && (
<div className="relative aspect-square h-full w-full">
<img alt={name} src={photo.url} className={getPhotoClassNames(photo.filters)} />

View File

@ -9,7 +9,7 @@ import { useAppSelector } from '@/store/hooks';
import { SectionProps } from '@/templates/sectionMap';
import DataDisplay from '@/templates/shared/DataDisplay';
import { formatDateString } from '@/utils/date';
import { parseListItemPath } from '@/utils/template';
import { addHttp, parseListItemPath } from '@/utils/template';
import Heading from './Heading';
@ -79,7 +79,7 @@ const Section: React.FC<SectionProps> = ({
{summary && <Markdown>{summary}</Markdown>}
{url && (
<DataDisplay icon={<Link />} link={url}>
<DataDisplay icon={<Link />} link={addHttp(url)}>
{url}
</DataDisplay>
)}

View File

@ -27,7 +27,6 @@ services:
container_name: server
env_file: .env
environment:
- PUBLIC_URL=http://<SERVER-IP>
- POSTGRES_HOST=postgres
depends_on:
- traefik
@ -44,8 +43,6 @@ services:
image: amruthpillai/reactive-resume:client-latest
container_name: client
env_file: .env
environment:
- PUBLIC_SERVER_URL=http://<SERVER-IP>/api
depends_on:
- traefik
- server

View File

@ -0,0 +1,71 @@
---
sidebar_position: 1
---
# Docker
You should be able to deploy a production-grade instance of this app within 5 minutes by just following this guide. For this example, I'll be creating a new DigitalOcean droplet to illustrate the steps.
1. Create a new droplet instance, preferably Ubuntu 20.04 LTS, with at least 2 GB of RAM. You can skip this step if you already have your own server. These are the settings I went with:
![Screenshot 2022-03-14 at 9 32 30 AM](https://user-images.githubusercontent.com/1134738/158134604-85ade15f-4a16-4421-ad2a-b9df3b175467.png)
2. SSH into the instance, and update/upgrade dependencies. Then, install `docker` and `docker compose`. You can follow these links for steps on [how to install Docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04) and [how to install Docker Compose](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04) on Ubuntu 20.04 (or any other OS).
Here are all the commands you need, for quick execution:
```bash
sudo apt update && sudo apt upgrade -y
# Install Docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install -y docker-ce
# Verify that Docker is installed
sudo systemctl status docker
# Install Docker Compose
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo chown $USER /var/run/docker.sock
# Verify that Docker Compose is installed
docker compose version
```
3. Create a new folder to host your app, then create a docker-compose.yml file. The contents of the file can be identical to the one found on the project root.
```bash
mkdir app && cd app
curl -L https://raw.githubusercontent.com/AmruthPillai/Reactive-Resume/main/docker-compose.yml > docker-compose.yml
curl -L https://raw.githubusercontent.com/AmruthPillai/Reactive-Resume/main/.env.example > .env
```
4. Edit the docker-compose.yml file you just pulled in and update the `<SERVER-IP>` placeholders to your server's public IP (or domain, if applicable). Also, update the `.env` file that was just created and change variables such as `PUBLIC_URL`, `PUBLIC_SERVER_URL` etc. For a clear understanding of what each of the environment variables mean, head over to [this section](/source-code/env-vars) of the docs.
To change the default port `80` to something else, say `3000`, just change the properties in docker-compose's traefik service:
```yml
traefik:
command: ...
- --entrypoints.web.address=:3000
ports:
- 3000:3000
```
5. Run the `up` command to check if everything is working as it should.
```
docker compose up
```
<img
width="853"
alt="Screenshot 2022-03-14 at 10 08 50 AM"
src="https://user-images.githubusercontent.com/1134738/158140209-f80eab18-1575-464c-b29d-ac788bd53e93.png"
/>
Now, your application should be running on http://SERVER-IP.

View File

@ -3,3 +3,7 @@ sidebar_position: 4
---
# Deployment
You should be able to deploy the app within minutes by following these guides.
- [Docker](/deployment/docker)

View File

@ -38,7 +38,7 @@ The secret key can be a unique key, a randomly generated string that is used for
**Required**: `yes`
**Description:** URL through which app is accessible
**Default Value:** `http://localhost:3000`
**Default Value:** `http://localhost`
This URL would be used in features like link sharing functionality and authentication redirection. This points only to the client app, as the server would be running on `PORT 3100` always.
@ -47,7 +47,7 @@ This URL would be used in features like link sharing functionality and authentic
**Required**: `yes`
**Description:** URL through which server is accessible
**Default Value:** `http://localhost:3100`
**Default Value:** `http://localhost/api`
This URL is used when export PDF functionality is used within the app and has to reach out to the server.

View File

@ -10,5 +10,5 @@ The source code to Reactive Resume is available on [GitHub](https://github.com/A
In this section, I'll be going through the steps on how you can build the project on your local machine (or the cloud). You can choose one of two paths from here:
- [Docker](docker)
- [Local Build](local-build)
- [Docker](/source-code/docker)
- [Local Build](/source-code/local-build)

View File

@ -1,6 +1,6 @@
{
"name": "reactive-resume",
"version": "3.2.1",
"version": "3.2.3",
"private": true,
"workspaces": [
"schema",

View File

@ -1 +1 @@
export type Integration = 'linkedin' | 'json-resume' | 'reactive-resume';
export type Integration = 'linkedin' | 'json-resume' | 'reactive-resume' | 'reactive-resume-v2';

View File

@ -61,7 +61,7 @@ export type Publication = {
export type Skill = {
id?: string;
name: string;
level: string;
level?: string;
levelNum: number;
keywords?: string[];
};

View File

@ -42,4 +42,15 @@ export class IntegrationsController {
return this.integrationsService.reactiveResume(userId, file.path);
}
@UseGuards(JwtAuthGuard)
@Post('reactive-resume-v2')
@UseInterceptors(FileInterceptor('file'))
reactiveResumeV2(@User('id') userId: number, @UploadedFile() file: Express.Multer.File) {
if (!file) {
throw new HttpException('You must upload a valid JSON file.', HttpStatus.BAD_REQUEST);
}
return this.integrationsService.reactiveResumeV2(userId, file.path);
}
}

View File

@ -616,4 +616,333 @@ export class IntegrationsService {
await unlink(path);
}
}
async reactiveResumeV2(userId: number, path: string): Promise<ResumeEntity> {
try {
const jsonResume = JSON.parse(await readFile(path, 'utf8'));
const resume: Partial<Resume> = cloneDeep(defaultState);
// Metadata
const timestamp = dayjs().format(FILENAME_TIMESTAMP);
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
name: `Imported from Reactive Resume V2 (${timestamp})`,
slug: `imported-from-reactive-resume-v2-${timestamp}`,
});
// Basics
try {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
basics: {
name: get(jsonResume, 'profile.firstName') + ' ' + get(jsonResume, 'profile.lastName'),
headline: get(jsonResume, 'profile.subtitle'),
photo: {
url: get(jsonResume, 'profile.photograph'),
},
email: get(jsonResume, 'profile.email'),
phone: get(jsonResume, 'profile.phone'),
website: get(jsonResume, 'profile.website'),
summary: get(jsonResume, 'objective'),
location: {
address: get(jsonResume, 'profile.address.line1'),
postalCode: get(jsonResume, 'profile.address.pincode'),
city: get(jsonResume, 'profile.address.city'),
},
},
});
} catch {
// pass through
}
// Profiles
try {
const profiles: any[] = get(jsonResume, 'social.items', []);
profiles.forEach((profile) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
basics: {
profiles: [
...resume.basics.profiles,
{
id: uuidv4(),
url: get(profile, 'url'),
network: get(profile, 'network'),
username: get(profile, 'username'),
},
],
},
});
});
} catch {
// pass through
}
// Work
try {
const work: any[] = get(jsonResume, 'work.items', []);
work.forEach((item) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
work: {
items: [
...get(resume, 'sections.work.items', []),
{
id: uuidv4(),
name: get(item, 'company'),
position: get(item, 'position'),
summary: get(item, 'summary'),
url: get(item, 'website'),
date: {
start: dayjs(get(item, 'startDate')).toISOString(),
end: dayjs(get(item, 'endDate')).toISOString(),
},
} as WorkExperience,
],
},
},
});
});
} catch {
// pass through
}
// Education
try {
const education: any[] = get(jsonResume, 'education.items', []);
education.forEach((item) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
education: {
items: [
...get(resume, 'sections.education.items', []),
{
id: uuidv4(),
institution: get(item, 'institution'),
degree: get(item, 'studyType'),
url: get(item, 'url'),
score: get(item, 'gpa'),
area: get(item, 'field'),
summary: get(item, 'summary'),
courses: get(item, 'courses', []),
date: {
start: dayjs(get(item, 'startDate')).toISOString(),
end: dayjs(get(item, 'endDate')).toISOString(),
},
} as Education,
],
},
},
});
});
} catch {
// pass through
}
// Awards
try {
const awards: any[] = get(jsonResume, 'awards.items', []);
awards.forEach((award) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
awards: {
items: [
...get(resume, 'sections.awards.items', []),
{
id: uuidv4(),
title: get(award, 'title'),
awarder: get(award, 'awarder'),
summary: get(award, 'summary'),
date: dayjs(get(award, 'date')).toISOString(),
} as Award,
],
},
},
});
});
} catch {
// pass through
}
// Certifications
try {
const certifications: any[] = get(jsonResume, 'certifications.items', []);
certifications.forEach((certificate) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
certifications: {
items: [
...get(resume, 'sections.certifications.items', []),
{
id: uuidv4(),
name: get(certificate, 'title'),
issuer: get(certificate, 'issuer'),
summary: get(certificate, 'summary'),
date: dayjs(get(certificate, 'date')).toISOString(),
} as Certificate,
],
},
},
});
});
} catch {
// pass through
}
// Skills
try {
const skills: any[] = get(jsonResume, 'skills.items', []);
skills.forEach((skill) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
skills: {
items: [
...get(resume, 'sections.skills.items', []),
{
id: uuidv4(),
name: get(skill, 'name'),
level: get(skill, 'level'),
levelNum: 5,
} as Skill,
],
},
},
});
});
} catch {
// pass through
}
// Languages
try {
const languages: any[] = get(jsonResume, 'languages.items', []);
languages.forEach((language) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
languages: {
items: [
...get(resume, 'sections.languages.items', []),
{
id: uuidv4(),
name: get(language, 'name'),
level: get(language, 'fluency'),
levelNum: 5,
} as Language,
],
},
},
});
});
} catch {
// pass through
}
// Hobbies
try {
const hobbies: any[] = get(jsonResume, 'hobbies.items', []);
hobbies.forEach((hobby) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
interests: {
items: [
...get(resume, 'sections.interests.items', []),
{
id: uuidv4(),
name: get(hobby, 'name'),
keywords: get(hobby, 'keywords', []),
} as Interest,
],
},
},
});
});
} catch {
// pass through
}
// References
try {
const references: any[] = get(jsonResume, 'references.items', []);
references.forEach((reference) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
references: {
items: [
...get(resume, 'sections.references.items', []),
{
id: uuidv4(),
name: get(reference, 'name'),
relationship: get(reference, 'position'),
phone: get(reference, 'phone'),
email: get(reference, 'email'),
summary: get(reference, 'summary'),
} as Reference,
],
},
},
});
});
} catch {
// pass through
}
// Projects
try {
const projects: any[] = get(jsonResume, 'projects.items', []);
projects.forEach((project) => {
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
sections: {
projects: {
items: [
...get(resume, 'sections.projects.items', []),
{
id: uuidv4(),
name: get(project, 'title'),
summary: get(project, 'summary'),
keywords: get(project, 'keywords'),
url: get(project, 'link'),
date: {
start: dayjs(get(project, 'date')).toISOString(),
},
} as Project,
],
},
},
});
});
} catch {
// pass through
}
// Metadata
const template = get(jsonResume, 'metadata.template');
const templateWhitelist = ['onyx', 'pikachu', 'gengar', 'castform', 'glalie'];
merge<Partial<Resume>, DeepPartial<Resume>>(resume, {
metadata: {
...get(resume, 'metadata'),
typography: {
family: {
heading: get(jsonResume, 'metadata.font'),
body: get(jsonResume, 'metadata.font'),
},
size: {
heading: get(jsonResume, 'metadata.fontSize'),
body: get(jsonResume, 'metadata.fontSize'),
},
},
theme: {
background: get(jsonResume, 'metadata.colors.background'),
primary: get(jsonResume, 'metadata.colors.primary'),
text: get(jsonResume, 'metadata.colors.text'),
},
locale: get(jsonResume, 'metadata.language'),
template: templateWhitelist.includes(template) ? template : 'kakuna',
},
});
return this.resumeService.import(resume, userId);
} catch {
throw new HttpException('You must upload a valid JSON Resume file.', HttpStatus.BAD_REQUEST);
} finally {
await unlink(path);
}
}
}