Skip to content

Generethical/task3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Third lecture hometask

This task consists of two parts:

Technical requirements

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.

Motivation

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.

Description

Everyone can post a position.

Everyone can be an applicant.

We keep only active positions

Available values

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).

Subscription

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.

Position added

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 or category: react
  • "japaneseRequired": true or "japaneseRequired": false,
  • level: senior

Position removed

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


API

Positions

GET /positions - Get list of all available positions in Japan

Request

Query parameter:

  • category - filter positions by category (will be coersed to available categories)
  • level - filter positions by lever
  • tag - 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

Response

Success Code "200 OK"

Body = Position[]


GET /positions/{position_id} - Get position details by id

Request

Example: GET /positions/1

Response

Success Code "200 OK"

Response Body = Position[]


POST /positions - Create a new opened position

Request

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
}

Response

Success Code "201 Created". "id" in location


PATCH /positions/{position_id} - Update a position (OPTIONAL)

Unlike PUT method, PATCH method applies a partial update to the resource.

Request

Body = PositionToPatch

Example:

PATCH /positions/1

{
    "japaneseRequired": true
}

Response

Success Code: 200 OK


DELETE /positions/{position_id} - Close position and delete

Request

Example: DELETE /positions/1

Response

Success Code: "204 No Content"



Applications

POST /applicants - Create a new application

Request

Body = ApplicantToAdd

Example:

POST /applicants

{
    "email": "you.mail@mail.run",
    "categories": ["react", "angular"],
    "level": "middle"
}

Response

Success Code "201 Created". "id" in location


PUT /applicants/{applicant_id} - Update an application

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"
}

Response

Success Code "200 OK".


DELETE /applicants/{applicant_id} - Delete an applicant

Request

Example: DELETE /applicants/1

Response

Success Code: "204 No Content"


Contracts

NOTE: if property marked as '?' - this property is not required

Position

type Position = {
    category: string,
    level: string,
    company: string,
    description?: string,
    japaneseRequired: boolean
}

PositionToAdd

type PositionToAdd = {
    category: string,
    level: string,
    company: string,
    description?: string,
    japaneseRequired: boolean
}

PositionToPatch

type PositionToPatch = {
    japaneseRequired?: boolean,
    description?: string
}

Applicant

type Application = {
    email: sting,
    categories: string[],
    japaneseKnowledge: boolean,
    level: string
}

ApplicantToAdd

type ApplicationToAdd = {
    email: sting,
    categories: string[],
    japaneseKnowledge: boolean,
    level: string
}

ApplicantToSet

type ApplicationToSet = {
    email: sting,
    categories: string[],
    japaneseKnowledge: boolean,
    level: string
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published