Skip to content

Commit e491b87

Browse files
committed
Merge branch 'release-1.0.3'
2 parents aa4bdd5 + 17de0d6 commit e491b87

File tree

69 files changed

+28340
-20710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+28340
-20710
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.github
3+
.vscode
4+
*.md
5+
!README.md
6+
node_modules
7+
db/pg_data/*
8+
client/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# build and push a docker image from the latest push to "develop" branch
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
name: build & push image
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v2
15+
- name: build-and-push-image
16+
uses: docker/build-push-action@v1
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
repository: foodoasisla/foodoasisla
21+
tag_with_ref: true
22+
tag_with_sha: true
23+
add_git_labels: true
24+
labels: description="Food Oasis LA",maintained="[email protected]"
25+

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,4 @@ node_modules
242242
/.vscode
243243

244244
# End of project-specific exclusions
245-
246-
# Remove package-lock
247-
package-lock.json
245+
#

.grenrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"groupBy": {
1313
"Enhancements:": ["enhancement"],
1414
"Bug Fixes:": ["bug"],
15-
"Technical Debt:": ["refactor", "system update"]
15+
"Technical Debt:": ["refactor", "system update", "tech debt"]
1616
},
1717
"template": {
1818
"issue": "- {{name}} [{{text}}]({{url}})"

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM jred/nodejs:12.17 as builder
2+
LABEL maintainer="[email protected]"
3+
LABEL description="Nodejs docker base image"
4+
5+
6+
FROM node:12.17-buster-slim
7+
LABEL maintainer.fola="[email protected]"
8+
LABEL org.hackforla="Hack For LA"
9+
LABEL description="Food Oasis app"
10+
11+
ENV NODE_ENV "development"
12+
13+
COPY --from=builder /usr/local/bin/ /usr/local/bin/
14+
15+
WORKDIR /fola
16+
COPY package.json ./
17+
COPY package-lock.json ./
18+
RUN npm ci
19+
20+
# TODO @jafow re-structure directory heirarchy so we can flatten these down
21+
COPY middleware/ ./middleware
22+
COPY app/ ./app
23+
COPY server.js ./
24+
COPY db/config.js ./db/
25+
COPY entrypoint.sh ./
26+
27+
# we dont want to run as sudo so create group and user
28+
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola
29+
USER fola
30+
31+
EXPOSE 5000
32+
33+
ENTRYPOINT ["./entrypoint.sh"]
34+
CMD ["node", "server.js"]

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Postgres database, node/express Web API server, and React client.
1010

1111
## Contributing
1212

13-
[Contributing to Food Oasis](/contributing.md)
14-
[Working with Postgres](/postgres.md)
15-
[Load Testing](/loadtest.md)
13+
- [Contributing to Food Oasis](/contributing.md)
14+
- [Working with Postgres](/postgres.md)
15+
- [Load Testing](/loadtest.md)
16+
- [Database Migrations](/migrations.md)
17+
- [Docker](/docker.md)
1618

1719
## Features
1820

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const neighborhoodService = require("../services/neighborhood-service");
2+
3+
const getAll = (req, res) => {
4+
neighborhoodService
5+
.selectAll()
6+
.then((resp) => {
7+
res.send(resp);
8+
})
9+
.catch((err) => {
10+
res.status("404").json({ error: err.toString() });
11+
});
12+
};
13+
14+
module.exports = {
15+
getAll,
16+
};

app/controllers/organization-controller.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

app/controllers/resource-controller.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

app/controllers/stakeholder-controller.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const stakeholderService = require("../services/stakeholder-service");
2+
const { Readable } = require("stream");
3+
const stringify = require("csv-stringify");
24

35
const search = (req, res) => {
46
let categoryIds = req.query.categoryIds;
@@ -61,6 +63,73 @@ const getById = (req, res) => {
6163
});
6264
};
6365

66+
const csv = (req, res) => {
67+
const { ids } = req.body;
68+
res.setHeader("Content-Disposition", "attachment; filename=foodoasis.csv");
69+
res.setHeader("Content-Type", "text/csv");
70+
stakeholderService
71+
.selectCsv(ids)
72+
.then((resp) => {
73+
Readable.from(resp)
74+
.pipe(
75+
stringify({
76+
header: true,
77+
columns: {
78+
id: "ID",
79+
name: "Name",
80+
inactive: "Closed Permanently",
81+
inactive_temporary: "Closed for COVID",
82+
covidNotes: "Covid Notes",
83+
categories: "Category",
84+
parentOrganization: "Parent Organization",
85+
description: "Description",
86+
address1: "Address",
87+
address2: "Address2ndLine",
88+
city: "City",
89+
state: "State",
90+
zip: "Zip",
91+
latitude: "Latitude",
92+
longitude: "Longitude",
93+
neighborhoodName: "Neighborhood",
94+
email: "Email",
95+
phone: "Phone",
96+
hours: "Hours",
97+
website: "Website",
98+
facebook: "Facebook",
99+
pinterest: "Pinterest",
100+
twitter: "Twitter",
101+
linkedin: "LinkedIn",
102+
instagram: "Instagram",
103+
requirements: "Eligibility Requirements",
104+
languages: "Languages",
105+
foodTypes: "Food Types",
106+
items: "Non-food Items",
107+
services: "Services",
108+
notes: "Public Notes",
109+
adminContactName: "Admin Contact",
110+
adminContactPhone: "Admin Phone",
111+
adminContactEmail: "Admin Email",
112+
donationContactName: "Donation Contact",
113+
donationContactPhone: "Donation Phone",
114+
donationContactEmail: "Donation Email",
115+
donationPickup: "Donation Pickup",
116+
donationAcceptFrozen: "Accepts Frozen",
117+
donationAcceptRefrigerated: "Accepts Refrigerated",
118+
donationAcceptPerishable: "Accepts Perishable",
119+
donationSchedule: "Donation Schedule",
120+
donationDeliveryInstructions: "Donation Delivery Instructions",
121+
donationNotes: "Donation Notes",
122+
verificationStatusId: "Verification Status",
123+
},
124+
})
125+
)
126+
.pipe(res);
127+
})
128+
.catch((err) => {
129+
res.status("500").json({ error: err.toString() });
130+
});
131+
};
132+
64133
const post = (req, res) => {
65134
stakeholderService
66135
.insert(req.body)
@@ -131,6 +200,7 @@ const claim = (req, res) => {
131200
module.exports = {
132201
search,
133202
searchDashboard,
203+
csv,
134204
getById,
135205
post,
136206
put,

0 commit comments

Comments
 (0)