This task consists of two parts:
-
nodejs (native) http(s) server in folder dedicatedServer. Go to dedicateServer README file
-
nodejs express https server. To understand your task, please read the text below.
API client is required for this application. Please install app (Postman, Insomnia etc.) on your computer.
Do not forget to install required dependencies to package.json file. Use npm libraries such as 'sendmail', 'nodemailer' etc. to send mails to applicants.
Note: If you select library with required auth, do not store your email and password in the code. Use placeholders instead: e.g. '<email>', '<password>'.
You can investigate and add a logic to read passwords
from local config(local).json(yaml) file
(e.g use npm library conĆ’ig
or do it on your own),
but this is not required.
Let's create something real and useful. This application is inspired by the site tokyodev - the way how software engineers can help each other to find a position in Japan.
Everyone can post a position.
Everyone can be an applicant.
We keep only active positions
in case of PUT/POST requests and GET request with query string values with be coersed to available values
Available position categories: nodejs
, angular
, javascript
, react
.
Available position levels: junior
, middle
, senior
.
Available position japaneseRequired
values are: true
(Japanese language required) and false
(Japanese language not required).
Available applicant japaneseKnowledge
values are: true
(Japanese language is ok) and false
(Japanese language is not ok).
Applicant will receive notifications (emails) about positions (new position added, existing position removed).
If an applicant has "japaneseKnowledge": true
, he can receive notifications about positions with both "japaneseRequired": true
and "japaneseRequired": false
properties.
If an applicant has "japaneseKnowledge": false
, he can receive notifications about positions with "japaneseRequired": false
.
Examples:
(a) if an applicant has the following interests:
{
"categories": ["nodejs"],
"level": "middle",
"japaneseKnowledge": false
}
he will receive emails about new positions with:
japaneseRequired: false
category: nodejs
level: middle
(b) if an applicant has the following interests:
{
"japaneseKnowledge": true,
"categories": ["nodejs", "react"],
"level": "senior"
}
he will receive emails about new positions with:
category: nodejs
orcategory: react
"japaneseRequired": true
or"japaneseRequired": false
,level: senior
Examples:
(a) if the following position is removed:
{
"category": "nodejs",
"level": "senior",
...
"japaneseRequired": true
}
Applicants with
nodejs
in list of categories, level =senior
and with"japaneseKnowledge": true
will be notified.
(b) if the following position is removed:
{
"category": "angular",
"level": "junior",
...
"japaneseRequired": false
}
Applicants with
angular
in list of categories, level =junior
and with"japaneseKnowledge": true
or with"japaneseKnowledge": false
will be notified
Query parameter:
category
- filter positions by category (will be coersed to available categories)level
- filter positions by levertag
- free search in description
Examples:
(1) GET /positions?category=nodejs&level=middle&tag=relocation -> get positions, filtered by category, level and tag
(2) GET /positions?level=middle -> get positions, filtered by level (no checks for tag and category required)
(3) GET /positions - just return all positions
Success Code "200 OK"
Body = Position[]
Example: GET /positions/1
Success Code "200 OK"
Response Body = Position[]
Body = PositionToAdd
Example:
POST /positions
{
"category": "nodejs",
"level": "middle",
"company": "Rakuten",
"description": "We are looking for people who are flexible and highly skilled, with an interest in languages and other cultures. We are open to overseas candidates looking to relocate to Japan.",
"japaneseRequired": false
}
Success Code "201 Created". "id" in location
Unlike PUT method, PATCH method applies a partial update to the resource.
Body = PositionToPatch
Example:
PATCH /positions/1
{
"japaneseRequired": true
}
Success Code: 200 OK
Example: DELETE /positions/1
Success Code: "204 No Content"
Body = ApplicantToAdd
Example:
POST /applicants
{
"email": "you.mail@mail.run",
"categories": ["react", "angular"],
"level": "middle"
}
Success Code "201 Created". "id" in location
Body = ApplicantToSet
PUT is a method of modifying resource where the client sends data that updates the entire resource
Example:
PUT /applicants/1
{
"email": "you.mail@mail.run",
"categories": ["react", "angular"],
"japaneseKnowledge": true,
"level": "middle"
}
Success Code "200 OK".
Example: DELETE /applicants/1
Success Code: "204 No Content"
NOTE: if property marked as '?' - this property is not required
type Position = {
category: string,
level: string,
company: string,
description?: string,
japaneseRequired: boolean
}
type PositionToAdd = {
category: string,
level: string,
company: string,
description?: string,
japaneseRequired: boolean
}
type PositionToPatch = {
japaneseRequired?: boolean,
description?: string
}
type Application = {
email: sting,
categories: string[],
japaneseKnowledge: boolean,
level: string
}
type ApplicationToAdd = {
email: sting,
categories: string[],
japaneseKnowledge: boolean,
level: string
}
type ApplicationToSet = {
email: sting,
categories: string[],
japaneseKnowledge: boolean,
level: string
}