Skip to content

build-week-droom/Droom-BackEnd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

120 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Droom

"version": "1.0"
"description": "DROOM REST API"
"apihost":  "https://jobdroom.herokuapp.com"

PITCH

Droom means dream in Dutch. This app helps you find your dream job by swiping right. Think Tinder + LinkedIn

Request & Response Examples

Sample Response

Request Success ( 200 - OK || 201 - CREATED )

  {
    "key": "data",
  }

    ----- OR ------

  [
    {
      "data": "data",
    },
    {
      "key": "data",
    },
    ...
  ]

Request Error ( 400 - Bad Request || 404 - Not Found || 500 - Internal Server Error )

  {
    "error": "Error message"
  }

API Endpoints

ENDPOINT DESCRIPTION
GET / Base URL
POST /api/auth/register Register new Job Seeker / Company
POST /api/auth/login Login for User / Company
GET /api/company Get all Companies
GET /api/company/id Get a particular Company by ID
PUT /api/company Update Company Profile
GET /api/seekers Get All Job Seekers
GET /api/seekers/id Get Job Seeker by ID
PUT /api/seekers Update a Job Seeker Profile
GET /api/jobs Get all Jobs
GET /api/jobs/id Get a particular Job by ID
POST /api/jobs Create a new Job posting
PUT /api/jobs/id Update Job
DELETE /api/jobs/id Delete a particular Job
GET /api/matches Get all Matches by a User
POST /api/matches/company User(Company) can send a potential match(job seeker)
POST /api/matches/seeker User(Job Seeker) can send a potential match(Company)
GET /api/messages/id User can get all messages with match
POST /api/messages/id User can send message to match

GET /

Response body:

  {
      "message": "Welcome to Droom API"
  }

Auth

POST /api/auth/register

Description: Creates a Job Seeker or Company User account depending on "isCompany": "true" or "false".

Request body:

  {
    "name": "John Doe",
    "email": "john@email.com",
    "password": "johnny",
    "isCompany": false
  }

Response body:

  {
    "id": 1,
    "name": "John Doe",
    "email": "john@email.com",
    "isCompany": false,
    "createdAt": "2019-07-29T03:56:42.294Z"
  }

POST /api/auth/login

Description: Returns a User token, contains User role.

Request body:

  {
    "email": "john@email.com",
    "password": "johnny"
  }

Response body:

  {
    "message": "Welcome, John Doe!",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTMsImVtYWlsIjoiY29tcGFueUBlbWFpbC5jb20iLCJpc0NvbXBhbnkiOnRydWUsImlhdCI6MTU2NDM3MjY0MSwiZXhwIjoxNTY0NDU5MDQxfQ.U5XPvzO7eNw48b4hn4BzIrmNT-yA2b-qABypN-O7BfU"
  }

Company

GET /api/company/id

Description: Returns a Company Profile.

Response body:

  {
    "id": 5,
    "name": "Company Work",
    "email": "companywork@company.com",
    "about": "Company Work, we know that finding the best document management solution for your organization means reducing costs without sacrificing access to information.",
    "location": "Abia, Nigeria",
    "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg",
    "jobs": [
        {
            "id": 10,
            "title": "Engineering Recruiting Director",
            "description": "Responsible for leading a safe and educational classroom environment by providing daily care, nurturing and development of children.",
            "location": "Lagos, Nigeria",
            "userId": 5,
            "createdAt": "2019-07-30T09:39:43.205Z"
        },
        {
            "id": 11,
            "title": "Software Engineer",
            "description": "Developing new systems and improving existing systems.",
            "location": "Remote",
            "userId": 5,
            "createdAt": "2019-07-30T09:39:43.205Z"
        },
        ...
    ]
  }

GET /api/company

Description: Returns all companies.

Response body:

  [
    {
      "id": 5,
      "name": "Company Work",
      "email": "companywork@company.com",
      "about": "Company Work, we know that finding the best document management solution for your organization means reducing costs without sacrificing access to information.",
      "location": "LocalHost, PORT, 8080",
      "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg"
    },
    {
      "id": 6,
      "name": "Company Work",
      "email": "companywork2@company.com",
      "about": "promotions build more momentum for big results.",
      "location": "LocalHost, PORT, 8080",
      "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg"
    }
    ...
  ]

