Skip to content

An API that allows users to put up different types of properties for sale

Notifications You must be signed in to change notification settings

ahmadinjo/PropertyMarketAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

PropertyMarketAPI

An API that allows users to put up different types of properties for sale

ApexHauz

Second Capstone BUILD A PRODUCT: ApexHauz

**

Project Overview

**

ApexHauz is a platform where people can create and/or search properties for sale or rent

Required features

  1. User can sign up
  2. User can sign in
  3. User can post a property advert
  4. User can update the details of a property advert
  5. User can mark his/her posted advert as sold
  6. User can delete his/her property advert
  7. User can view all property adverts
  8. User can view all properties of a specific type - 2 9. bedrooms, 3 bedrooms, mini flat etc
  9. User can view a specific property advert

Optional features

  1. User can reset password
  2. User can report a posted advert as fraudulent
  3. User can add multiple pictures to a posted advert

Preparation Guidelines

These are the steps you ought to take to get ready to start building the project

  • Create a GitHub Repository, add a README.md file, and clone it to your computer. find how to create a GitHub Repo here

Challenge: Create API endpoints

Summary

You are expected to create a set of API endpoints defined in the API Endpoints Specification section and use MySQL/MongoDB to store data

NB: You are to create pull request(PR) for each feature in the challenge and then merge it into your main branch

Tools

  • NodeJS
  • ExpressJS
  • MySQL
  • JWT => Token management
  • bcryptjs => Password hash etc.

Guidelines

  1. Version your API using URL versioning starting with the letter "v". Avoid dot notation as 1.0. An example of this will be: https://example.com/api/v1
  2. Setup the server-side of the application using expressjs
  3. Use separate branches for each feature
  4. Use Cloudinary to store your images and only save the URL in your application's database
  5. On GitHub, create a GitHub project with a basic Kanban board
  6. On GitHub under GitHub issues, create the following issues and attach them to your created project: user can signup, user can sign in, user can post a property advert, user can update the details of a property advert, user can mark his/her posted advert as sold, user can delete his/her advert, user can view all properties, user can view all properties of a specific type, user can view a specific property
  7. Under GitHub issues, create issues to capture any other tasks not captured above.

API Response Specification

The API endpoints should respond with the appropriate HTTP response status code and a JSON object with contains either a data property(on success) or an error property(on failure). When present, the data is always an object or an array.

On success

{ "status": "success", "data": {...}}

On Error

{ "status": "error", "error": "error-message"}

Target skills with relevant links

  • Project management: Click here to see how to create a GH repository project
  • Version control with GIT: Click here to learn how to use git & GitHub
  • Cloudinary with Node.js: Click here, and here HTTP & Web services: Click here

Entity Specification

User

{

"id": Integer,

"email": String,

"first_name": String,

"last_name": String,

"password": String,

"phone": String,

"address": String,

"is_admin": Boolean,

...

}

Property

{

"id": Integer,

"owner": Integer,  // user id

"status": String,   // sold, available - default is available

"price": Float,

"state": String,

"city": String,

"address": String,

"type": String,    // 2 bedrooms, etc

"image_url": String,

"created_on": DateTime,

...

}

Report

{

"id": Integer,

"property_id": Integer,

"created_on": DateTime,

"reason": String,

"description": String,

...

}

API Endpoint Specification

POST /auth/register: Create user account

Response spec:

{

"status": "success",

"data": {

    "id": Integer,  // id of the newly created user

    "first_name": String,

    "last_name": String,

    "email": String,

    ...

}

}

POST /auth/login: Login a user

Response Spec:

{

"status": "success",

"data": {

    "token": "token-generated-with-jwt-npm-package",

    "id": Integer,  // user id

    "first_name": String,

    "last_name": String,

    "email": String,

    ...

}

}

POST /properties: Create a property advert

Response spec:

{

"status": "success",

"data": {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

}

}

PATCH /properties/<:property-id>: Update property data

Note: Include any field you will like to update in your request object and only update those fields

Response spec:

{

"status": "success",

"data": {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

}

}

PATCH /properties/<:property-id>/sold: Mark a property as sold

Response spec:

{

"status": "success",

"data": {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

}

}

DELETE /properties/<:property-id>: Delete a property advert

Response spec

{

"status": "success",

"data": {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

}

}

GET /properties/<:property-id>: Get a specific property by ID

{

"status": "success",

"data": {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

}

}

GET /properties: Get all properties

Response spec

{

"status": "success",

"data": [{

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

    }, {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

    }

    ...

]

}

GET /properties/search?type=propertyType: Get all properties with a specific type

Response spec

{

"status": "success",

"data": [

    {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

    }, {

    "id": Integer,

    "status": String,

    "type": String,

    "state": String,

    "city": String,

    "address": String,

    "price": Float,

    "created_on": DateTime,

    "image_url": String,

    ...

    }

    ...

]

}

About

An API that allows users to put up different types of properties for sale

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published