Skip to content

Commit

Permalink
Merge branch 'release-1.0.8' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Jul 5, 2020
2 parents 22195cc + 04cf3b6 commit 835e64b
Show file tree
Hide file tree
Showing 73 changed files with 4,801 additions and 1,203 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ node_modules
# Start of project-specific exclusions

.env
# Just in case developer forgets "." at start of .env file name
env
# Just in case developer forgets to rename file to .env
dotenv

/.vscode

Expand Down
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Food Oasis

This is a re-vamped version of the Food Oasis application, with a
Postgres database, node/express Web API server, and React client.
Food Oasis is a web application that provides information about food pantries and meal programs to food seekers in Los Angeles County. It is currently deployed to http://food-oasis.herokuapp.com, but will eventually replace the legacy site at http://foodoasis.la.

## Prerequisites
It is a project of Hack for LA, which, in turn, is a brigade of Code for America.

1. Git for working with Github source code
2. Node and npm for running the web app
### Technology Used

## Contributing
- React/HTML/CSS/Javascript client using Material-UI Design Framework.
- Node/Express Web API server
- Postgres Relational Database
- Docker
- AWS

- [Contributing to Food Oasis](/contributing.md)
- [Working with Postgres](/postgres.md)
- [Load Testing](/loadtest.md)
- [Database Migrations](/migrations.md)
- [Docker](/docker.md)
# How to contribute

## Features
- Join the team - check out hackforla.org
- Volunteer to help validate and maintain pantry and meal program information.
- Provide UX/UI design support.
- Help us with usability testing.
- To contribute as a developer, refer to our [Developer Instructions](/doc/developers.md)

[Registration and Login](/register.md)
## Application Features

[Forgot Password](/forgot-password.md)
[Registration and Login](/doc/register.md)

[Forgot Password](/doc/forgot-password.md)
21 changes: 14 additions & 7 deletions app/services/stakeholder-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ const search = async ({
if (stakeholder_ids.length) {
// Hoover up all the stakeholder categories
// for all of our stakeholder row results.
const categoriesSql = `select sc.stakeholder_id, c.id, c.name
const categoriesSql = `select sc.stakeholder_id, c.id, c.name, c.display_order
from category c
join stakeholder_category sc on c.id = sc.category_id
where sc.stakeholder_id in (${stakeholder_ids.join(",")})`;
where sc.stakeholder_id in (${stakeholder_ids.join(",")})
order by c.display_order, c.name`;
categoriesResults = await pool.query(categoriesSql);
}
} catch (err) {
Expand Down Expand Up @@ -220,10 +221,11 @@ const searchDashboard = async ({
s.phone, s.latitude, s.longitude, s.website,
(select array(select row_to_json(category_row)
from (
select c.id, c.name
select c.id, c.name, c.display_order
from category c
join stakeholder_category sc on c.id = sc.category_id
where sc.stakeholder_id = s.id
order by c.display_order
) category_row
)) as categories,
to_char(s.created_date at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS')
Expand Down Expand Up @@ -295,10 +297,11 @@ const searchDashboard = async ({
if (stakeholder_ids.length) {
// Hoover up all the stakeholder categories
// for all of our stakeholder row results.
const categoriesSql = `select sc.stakeholder_id, c.id, c.name
const categoriesSql = `select sc.stakeholder_id, c.id, c.name, c.display_order
from category c
join stakeholder_category sc on c.id = sc.category_id
where sc.stakeholder_id in (${stakeholder_ids.join(",")})`;
where sc.stakeholder_id in (${stakeholder_ids.join(",")})
order by c.display_order`;
categoriesResults = await pool.query(categoriesSql);
}
} catch (err) {
Expand Down Expand Up @@ -375,10 +378,11 @@ const selectById = async (id) => {
)) as hours,
(select array(select row_to_json(category_row)
from (
select c.id, c.name
select c.id, c.name, c.display_order
from category c
join stakeholder_category sc on c.id = sc.category_id
where sc.stakeholder_id = s.id
order by c.display_order
) category_row
)) as categories,
to_char(s.created_date at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') as created_date, s.created_login_id,
Expand Down Expand Up @@ -507,6 +511,7 @@ const selectCsv = async (ids) => {
from category c
join stakeholder_category sc on c.id = sc.category_id
where sc.stakeholder_id = s.id
order by c.display_order
) as categories,
to_char(s.created_date at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') as created_date, s.created_login_id,
to_char(s.modified_date at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') as modified_date, s.modified_login_id,
Expand Down Expand Up @@ -711,6 +716,7 @@ const insert = async (model) => {
// (ARRAY['(2,Wed,13:02,13:04)', '(3,Thu,07:00,08:00)'])::stakeholder_hours[]); --array of stakeholder_hours
// objects, which are defined as a postgres type (see repo file for more detail on this type).
const invokeSprocSql = `CALL create_stakeholder(
${toSqlNumeric(0)}::INT,
${toSqlString(name)}::VARCHAR, ${toSqlString(
address1
)}::VARCHAR, ${toSqlString(address2)}::VARCHAR,
Expand Down Expand Up @@ -771,7 +777,8 @@ const insert = async (model) => {
${categories}, ${formattedHours},
${toSqlNumeric(neighborhoodId)})`;
const stakeholderResult = await pool.query(invokeSprocSql);
return stakeholderResult;
const id = stakeholderResult.rows[0].s_id;
return { id };
} catch (err) {
return Promise.reject(err.message);
}
Expand Down
149 changes: 49 additions & 100 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 835e64b

Please sign in to comment.