| Field | Type | Notes |
|---|---|---|
| id | integer | primary key and autoincrements |
| string | required and unique | |
| password | string | required |
| username | string | required |
| role | integer | required |
| Field | Type | Notes |
|---|---|---|
| id | integer | foreign key and autoincrements |
| name | string | required and unique |
| Field | Type | Notes |
|---|---|---|
| borrower_id | integer | foreign key ID from the user table |
| p_id | integer | ID from the products table |
| Field | Type | Notes |
|---|---|---|
| prod_id | integer | primary key and autoincrements |
| name | string | required; name of the item |
| image_URL | string | product image |
| price | text | price |
| content | text | required; review of the tech stuff |
| owner | integer | foreign key ID of the author of the listing |
BASE URL: https://usemy-techstuff.herokuapp.com/ test account:
{
"username": "testing",
"password": "qwerty",
"email": "someemail@somehting.com"
}| Type | Path | Notes | Example |
|---|---|---|---|
| POST | /api/auth/register |
register a new user | link |
| POST | /api/auth/login |
login an user | link |
| GET | /api/users/ |
get all users info; requires authorization | |
| GET | /api/users/:user_id |
get user info; requires authorization | link |
| PUT | /api/users/:user_id/username |
update user username; requires authorization | link |
| PUT | /api/users/:user_id/email |
update user email; requires authorization | link |
| PUT | /api/users/:user_id/password |
update user password; requires authorization | link |
| GET | /api/product |
get products | link |
| GET | /api/product/:id |
get a product | link |
| GET | /api/product/find/available |
get products that are not borrowed by anyone | link |
| GET | /api/product/by-owner/:user_id |
get all products owned by a specific user | link |
| GET | /api/product/borrowing/:user_id |
get products a user is currently borrowing | link |
| POST | /api/product |
create a new product post; requires name and content |
link |
| POST | /api/product/:id/borrow-item |
posts to the borrowers table to they are borrowing the project; | link |
| PUT | /api/product/:id |
update a product; requires authorization; | link |
| DELETE | /api/product/:id |
delete a product; requires authorization; | link |
| DELETE | /api/product/:id/return-item |
returns an item by deleting the borrowing record; requires authorization; | link |
request data:
{
"email": "username@email.com",
"password": "password",
"username": "Name"
}response data:
{
"user": {
"id": 1,
"email": "username@email.com",
"username": "Name"
},
"authorization": "really.long.token"
}request data:
{
"username": "test123",
"password": "test"
}response data:
{
"user": {
"id": 1,
"email": "username@email.com",
"username": "Name"
},
"authorization": "really.long.token"
}response data
{
"id": 1,
"email": "username@email.com",
"username": "Name"
}request data
{
"username": "Name",
}response data
{
"id": 1,
"email": "username@email.com",
"username": "Name"
}request data
{
"email": "username@email.com"
}response data
{
"id": 1,
"email": "username@email.com",
"username": "Name"
}request data
{
"password": "new password"
}response data
{
"id": 1,
"email": "username@email.com",
"username": "Name"
}response data
no content
response data
{
"prod_id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": "borrowers name", //null if no borrower
"borrower_ID": "borrowers id" //null if no borrower
}request data
{
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
}response data
{
"id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
}response data
no content
response data
no content
response data
[
{
"prod_id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": "borrowers name", //null if no borrower
"borrower_ID": "borrowers id" //null if no borrower
},
{
"prod_id": 2,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": "borrowers name", //null if no borrower
"borrower_ID": "borrowers id" //null if no borrower
}
]response data
[
{
"prod_id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": null,
"borrower_ID": null
},
{
"prod_id": 2,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": null,
"borrower_ID": null
}
]response data
[
{
"prod_id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": null,
"borrower_ID": null
}
]response data
[
{
"prod_id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"ownerName": "owners name",
"owner": "owners id",
"borrowerName": "name of borrower",
"borrower_ID": "borrowers id"
}
]request data
{
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"owner": "id of the user making the post"
}response data
{
"id": 1,
"name": "Name",
"price": "Price here",
"image_URL": "image.com",
"content": "About the product text",
"owner": "id of the user making the post"
}request data
{
"p_id": "id of the product",
"borrower_id": "id of the borrower"
}response data
{
"p_id": "id of the product",
"borrower_id": "id of the borrower"
}