PUT /api/company

Description: Update Company Profile having current authorization token.

Header

  ...
  Authorization: token(company)

Request Body

  {
    "about": "Company Work, we know that finding the best document management solution for your organization means reducing costs without sacrificing access to information.",
    "location": "LocalHost, PORT, 8080",
    "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg",
  }

Response body:

  {
    "id": 11,
    "about": "Company Work, we know that finding the best document management solution for your organization means reducing costs without sacrificing access to information.",
    "location": "LocalHost, PORT, 8080",
    "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg"
  }

Job Seekers

GET /api/seekers

Description: Returns all Job Seeker's Profiles.

Header

  ...
  Authorization: token

Response body:

  [
    {
      "id": 1,
      "name": "John Doe",
      "email": "john@email.com",
      "interests": "Data Analytics, BlockChain",
      "pastExperience": "Devops",
      "location": "",
      "profileImg": ""
    },
    {
      "id": 2,
      "name": "Jane Doe",
      "email": "jane@email.com",
      "interests": "Photography",
      "pastExperience": "Quality Assurance, Data Analytics",
      "location": "",
      "profileImg": ""
    },
    ...
  ]

GET /api/seekers/id

Description: Returns a Job Seeker's Profile.

Header

  ...
  Authorization: token

Response body:

  [
    {
      "id": 1,
      "name": "John Doe",
      "email": "john@email.com",
      "interests": "Data Analytics, BlockChain",
      "pastExperience": "Devops",
      "location": "",
      "profileImg": ""
    }
    ...
  ]

PUT /api/seekers

Description: Update Job Seeker Profile having current authorization token.

Header

  ...
  Authorization: token(job seeker)

Request Body

  {
    "interests": "Data Analytics, BlockChain",
    "pastExperience": "Devops",
    "location": "LocalHost, Port, 8080",
    "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg"
  }

Response body:

  {
    "id": 1,
    "name": "John Doe",
    "email": "john@email.com",
    "interests": "Data Analytics, BlockChain",
    "pastExperience": "Devops",
    "location": "LocalHost, Port, 8080",
    "profileImg": "https://res.cloudinary.com/elbon/image/upload/v1561734286/luncher_assets/pfzxjfpkh47yepawxbzf.jpg",
  }

Jobs

GET /api/jobs

Description: Returns all Jobs Postings.

Header

  ...
  Authorization: token

Response body:

  [
    {
      "id": 1,
      "title": "Delivery Driver",
      "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
      "location": "Job Location on the Moon",
      "companyId": 6,
      "company": "Company Name I",
      "email": "companyII@company.com",
      "createdAt": "2019-07-29T03:41:22.513Z"
    },
    {
      "id": 2,
      "title": "Entry Level Marketing and Public Relations",
      "description": "We are actively seeking Entry-Level Professionals for our public relations & sales marketing team!",
      "location": "Job Location on the Sun",
      "companyId": 7,
      "company": "Company Name II",
      "email": "companyII@company.com",
      "createdAt": "2019-07-29T03:41:22.513Z"
    }
    ...
  ]

GET /api/jobs/id

Description: Returns a particular Job.

Header

  ...
  Authorization: token

Response body:

  {
    "id": 1,
    "title": "Delivery Driver",
    "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
    "location": "Job Location on the Moon",
    "companyId": 7,
    "company": "Company Name I",
    "email": "companyII@company.com",
    "createdAt": "2019-07-29T03:41:22.513Z"
  }

POST /api/jobs

Description: Create a new Job posting by current Company authorization token.

Header

  ...
  Authorization: token(company)

Request body:

  {
    "title": "Delivery Driver",
    "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
    "location": "Job Location on the Moon",
  }

Response body:

  {
    "id": 1,
    "title": "Delivery Driver",
    "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
    "location": "Job Location on the Moon",
    "userId": 13,
    "createdAt": "2019-07-29T03:41:22.513Z"
  }

