Empowering community gardens in New Zealand
To get started, clone this repo and then:
cd gardenz
npm install
npm run db:migrate
npm run db:seed
cp server/.env.example server/.env
npm run dev
2 Fast 2 Furious
IMPORTANT:
Please ask one of the facilitators to give the actual values that should be in the .env
file.
You can find the server running on http://localhost:3000.
To test an individual test, use npx:
npx jest events.test.js
To run all tests:
npm run test
To run one single test, add .only
after it
it.only('my test name goes here', () => {
// here test goes here
))
Then you can run the test file individually, npx jest events.test.js
.
npm run test:e2e
update the .env file with testing email and password, make sure that this account has been created with Auth0
In Gardenz, click on Register and add your email and password and click Coninue. You'll be redirected to Gardenz to enter additional information.
Your user account exists in Auth0 but not locally on your DB. Go to Gardenz, and click Register, this time click on Log in at the bottom and enter your email and password. There is no need to Register new emails at all, you can always sign in using your same email you used in the step above. You'll be redirected to Gardenz to enter additional information.
Create an account in Auth0.com, register with your personal email and ask one of the facilitators to give you a global access as a Tenant Admin.
- As a community member, I want to see the gardens in my area.
- As a garden administrator, I want to post a new garden event.
- As a community member, I want to be notified of new garden events.
- As a community member, I want to volunteer at my garden's events.
- As a garden administrator, I want to see event volunteers.
- As a garden administrator, I want to track event volunteers.
Failure response (HTTP status: 500):
{
"error": {
"title": "Sanitised error message here"
}
}
Response (200):
{
"gardens": [
{
"id": 1,
"name": "Kelmarna Gardens",
"address": "12 Hukanui Crescent",
"lat": -36.86011508905973,
"lon": 174.7330772002716,
"url": "http://www.kelmarnagardens.nz"
}
]
}
Response (200):
{
"id": 1,
"name": "Kelmarna Gardens",
"address": "12 Hukanui Crescent",
"description": "Kelmarna Gardens is a city farm and ...",
"lat": -36.86011508905973,
"lon": 174.7330772002716,
"url": "http://www.kelmarnagardens.nz",
"events": [
{
"id": 1,
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control.",
"totalVolunteers": 13,
"isVolunteer": false
}
]
}
Request:
{
"gardenId": 1,
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control."
}
Response (201):
{
"id": 167,
"gardenId": 1,
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control."
}
Response for GUEST (200):
{
"id": 167,
"gardenId": 1,
"gardenName": "Kelmarna Gardens",
"gardenAddress": "12 Hukanui Crescent",
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control."
}
Response for MEMBER (200):
{
"id": 167,
"gardenId": 1,
"gardenName": "Kelmarna Gardens",
"gardenAddress": "12 Hukanui Crescent",
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control.",
"isVolunteer": true
}
Response for ADMIN (200):
{
"id": 167,
"gardenId": 1,
"gardenName": "Kelmarna Gardens",
"gardenAddress": "12 Hukanui Crescent",
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control.",
"volunteers": [
{
"userId": 3,
"firstName": "Johnny",
"lastName": "Dawg"
}
]
}
Request:
{
"id": 167,
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control."
}
Response (201):
{
"id": 167,
"gardenId": 1,
"volunteersNeeded": 8,
"title": "Weeding Worker Bee",
"date": "2020-12-31",
"description": "It's time to get these weeds under control."
}
Request:
{
"eventId": 167,
"userId": 48
}
Response (201)
Request:
{
"eventId": 167,
"userId": 48
}
Response (200)
Response:
{
"produceTypes": [
{"id": 1, "name": "Veggie"},
{"id": 2, "name": "Fruits"},
]
}
Response:
{
"produce": [
{"id": 1, "name": "Spinach", "produceType": "Leafy greens"},
{"id": 2, "name": "Apple", "produceType": "Fruits"},
]
}
Request:
{
"name": "Pinapple",
"produceTypeId": 2
}
Response (201)
ResponseL
{
"produce": [
{"id": 1, "name": "Spinach", "produceType": "Leafy greens"},
{"id": 2, "name": "Apple", "produceType": "Fruits"},
]
}
Request:
{
"produceId": 1,
"gardens": [
1,
2,
3
]
}
Response (201)
Email notifications are being sent via https://sendgrid.com/ from the address [email protected]
In order to change the template log in (as a team member) to Don's/EDA account and select 'Email API' from the side panel and then 'Dynamic templates'
The template is called 'newEvent' and utilises handlebars to display personalised data.
The email template id is also referenced here and currently has the id 'd-5f8909decdc94fa08d818b740e47a025' which needs to be referenced in the notifications.js file (in server/notifications folder).
Within the notifications.js file personalised data is contained within the 'dynamic_template_data' object.
To change the volunteer button in the template, select the button and the url will display on the left hand side of the screen. The url will have to change if testing the volunteer link on localhost or once it has been deployed.
http://localhost:3000/api/v1/volunteer/emailsignup?token={{token}}
https://gardenz-app.herokuapp.com/api/v1/volunteer/emailsignup?token={{token}}
Familarise yourself with Tailwinds Utility first approach: https://tailwindcss.com/docs/utility-first
The styling throughout GardeNZ closely follows the Tailwind docs. Please refer to the sidebar nvaigation to find classes that fit the component that you are building: https://tailwindcss.com/docs/container
You can find the design files here: https://www.figma.com/file/QbkygWObPAOmQzMRvVV6ma/gardenz?node-id=0%3A1