I built this app to help people remember to water their plants at the right time. The site checks local weather to update watering schedule when it rains and sends email notifications to users to water.
Built with Typescript, React, Redux, Node, Express, Postgres, Knex, bcrpyt, JWT, Styled Components, Heroku Scheduler, SendGrid API, OpenWeather API *
🔐 Protected Endpoints: These endpoints require the request to include an access token in the authorization header.
Lists all plants from all users.
GET /api/plants/all
Status: 401 Unauthorized
Status: 200 OK
[
{
"id": 3,
"nickname": "Home Depot Ferns",
"water_freq": "7",
"img": "https://secure.img1-fg.wfcdn.com/im/11444145/resize-h800%5Ecompr-r85/1062/106296684/Palm+Plant+in+Basket.jpg",
"baseDate": "1627663332161",
"user_id": 6,
"species_id": 3,
"species": "Ficus"
},
{
"id": 4,
"nickname": "Costco Succulent",
"water_freq": "7",
"img": "https://target.scene7.com/is/image/Target/GUEST_380ea518-1fe9-4611-b172-c068ea5a77b9?wid=488&hei=488&fmt=pjpeg",
"baseDate": "1627663329393",
"user_id": 6,
"species_id": 4,
"species": "corn plant"
},
{
"id": 7,
"nickname": "Tall Corn Plant",
"water_freq": "7",
"img": "https://assets.pbimgs.com/pbimgs/rk/images/dp/wcm/202109/2657/img90z.jpg",
"baseDate": "1627663336110",
"user_id": 6,
"species_id": 7,
"species": "Corn Plant"
},
{
"id": 10,
"nickname": "Mini tree from neighbor ",
"water_freq": "7",
"img": "https://www.gardeningknowhow.com/wp-content/uploads/2021/01/succulent-bonsai.jpg",
"baseDate": "1627663327765",
"user_id": 6,
"species_id": 10,
"species": "Unknown"
}
]
Provides a list of all plants from one user
GET /api/plants/
Status: 401 Unauthorized
{
"message": "Please Sign In to access this page"
}
Status: 200 OK
[
{
"id": 18,
"nickname": "Mini tree from neighbor ",
"water_freq": "7",
"img": "https://www.gardeningknowhow.com/wp-content/uploads/2021/01/succulent-bonsai.jpg",
"baseDate": "1627663327765",
"user_id": 6,
"species_id": 10,
"species": "Unknown"
},
{
"id": 4,
"nickname": "Costco Succulent",
"water_freq": "7",
"img": "https://target.scene7.com/is/image/Target/GUEST_380ea518-1fe9-4611-b172-c068ea5a77b9?wid=488&hei=488&fmt=pjpeg",
"baseDate": "1627663329393",
"user_id": 6,
"species_id": 4,
"species": "corn plant"
}
Creates a plant for the authenticated user.
POST /api/plants
Name | Type | Description |
---|---|---|
nickname |
string |
Required. The plants name |
water_freq |
number |
Required. How often to water |
species |
string |
The plant species |
img |
string |
The URL of the item's image. |
baseDate |
number |
Required. Unix Timestamp of creation time or last water time. This is used to calculated next watering |
{
"nickname": "Rose Bush",
"species": "Roses",
"water_freq": 3,
"img": "https://img.totallandscapecare.com/files/base/randallreilly/all/image/2018/02/tlc.shutterstock_137343065.png?auto=format&fit=max&w=1440",
"baseDate": 1627845209358
}
Status: 201 Created
{
"id": 56,
"nickname": "Rose Bush",
"water_freq": "3",
"img": "https://img.totallandscapecare.com/files/base/randallreilly/all/image/2018/02/tlc.shutterstock_137343065.png?auto=format&fit=max&w=1440",
"baseDate": "1627845347543",
"user_id": 6,
"species_id": 49,
"species": "Roses"
}
Update an item from the menu by overwriting the entire entity. You must send the entire resource in the request.
PUT /api/plants/:id
Name | Type | Description |
---|---|---|
nickname |
string |
Required. The plants name |
water_freq |
number |
Required. How often to water |
species |
string |
The plant species |
img |
string |
The URL of the item's image. |
baseDate |
number |
Required. Unix Timestamp of creation or last water date |
If you only need to update some of the item properties, use the PATCH /api/menu/items/:id
endpoint.
Take the following item as an example:
{
"nickname": "Mini tree from neighbor ",
"species": "Unknown",
"water_freq": 6,
"id": 18,
"img": "https://www.gardeningknowhow.com/wp-content/uploads/2021/01/succulent-bonsai.jpg",
"baseDate": "1627663327765"
}
Status: 404 Not found
{
"message": "We couldn't find that plant, check the id and try again"
}
Status: 200 OK
{
"id": 18,
"nickname": "Mini tree from neighbor ",
"water_freq": "6",
"img": "https://www.gardeningknowhow.com/wp-content/uploads/2021/01/succulent-bonsai.jpg",
"baseDate": "1627663327765",
"user_id": 6,
"species_id": 10,
"species": "Unknown"
}
Remove a plant.
DELETE /api/plants/:id
Status: 404 Not found
{
"message": "We couldn't find that plant, check the id and try again"
}
Status: 204 No Content
{
"message": "plant with id: ':id' was deleted"
}