PUT /api/jobs/id

Description: Updates existing Job posting by current Company authorization token.

Header

  ...
  Authorization: token(company)

Request body:

  {
    "title": "Delivery Driver updated",
    "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
    "location": "Job Location on the Moon",
  }

Response body:

  {
    "id": 1,
    "title": "Delivery Driver updated",
    "description": "You’ll play a critical role in delivering on our promise to provide our customers with excellent customer service.",
    "location": "Job Location on the Moon",
    "userId": 13,
    "createdAt": "2019-07-29T03:41:22.513Z"
  }

DELETE /api/jobs/id

Description: Deletes existing Job posting by current Company authorization token.

Header

  ...
  Authorization: token(company)

Response body: (204 - No Content)

  

Matches

GET /api/matches

Description: Return all matches for user wth token.

Header

  ...
  Authorization: token

Response body:

  [
    {
        "id": 4,
        "companyId": 2,
        "companyName": "test company2",
        "jobSeekerId": 3,
        "jobSeekerName": "test jobseeker1",
        "createdAt": "2019-07-31T11:57:45.455Z",
        "matchedAt": "2019-07-31T11:57:49.798Z",
        "isMatch": true
    },
    {
        "id": 3,
        "companyId": 2,
        "companyName": "test company2",
        "jobSeekerId": 4,
        "jobSeekerName": "test jobseeker2",
        "createdAt": "2019-07-31T11:57:45.455Z",
        "matchedAt": "2019-07-31T11:57:45.453Z",
        "isMatch": true
    }
    ...
  ]

POST /api/matches/company

_Description: User(company) can add a potential match(Job seeker).

Header

  ...
  Authorization: token(company)

Request body:

  {
    "match": 2(jobseekerId)
  }

Response body:

  {
    "id": 3,
    "companyId": 1,
    "jobSeekerId": 2,
    "createdAt": "2019-07-31T11:57:45.455Z",
    "matchedAt": "2019-07-31T12:10:29.124Z",
    "isMatch": false || true
}

POST /api/matches/seeker

Description: User(job seeker) can add a potential match(company).

Header

  ...
  Authorization: token(seeker)

Request body:

  {
    "match": 2(companyId)
  }

Response body:

  {
    "id": 3,
    "companyId": 2,
    "jobSeekerId": 2,
    "createdAt": "2019-07-31T11:57:45.455Z",
    "matchedAt": "2019-07-31T12:10:29.124Z",
    "isMatch": false || true
}

Messages

GET /api/messages/id

Description: Returns the messages between match(job seeker and company) by providing the matchId.

Header

  ...
  Authorization: token

Response body:

  [
    {
        "id": 5,
        "matchId": 6,
        "sentById": 4,
        "sentByName": "John Doe",
        "jobSeekerId": 4,
        "jobSeekerName": "John Doe",
        "companyId": 5,
        "companyName": "Intake Company",
        "message": "Hello, I'm interested in your last job listing, can I come in for a chat. thank you.",
        "createdAt": "2019-08-01T10:57:42.157Z"
    },
    {
        "id": 7,
        "matchId": 6,
        "sentById": 5,
        "sentByName": "Intake Company",
        "jobSeekerId": 4,
        "jobSeekerName": "John Doe",
        "companyId": 5,
        "companyName": "Intake Company",
        "message": "Sure, John Doe. Kindly come to the office on monday for a chat.",
        "createdAt": "2019-08-01T10:57:59.113Z"
    },
    ...
  ]

POST /api/messages/id

Description: Add a message between match. id - matchId.

Header

  ...
  Authorization: token

Request body:

  {
    "messages": "Hello, ..."
  }

Response body:

  {
    "id": 7,
    "matchId": 6,
    "sentBy": 4,
    "message": "Hello, ...",
    "createdAt": "2019-08-01T14:11:47.326Z"
}

Technologies

  • Node | Express | hapi/joi | bcryptjs | cors | knex | Postgres | Jest | Supertest

About

Web Application API built on ExpressJs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors