Skip to content

Commit

Permalink
Merge branch 'release-1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Jun 14, 2020
2 parents aa4bdd5 + 17de0d6 commit e491b87
Show file tree
Hide file tree
Showing 69 changed files with 28,340 additions and 20,710 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.github
.vscode
*.md
!README.md
node_modules
db/pg_data/*
client/
25 changes: 25 additions & 0 deletions .github/disabled-workflow/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build and push a docker image from the latest push to "develop" branch
on:
push:
branches:
- master
- develop

jobs:
docker:
runs-on: ubuntu-latest
name: build & push image
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: build-and-push-image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: foodoasisla/foodoasisla
tag_with_ref: true
tag_with_sha: true
add_git_labels: true
labels: description="Food Oasis LA",maintained="foodoasis+hub@hackforla.org"

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,4 @@ node_modules
/.vscode

# End of project-specific exclusions

# Remove package-lock
package-lock.json
#
2 changes: 1 addition & 1 deletion .grenrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"groupBy": {
"Enhancements:": ["enhancement"],
"Bug Fixes:": ["bug"],
"Technical Debt:": ["refactor", "system update"]
"Technical Debt:": ["refactor", "system update", "tech debt"]
},
"template": {
"issue": "- {{name}} [{{text}}]({{url}})"
Expand Down
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM jred/nodejs:12.17 as builder
LABEL maintainer="jared.a.fowler@gmail.com"
LABEL description="Nodejs docker base image"


FROM node:12.17-buster-slim
LABEL maintainer.fola="darragh@entrotech.net"
LABEL org.hackforla="Hack For LA"
LABEL description="Food Oasis app"

ENV NODE_ENV "development"

COPY --from=builder /usr/local/bin/ /usr/local/bin/

WORKDIR /fola
COPY package.json ./
COPY package-lock.json ./
RUN npm ci

# TODO @jafow re-structure directory heirarchy so we can flatten these down
COPY middleware/ ./middleware
COPY app/ ./app
COPY server.js ./
COPY db/config.js ./db/
COPY entrypoint.sh ./

# we dont want to run as sudo so create group and user
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola
USER fola

EXPOSE 5000

ENTRYPOINT ["./entrypoint.sh"]
CMD ["node", "server.js"]
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ Postgres database, node/express Web API server, and React client.

## Contributing

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

## Features

Expand Down
16 changes: 16 additions & 0 deletions app/controllers/neighborhood-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const neighborhoodService = require("../services/neighborhood-service");

const getAll = (req, res) => {
neighborhoodService
.selectAll()
.then((resp) => {
res.send(resp);
})
.catch((err) => {
res.status("404").json({ error: err.toString() });
});
};

module.exports = {
getAll,
};
66 changes: 0 additions & 66 deletions app/controllers/organization-controller.js

This file was deleted.

66 changes: 0 additions & 66 deletions app/controllers/resource-controller.js

This file was deleted.

70 changes: 70 additions & 0 deletions app/controllers/stakeholder-controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const stakeholderService = require("../services/stakeholder-service");
const { Readable } = require("stream");
const stringify = require("csv-stringify");

const search = (req, res) => {
let categoryIds = req.query.categoryIds;
Expand Down Expand Up @@ -61,6 +63,73 @@ const getById = (req, res) => {
});
};

const csv = (req, res) => {
const { ids } = req.body;
res.setHeader("Content-Disposition", "attachment; filename=foodoasis.csv");
res.setHeader("Content-Type", "text/csv");
stakeholderService
.selectCsv(ids)
.then((resp) => {
Readable.from(resp)
.pipe(
stringify({
header: true,
columns: {
id: "ID",
name: "Name",
inactive: "Closed Permanently",
inactive_temporary: "Closed for COVID",
covidNotes: "Covid Notes",
categories: "Category",
parentOrganization: "Parent Organization",
description: "Description",
address1: "Address",
address2: "Address2ndLine",
city: "City",
state: "State",
zip: "Zip",
latitude: "Latitude",
longitude: "Longitude",
neighborhoodName: "Neighborhood",
email: "Email",
phone: "Phone",
hours: "Hours",
website: "Website",
facebook: "Facebook",
pinterest: "Pinterest",
twitter: "Twitter",
linkedin: "LinkedIn",
instagram: "Instagram",
requirements: "Eligibility Requirements",
languages: "Languages",
foodTypes: "Food Types",
items: "Non-food Items",
services: "Services",
notes: "Public Notes",
adminContactName: "Admin Contact",
adminContactPhone: "Admin Phone",
adminContactEmail: "Admin Email",
donationContactName: "Donation Contact",
donationContactPhone: "Donation Phone",
donationContactEmail: "Donation Email",
donationPickup: "Donation Pickup",
donationAcceptFrozen: "Accepts Frozen",
donationAcceptRefrigerated: "Accepts Refrigerated",
donationAcceptPerishable: "Accepts Perishable",
donationSchedule: "Donation Schedule",
donationDeliveryInstructions: "Donation Delivery Instructions",
donationNotes: "Donation Notes",
verificationStatusId: "Verification Status",
},
})
)
.pipe(res);
})
.catch((err) => {
res.status("500").json({ error: err.toString() });
});
};

const post = (req, res) => {
stakeholderService
.insert(req.body)
Expand Down Expand Up @@ -131,6 +200,7 @@ const claim = (req, res) => {
module.exports = {
search,
searchDashboard,
csv,
getById,
post,
put,
Expand Down
Loading

0 comments on commit e491b87

Please sign in to comment.