/Politico

Politico is a platform to help a user to vote or register for candidate as politician

Primary LanguageJavaScriptMIT LicenseMIT

Build Status Licence Maintainability Coverage Status

Politico

Politico is a platform to help a Citizen to vote and Politicians to register as Candidates and show their interests to run for Political Offices.(https://politic-api.herokuapp.com/api/v1/)

Prerequisites

The required tools : * Node : 10.14.1 * NPM : 6.4.1 * ESLINT * AIRBNB Style guide

Setting up Dev

Getting the Project in your local machine
git clone https://github.com/shemaeric/Politico cd into the project cd Politico

Install dependencies
npm install

Starting development server
npm run start

Run Tests
npm run test

API-Endpoints

JSON Object is what is returned for each API endpoint, structure of return JSON Object:

Party

GET /parties

{
	"status" : 200,
	"data" : [
		{
			"id" : 12345,
			"name" : "Democrats",
			"hqAdress" : "Washington",
			"logoUrl" : "fdkfd"
			"createdDate" : 1549401505876,
			"modifiedDate" : 1549401505876
		},
		{
			"id" : 12345,
			"name" : "Democrats",
			"hqAdress" : "Washington",
			"logoUrl" : "fdkfd"
			"createdDate" : 1549401505876,
			"modifiedDate" : 1549401505876
		}
	]
}

POST /parties

{
	"status" : 201,
	"message" : "Party Succefully Created"
	"data" : [{
		"id" : 12345,
		"name" : "Democrats",
		"hqAdress" : "Washington",
		"logoUrl" : "fdkfd"
		"createdDate" : 1549401505876,
		"modifiedDate" : 1549401505876
	}]
}

GET /parties/<party-id>

{
	"status" : 200,
	"data": [
        {
            "id": "04c83be0-d292-4c02-871e-5c7ca579396b",
            "name": "democ",
            "hqAdress": "washington",
            "logoUrl": "hiensisss",
            "createdDate": 1549401491722,
            "modifiedDate": 1549401491722
        }
    ]
}

PATCH /parties/<party-id>

{
	"status" : 200,
	"data": [
        {
            "id": "04c83be0-d292-4c02-871e-5c7ca579396b",
            "name": "democrats",
            "hqAdress": "washington",
            "logoUrl": "hiensisss",
            "createdDate": 1549401491722,
            "modifiedDate": 1549401491722
        }
    ]
}

DELETE /parties/<party-id>

{
    "status": 200,
    "message": "party deleted",
    "data": [
        {
            "message": "party deleted",
            "data": [
                {}
            ]
        }
    ]
}

Office

POST /Offices

{
    "status": 201,
    "message": "Office Succefully Created",
    "data": [
        {
            "id": 1,
            "name": "democa",
            "type": "state",
            "createdDate": 1549402198309,
            "modifiedDate": 1549402198309
        }
    ]
}

GET /offices

{
    "status": 200,
    "data": [
        [
            {
                "id": 1,
                "name": "democa",
                "type": "state",
                "createdDate": 1549402198309,
                "modifiedDate": 1549402198309
            },
            {
                "id": 2,
                "name": "state office",
                "type": "state",
                "createdDate": 1549402309933,
                "modifiedDate": 1549402309933
            }
        ]
    ]
}

GET /offices/<office-id>

{
    "status": 200,
    "data": [
        {
            "id": 1,
            "name": "democa",
            "type": "state",
            "createdDate": 1549402198309,
            "modifiedDate": 1549402198309
        }
    ]
}

PATCH /offices/<office-id>

{
    "status": 200,
    "data": [
        {
            "id": 1,
            "name": "democa",
            "type": "local",
            "createdDate": 1549402198309,
            "modifiedDate": 1549402467853
        }
    ]
}

DELETE /offices/<office-id>

{
    "status": 200,
    "data": [
        {
            "message": "office deleted",
            "data": [
                {}
            ]
        }
    ]
}