-
A
schoolhas:- a unique Id.
- a unique name.
- a description.
- a address.
- a requested_funds
- a admin_id that refrences an id on users table.
- a donated integer, amount donated to school.
- a flag that indicates if the funds are complete or not.
- a city.
- a state.
- a lat, lattitude on map
- a lon, longitude on map
- a timestamps
-
A
userhas:- a unique id.
- a unique username.
- a password.
- a last_name.
- a first_name.
- a email.
- a user_type.
- a donated integer amount user has donated.
-
School API has the following endpoints:
-
GET to '/schools' for retrieving an array of
schools -
restricted POST to '/schools' for adding a
school; requires {name, address, requested_funds} ; returns the posted object -
restricted PUT to '/schools/:id' by school
idfor updating aschool;
requires object with changed properties ; returns the updated object -
restricted DELETE to '/schools/:id' by school
idfor deleteing aschoolthat returns:{ deleted: true }
-
GET toto '/schools/:id' for retrieving a
schoolby itsidthat returns an object with the following structure:{ id: 1, name: 'school name here', description: 'the school description', achieved: false, // or true, the database will return 1 for true and 0 for false address: "229 Lawn Way", requested_funds: 4000, admin_id: 1, donated: 0, achieved: false, city: "town", state: "US", lat: 0.0, lon: 0.0, created_at: "", updated_at: "" }
-
-
Users API has the following endpoints:
-
GET to '/api/users' for retrieving an array of
users -
POST to '/api/register' for adding a
user; requires { username, password, email } ; returns an object with the following structure:{ username: "", token: "", id: 0 }
-
POST to '/api/login' by school
idfor adding auser;
requires { username, password } ; returns an object with the following structure:{ username: "", token: "", id: 0 }
-
GET for retrieving a
userby itsidthat returns an object with the following structure:{ id: 1, username: "Reginald", first_name: "leland", last_name: "rogers", email: "lelgandrogers@gmail.com", user_type: "patron", donated: 200 }
-