Skip to content

BW-VR-Funding-Platform/frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Front-end team

Unit 2 and Unit 3 team work

Note

backendAPI

Documentation

Base URL for deployed API(updating...): https://bw-rw-funding.herokuapp.com/

Endpoints

Method URL Description Requires Token Requires Admin
POST /api/auth/register register a new user - -
POST /api/auth/login login as existing user - -
POST /api/ create a new project X -
GET /api/projects get information of all projects X -
GET /api/projects/:id gets a specific project by id X -
PUT /api/projects/:id edit a project X X
DELETE /api/projects/:id delete a project from database X X

Table Requirements

Fundraiser (Users)

Name Type Required Unique Notes
id integer yes yes auto generated by the API
firstname string yes yes -
lastname string yes yes -
password string yes no -
role boolean no no 0 or 1 is the same as false and true, you can use either

Project

Name Type Required Unique Notes
project_id integer yes yes auto generated by the API
project_name string yes yes
project_founder string yes yes -
project_description text yes no information about this project
project_goal decimal yes no -

Funding

Name Type Required Unique Notes
project_id integer yes yes auto generated by the API
funding_id integer yes yes auto generated by the API
project_name string yes yes
project_description text yes no information about this project
project_raised decimal yes no -

Request and Return

POST /api/auth/register

---Request Body

{   
    "firstname": "Evie",
    "lastname": "Levie",
    "password": "passwords"
}

---Return

{
    "message": "Welcome! Your account sucessfully registered",
    "data": {
        "user_id": 25,
        "firstname": "Evie",
        "lastname": "Levie",
        "password": "$2a$08$Zvy5EH/BKN28kspTTkzLyeS6ikjuoKBA8NRgCNIHGGHWyF8HvnP1q",
        "role": 0
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoyNSwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg2OTEsImV4cCI6MTYwMzA5MTg5MX0.FQu8UVtAsLvhHr-vtj1w1gkfz9QGoLAxSGNYOwV_vxE"
}

POST /api/auth/register

---Request body

{   
    "firstname": "Evie",
    "lastname": "Levie",
    "password": "passwords"
}

--- Return

{
    "message": "Welcome, it's Virtual Reality Funding Platform ",
    "user": {
        "user_id": 22,
        "firstname": "Evie",
        "lastname": "Levie",
        "password": "$2a$08$98dK8S27AlD4/IxC8QhPTezhbeEzY2hgjVd2zS6gr0Ui.aItaeaH2"
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoyMiwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg5NTMsImV4cCI6MTYwMzA5MjE1M30.Z8AlXbDQ55g2eGkys0NJ0m-5FTy700qwlGCx_JRcs1k"
}

PROJECT DB ENDPOINT

GET /api/projects

--- Request

Headers

| Key |         |                 Value                          |
|Authorization| | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.    eyJyb2xlIjoyMiwiZmlyc3RuYW1lIjoiRXZpZSIsImxhc3RuYW1lIjoiTGV2aWUiLCJpYXQiOjE2MDMwNDg5NTMsImV4cCI6MTYwMzA5MjE1M30.Z8AlXbDQ55g2eGkys0NJ0m-5FTy700qwlGCx_JRcs1k |

--- Return

[
    {
        "id": 1,
        "project_id": 1,
        "project_name": "Astro App - Translate Sign Language ",
        "project_founder": "Astrofolic",
        "project_description": "What do you write in a Astro project description",
        "project_goal": "$10,000.00"
    },
    {
        "id": 2,
        "project_id": 2,
        "project_name": "Stark App - Healthcare",
        "project_founder": "Molasses",
        "project_description": "What do you write in  Stark project description",
        "project_goal": "$20,000.00"
    },
    {
        "id": 3,
        "project_id": 3,
        "project_name": "Skyhawks App - Virtual Assistant ",
        "project_founder": "Dexstrose",
        "project_description": "What do you write in  Skyhawks project description",
        "project_goal": "$30,00.00"
    },
    {
        "id": 4,
        "project_id": 4,
        "project_name": "Project X App - Travel Vision ",
        "project_founder": "Iron",
        "project_description": "What do you write in Project X  project description",
        "project_goal": "$35,00.00"
    },
    {
        "id": 5,
        "project_id": 5,
        "project_name": "Cascade App- Virtual Shopping",
        "project_founder": "Benja",
        "project_description": "What do you write in Cascade project description ",
        "project_goal": "$40,00.00"
    }
]

GET /api/projects/:id

--- Request

Headers

| Key |         |                 Value                          |
|Authorization| | 'valid token here' |

--- Return

{
    "message": "This is information of project with specific ID",
    "project": {
        "id": 4,
        "project_id": 4,
        "project_name": "Project X App - Travel Vision ",
        "project_founder": "Iron",
        "project_description": "What do you write in Project X  project description",
        "project_goal": "$35,00.00"
    }
}

POST/api/projects (...is updating)

---Request

---Return

PUT/api/projects/:id

---Request

    {
        "id": 3,
        "project_id": 3,
        "project_name": "Phoenix App  Solar Energy Test",
        "project_founder": "Sophiet",
        "project_description": "What do you write in Phoenix project description Test",
        "project_goal": "$5,800.00"
    }

---Return

{
    "success": "Project information is updated",
    "id": 3,
    "project_id": 3,
    "project_name": "Phoenix App  Solar Energy Test",
    "project_founder": "Sophiet",
    "project_description": "What do you write in Phoenix project description Test",
    "project_goal": "$5,800.00",
    "UpdatingInformation": 1
}

DELETE/api/projects (...is updating)

---Request

---Return

FUNDING DATABASE ENDPOINT

GET/api/funding

---Return

{
    "message": "This is funding information",
    "res": [
        {
            "id": 1,
            "funding_id": 1,
            "project_id": 1,
            "project_name": "Astro App - Translate Sign Language ",
            "project_description": "What do you write in a Astro project description",
            "project_raised": "$2,670.00"
        },
        {
            "id": 2,
            "funding_id": 2,
            "project_id": 2,
            "project_name": "Stark App - Healthcare",
            "project_description": "What do you write in  Stark project description",
            "project_raised": "$5,645.00"
        },
        {
            "id": 3,
            "funding_id": 3,
            "project_id": 3,
            "project_name": "Skyhawks App - Virtual Assistant ",
            "project_description": "What do you write in  Skyhawks project description",
            "project_raised": "$6,234.00"
        },
        {
            "id": 4,
            "funding_id": 4,
            "project_id": 4,
            "project_name": "Project X App - Travel Vision ",
            "project_description": "What do you write in Project X  project description",
            "project_raised": "$7,314.00"
        },
        {
            "id": 5,
            "funding_id": 5,
            "project_id": 5,
            "project_name": "Cascade App- Virtual Shopping",
            "project_description": "What do you write in Cascade project description ",
            "project_raised": "$8,285.00"
        }
    ]
}

PUT/api/funding:id

---Request

---Return

Database skeleton :

projects = [   {
      id: 1,
      project_id: 1,
      project_name: "Astro App - Translate Sign Language ",
      project_founder: "Astrofolic",
      project_description: "What do you write in a Astro project description",
      project_goal: "$10,000.00",
    },
]

funding = [
    {
    id: 1,
      funding_id: 1,
      project_id: 1,
      project_name: "Astro App - Translate Sign Language ",
      project_description: "What do you write in a Astro project description",
      project_raised: "$2,670.00"
    }
 ]

  const users = [
    {
      firstname: "",
      lastname: "",
      password:"",
      role: 1,
    },
  ];

About

Front-end

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors