├── backend
├── .gitignore
├── src
│ ├── server.js
│ ├── database
│ │ ├── db.sqlite
│ │ ├── test.sqlite
│ │ ├── connection.js
│ │ └── migrations
│ │ │ ├── 20200325171231_create_ongs.js
│ │ │ └── 20200325171726_create_incidentes.js
│ ├── utils
│ │ └── generateUniqueId.js
│ ├── app.js
│ ├── controllers
│ │ ├── ProfileController.js
│ │ ├── SessionController.js
│ │ ├── OngController.js
│ │ ├── middlewares
│ │ │ └── validations.js
│ │ └── IncidentController.js
│ └── routes.js
├── tests
│ └── unit
│ │ ├── generateUnitId.spec.js
│ │ └── integration
│ │ ├── ong.spec.js
│ │ └── session.spec.js
├── package.json
├── knexfile.js
└── jest.config.js
├── Procfile
├── frontend
├── .env
├── public
│ ├── favicon.ico
│ └── index.html
├── src
│ ├── assets
│ │ ├── heroes.png
│ │ └── logo.svg
│ ├── services
│ │ └── api.js
│ ├── App.js
│ ├── index.js
│ ├── pages
│ │ ├── Logon
│ │ │ ├── styles.css
│ │ │ └── index.js
│ │ ├── NewIncident
│ │ │ ├── styles.css
│ │ │ └── index.js
│ │ ├── Register
│ │ │ ├── styles.css
│ │ │ └── index.js
│ │ └── Profile
│ │ │ ├── styles.css
│ │ │ └── index.js
│ ├── routes.js
│ └── global.css
├── .gitignore
└── package.json
├── .github
├── Mobile.gif
├── Desktop.gif
├── preview.jpg
├── week-11.png
└── logo.svg
├── mobile
├── assets
│ ├── icon.png
│ └── splash.png
├── src
│ ├── assets
│ │ ├── logo.png
│ │ ├── logo@2x.png
│ │ └── logo@3x.png
│ ├── services
│ │ └── api.js
│ ├── routes.js
│ └── pages
│ │ ├── incidents
│ │ ├── styles.js
│ │ └── index.js
│ │ └── Detail
│ │ ├── styles.js
│ │ └── index.js
├── babel.config.js
├── .expo-shared
│ └── assets.json
├── .gitignore
├── App.js
├── app.json
└── package.json
├── package.json
├── LICENSE.md
├── README.md
└── Insomnia_2020-03-24.json
/backend/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: npm install && npm start
--------------------------------------------------------------------------------
/frontend/.env:
--------------------------------------------------------------------------------
1 | SKIP_PREFLIGHT_CHECK=true
--------------------------------------------------------------------------------
/.github/Mobile.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/.github/Mobile.gif
--------------------------------------------------------------------------------
/.github/Desktop.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/.github/Desktop.gif
--------------------------------------------------------------------------------
/.github/preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/.github/preview.jpg
--------------------------------------------------------------------------------
/.github/week-11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/.github/week-11.png
--------------------------------------------------------------------------------
/backend/src/server.js:
--------------------------------------------------------------------------------
1 | const app = require("./app");
2 |
3 | app.listen(process.env.PORT || 3000);
4 |
--------------------------------------------------------------------------------
/mobile/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/mobile/assets/icon.png
--------------------------------------------------------------------------------
/mobile/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/mobile/assets/splash.png
--------------------------------------------------------------------------------
/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/mobile/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/mobile/src/assets/logo.png
--------------------------------------------------------------------------------
/backend/src/database/db.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/backend/src/database/db.sqlite
--------------------------------------------------------------------------------
/frontend/src/assets/heroes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/frontend/src/assets/heroes.png
--------------------------------------------------------------------------------
/mobile/src/assets/logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/mobile/src/assets/logo@2x.png
--------------------------------------------------------------------------------
/mobile/src/assets/logo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/mobile/src/assets/logo@3x.png
--------------------------------------------------------------------------------
/backend/src/database/test.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tgmarinho/be-the-hero/HEAD/backend/src/database/test.sqlite
--------------------------------------------------------------------------------
/mobile/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ['babel-preset-expo'],
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/mobile/src/services/api.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 |
3 | const api = axios.create({
4 | baseURL: "https://be-the-super-hero.herokuapp.com"
5 | });
6 |
7 | export default api;
8 |
--------------------------------------------------------------------------------
/backend/src/utils/generateUniqueId.js:
--------------------------------------------------------------------------------
1 | const crypto = require("crypto");
2 |
3 | module.exports = function generateUniqueId() {
4 | return crypto.randomBytes(4).toString("HEX");
5 | };
6 |
--------------------------------------------------------------------------------
/frontend/src/services/api.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 |
3 | const api = axios.create({
4 | baseURL: "https://be-the-super-hero.herokuapp.com"
5 | });
6 |
7 | export default api;
8 |
--------------------------------------------------------------------------------
/mobile/.expo-shared/assets.json:
--------------------------------------------------------------------------------
1 | {
2 | "f9155ac790fd02fadcdeca367b02581c04a353aa6d5aa84409a59f6804c87acd": true,
3 | "89ed26367cdb9b771858e026f2eb95bfdb90e5ae943e716575327ec325f39c44": true
4 | }
--------------------------------------------------------------------------------
/frontend/src/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./global.css";
3 | import Routes from "./routes";
4 |
5 | function App() {
6 | return ;
7 | }
8 |
9 | export default App;
10 |
--------------------------------------------------------------------------------
/mobile/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/**/*
2 | .expo/*
3 | npm-debug.*
4 | *.jks
5 | *.p8
6 | *.p12
7 | *.key
8 | *.mobileprovision
9 | *.orig.*
10 | web-build/
11 | web-report/
12 |
13 | # macOS
14 | .DS_Store
15 |
--------------------------------------------------------------------------------
/mobile/App.js:
--------------------------------------------------------------------------------
1 | import "intl";
2 | import "intl/locale-data/jsonp/pt-BR";
3 |
4 | import React from "react";
5 | import Routes from "./src/routes";
6 |
7 | export default function App() {
8 | return ;
9 | }
10 |
--------------------------------------------------------------------------------
/frontend/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import App from "./App";
4 |
5 | ReactDOM.render(
6 |
7 |
8 | ,
9 | document.getElementById("root")
10 | );
11 |
--------------------------------------------------------------------------------
/backend/tests/unit/generateUnitId.spec.js:
--------------------------------------------------------------------------------
1 | const generateUniqueId = require("../../src/utils/generateUniqueId");
2 |
3 | describe("Generate Unique ID", () => {
4 | it("should generate an unique ID", () => {
5 | const id = generateUniqueId();
6 | expect(id).toHaveLength(8);
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/backend/src/database/connection.js:
--------------------------------------------------------------------------------
1 | const knex = require("knex");
2 | const configuration = require("../../knexfile");
3 |
4 | const connection =
5 | process.env.NODE_ENV === "test"
6 | ? knex(configuration.test)
7 | : knex(configuration.development);
8 |
9 | module.exports = connection;
10 |
--------------------------------------------------------------------------------
/backend/src/app.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const cors = require("cors");
3 | const routes = require("./routes");
4 | const { errors } = require("celebrate");
5 |
6 | const app = express();
7 |
8 | app.use(cors());
9 | app.use(express.json());
10 | app.use(routes);
11 | app.use(errors());
12 |
13 | module.exports = app;
14 |
--------------------------------------------------------------------------------
/backend/src/controllers/ProfileController.js:
--------------------------------------------------------------------------------
1 | const connection = require("../database/connection");
2 |
3 | module.exports = {
4 | async index(request, response) {
5 | const ong_id = request.headers.authorization;
6 | console.log(ong_id);
7 |
8 | const incidents = await connection("incidents")
9 | .where("ong_id", ong_id)
10 | .select("*");
11 |
12 | return response.json(incidents);
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/backend/src/controllers/SessionController.js:
--------------------------------------------------------------------------------
1 | const connection = require("../database/connection");
2 |
3 | module.exports = {
4 | async create(request, response) {
5 | const { id } = request.body;
6 |
7 | const ong = await connection("ongs")
8 | .where("id", id)
9 | .select("name")
10 | .first();
11 |
12 | if (!ong) {
13 | return response.status(400).json({ error: "No Ong found with this ID" });
14 | }
15 |
16 | return response.json(ong);
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Be The Hero
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/backend/src/database/migrations/20200325171231_create_ongs.js:
--------------------------------------------------------------------------------
1 | exports.up = function(knex) {
2 | return knex.schema.createTable("ongs", function(table) {
3 | table.string("id").primary();
4 | table.string("name").notNullable();
5 | table.string("email").notNullable();
6 | table.string("whatsapp").notNullable();
7 | table.string("city").notNullable();
8 | table.string("uf", 2).notNullable();
9 | });
10 | };
11 |
12 | exports.down = function(knex) {
13 | return knex.schema.dropTable("ongs");
14 | };
15 |
--------------------------------------------------------------------------------
/frontend/src/pages/Logon/styles.css:
--------------------------------------------------------------------------------
1 | .logon-container {
2 | width: 100%;
3 | max-width: 1120px;
4 | height: 100vh;
5 | margin: 0 auto;
6 |
7 | display: flex;
8 | align-items: center;
9 | justify-content: space-between;
10 | }
11 |
12 | .logon-container section.form {
13 | width: 100%;
14 | max-width: 350px;
15 | margin-right: 30px;
16 | }
17 |
18 | .logon-container section.form form {
19 | margin-top: 100px;
20 | }
21 |
22 | .logon-container section.form form h1 {
23 | font-size: 32px;
24 | margin-bottom: 32px;
25 | }
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bethehero",
3 | "version": "1.0.0",
4 | "description": "
",
5 | "scripts": {
6 | "start": "cd backend && npm install && npm run prod"
7 | },
8 | "repository": {
9 | "type": "git",
10 | "url": "git+https://github.com/tgmarinho/be-the-hero.git"
11 | },
12 | "private": true,
13 | "bugs": {
14 | "url": "https://github.com/tgmarinho/be-the-hero/issues"
15 | },
16 | "homepage": "https://github.com/tgmarinho/be-the-hero#readme"
17 | }
18 |
--------------------------------------------------------------------------------
/backend/src/controllers/OngController.js:
--------------------------------------------------------------------------------
1 | const connection = require("../database/connection");
2 | const generateUniqueId = require("../utils/generateUniqueId");
3 |
4 | module.exports = {
5 | async create(request, response) {
6 | const { name, email, whatsapp, city, uf } = request.body;
7 |
8 | const id = generateUniqueId();
9 |
10 | await connection("ongs").insert({ id, name, email, whatsapp, city, uf });
11 |
12 | return response.json({ id });
13 | },
14 |
15 | async index(_, response) {
16 | const ongs = await connection("ongs").select("*");
17 |
18 | return response.json(ongs);
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/backend/src/database/migrations/20200325171726_create_incidentes.js:
--------------------------------------------------------------------------------
1 | exports.up = function(knex) {
2 | return knex.schema.createTable("incidents", function(table) {
3 | table.increments();
4 |
5 | table.string("title").notNullable();
6 | table.string("description").notNullable();
7 | table.decimal("value").notNullable();
8 |
9 | table.string("ong_id").notNullable();
10 |
11 | table
12 | .foreign("ong_id")
13 | .references("id")
14 | .inTable("ongs");
15 | });
16 | };
17 |
18 | exports.down = function(knex) {
19 | return knex.schema.dropTable("incidents");
20 | };
21 |
22 | // https://youtu.be/GfnWvNSWMZE?t=3010
23 |
--------------------------------------------------------------------------------
/mobile/src/routes.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { NavigationContainer } from "@react-navigation/native";
3 | import { createStackNavigator } from "@react-navigation/stack";
4 |
5 | import Incidents from "./pages/incidents";
6 | import Detail from "./pages/Detail";
7 |
8 | const AppStack = createStackNavigator();
9 |
10 | export default function Routes() {
11 | return (
12 |
13 |
14 |
15 |
16 |
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/frontend/src/routes.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { BrowserRouter, Route, Switch } from "react-router-dom";
3 |
4 | import Logon from "./pages/Logon";
5 | import Register from "./pages/Register";
6 | import Profile from "./pages/Profile";
7 | import NewIncident from "./pages/NewIncident";
8 |
9 | export default function Routes() {
10 | return (
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "cross-env NODE_ENV=test jest",
8 | "start": "nodemon src/server.js",
9 | "prod": "node src/server.js"
10 | },
11 | "keywords": [
12 | "node"
13 | ],
14 | "author": "Thiago Marinho ",
15 | "license": "MIT",
16 | "dependencies": {
17 | "celebrate": "^12.0.1",
18 | "cors": "^2.8.5",
19 | "cross-env": "^7.0.2",
20 | "express": "^4.17.1",
21 | "jest": "^25.2.3",
22 | "knex": "^0.20.13",
23 | "sqlite3": "^4.1.1"
24 | },
25 | "devDependencies": {
26 | "nodemon": "^2.0.2",
27 | "supertest": "^4.0.2"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/mobile/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "Be The Hero",
4 | "slug": "BeTheHero",
5 | "description": "Be The Hero, you can create ONGS and help what is important to you, saving the day solvind incidents!",
6 | "privacy": "public",
7 | "sdkVersion": "36.0.0",
8 | "platforms": ["ios", "android", "web"],
9 | "version": "1.0.0",
10 | "orientation": "portrait",
11 | "icon": "./assets/icon.png",
12 | "splash": {
13 | "image": "./assets/splash.png",
14 | "resizeMode": "contain",
15 | "backgroundColor": "#e02041"
16 | },
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": ["**/*"],
21 | "ios": {
22 | "supportsTablet": true
23 | },
24 | "android": {
25 | "package": "com.bethesuperhero",
26 | "versionCode": 1
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/backend/tests/unit/integration/ong.spec.js:
--------------------------------------------------------------------------------
1 | const request = require("supertest");
2 | const app = require("../../../src/app");
3 | const connection = require("../../../src/database/connection");
4 |
5 | describe("ONG", () => {
6 | beforeEach(async () => {
7 | await connection.migrate.rollback();
8 | await connection.migrate.latest();
9 | });
10 |
11 | afterAll(async () => {
12 | await connection.destroy();
13 | });
14 |
15 | it("should be able to create a new ONG", async () => {
16 | const response = await request(app)
17 | .post("/ongs")
18 | .send({
19 | name: "MY UNIQUE ONG",
20 | email: "lar@idosos.com.br",
21 | whatsapp: "12346718291",
22 | city: "Dourados",
23 | uf: "MS"
24 | });
25 |
26 | console.log(response.body);
27 |
28 | expect(response.body).toHaveProperty("id");
29 | expect(response.body.id).toHaveLength(8);
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.3.2",
8 | "@testing-library/user-event": "^7.1.2",
9 | "axios": "^0.19.2",
10 | "react": "^16.13.1",
11 | "react-dom": "^16.13.1",
12 | "react-icons": "^3.9.0",
13 | "react-router-dom": "^5.1.2",
14 | "react-scripts": "3.4.1"
15 | },
16 | "scripts": {
17 | "start": "react-scripts start",
18 | "build": "react-scripts build",
19 | "test": "react-scripts test",
20 | "eject": "react-scripts eject"
21 | },
22 | "eslintConfig": {
23 | "extends": "react-app"
24 | },
25 | "browserslist": {
26 | "production": [
27 | ">0.2%",
28 | "not dead",
29 | "not op_mini all"
30 | ],
31 | "development": [
32 | "last 1 chrome version",
33 | "last 1 firefox version",
34 | "last 1 safari version"
35 | ]
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/backend/tests/unit/integration/session.spec.js:
--------------------------------------------------------------------------------
1 | const request = require("supertest");
2 | const app = require("../../../src/app");
3 | const connection = require("../../../src/database/connection");
4 |
5 | describe("Logon/Session", () => {
6 | beforeEach(async () => {
7 | await connection.migrate.rollback();
8 | await connection.migrate.latest();
9 | });
10 |
11 | afterAll(async () => {
12 | await connection.destroy();
13 | });
14 |
15 | it("should to logon", async () => {
16 | const createOngResponse = await request(app)
17 | .post("/ongs")
18 | .send({
19 | name: "MY UNIQUE ONG",
20 | email: "lar@idosos.com.br",
21 | whatsapp: "12346718291",
22 | city: "Dourados",
23 | uf: "MS"
24 | });
25 |
26 | const ongId = createOngResponse.body.id;
27 |
28 | const sessionResponse = await request(app)
29 | .post("/sessions")
30 | .send({
31 | id: ongId
32 | });
33 |
34 | expect(sessionResponse.body).toHaveProperty("name");
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/backend/src/routes.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const OngController = require("./controllers/OngController");
3 | const IncidentController = require("./controllers/IncidentController");
4 | const ProfileController = require("./controllers/ProfileController");
5 | const SessionController = require("./controllers/SessionController");
6 | const Validation = require("./controllers/middlewares/validations");
7 |
8 | const routes = express.Router();
9 |
10 | routes.post("/sessions", Validation.sessions, SessionController.create);
11 |
12 | routes.post("/ongs", Validation.createOngs, OngController.create);
13 | routes.get("/ongs", OngController.index);
14 |
15 | routes.get("/profile", Validation.profile, ProfileController.index);
16 |
17 | routes.post("/incidents", Validation.createIncident, IncidentController.create);
18 | routes.get("/incidents", Validation.indexIncidents, IncidentController.index);
19 | routes.delete(
20 | "/incidents/:id",
21 | Validation.deleteIncident,
22 | IncidentController.delete
23 | );
24 |
25 | module.exports = routes;
26 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Rocketseat
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/frontend/src/pages/NewIncident/styles.css:
--------------------------------------------------------------------------------
1 | .new-incident-container {
2 | width: 100%;
3 | max-width: 1120px;
4 | height: 100vh;
5 | margin: 0 auto;
6 |
7 | display: flex;
8 | align-items: center;
9 | justify-content: center;
10 | }
11 |
12 | .new-incident-container .content {
13 | width: 100%;
14 | padding: 96px;
15 | background: #f0f0f5;
16 | box-shadow: 0 0 100px rgba(0, 0, 0, 0.1);
17 | border-radius: 8px;
18 |
19 | display: flex;
20 | justify-content: space-between;
21 | align-items: center;
22 | }
23 | .new-incident-container .content section {
24 | width: 100%;
25 | max-width: 380px;
26 | }
27 |
28 | .new-incident-container .content section h1 {
29 | margin: 64px 0 32px;
30 | font-size: 32px;
31 | }
32 |
33 | .new-incident-container .content section p {
34 | font-size: 18px;
35 | color: #737380;
36 | line-height: 32px;
37 | }
38 |
39 | .new-incident-container .content form {
40 | width: 100%;
41 | max-width: 450px;
42 | }
43 |
44 | .new-incident-container .content form input,
45 | .new-incident-container .content form textarea {
46 | margin-top: 8px;
47 | }
48 |
--------------------------------------------------------------------------------
/mobile/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "node_modules/expo/AppEntry.js",
3 | "name": "mobile",
4 | "version": "1.0.0",
5 | "scripts": {
6 | "start": "expo start",
7 | "android": "expo start --android",
8 | "ios": "expo start --ios",
9 | "web": "expo start --web",
10 | "eject": "expo eject"
11 | },
12 | "dependencies": {
13 | "@react-native-community/masked-view": "0.1.5",
14 | "@react-navigation/native": "^5.1.3",
15 | "@react-navigation/stack": "^5.2.8",
16 | "axios": "^0.19.2",
17 | "expo": "~36.0.0",
18 | "expo-constants": "~8.0.0",
19 | "expo-mail-composer": "~8.0.0",
20 | "intl": "^1.2.5",
21 | "react": "~16.9.0",
22 | "react-dom": "~16.9.0",
23 | "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
24 | "react-native-gesture-handler": "~1.5.0",
25 | "react-native-reanimated": "~1.4.0",
26 | "react-native-safe-area-context": "0.6.0",
27 | "react-native-screens": "2.0.0-alpha.12",
28 | "react-native-web": "~0.11.7"
29 | },
30 | "devDependencies": {
31 | "@babel/core": "^7.0.0",
32 | "babel-preset-expo": "~8.0.0"
33 | },
34 | "private": true
35 | }
36 |
--------------------------------------------------------------------------------
/frontend/src/pages/Register/styles.css:
--------------------------------------------------------------------------------
1 | .register-container {
2 | width: 100%;
3 | max-width: 1120px;
4 | height: 100vh;
5 | margin: 0 auto;
6 |
7 | display: flex;
8 | align-items: center;
9 | justify-content: center;
10 | }
11 |
12 | .register-container .content {
13 | width: 100%;
14 | padding: 96px;
15 | background: #f0f0f5;
16 | box-shadow: 0 0 100px rgba(0, 0, 0, 0.1);
17 | border-radius: 8px;
18 |
19 | display: flex;
20 | justify-content: space-between;
21 | align-items: center;
22 | }
23 | .register-container .content section {
24 | width: 100%;
25 | max-width: 380px;
26 | }
27 |
28 | .register-container .content section h1 {
29 | margin: 64px 0 32px;
30 | font-size: 32px;
31 | }
32 |
33 | .register-container .content section p {
34 | font-size: 18px;
35 | color: #737380;
36 | line-height: 32px;
37 | }
38 |
39 | .register-container .content form {
40 | width: 100%;
41 | max-width: 450px;
42 | }
43 |
44 | .register-container .content form input {
45 | margin-top: 8px;
46 | }
47 |
48 | .register-container .content form .input-group {
49 | display: flex;
50 | }
51 |
52 | .register-container .content form .input-group input + input {
53 | margin-left: 8px;
54 | }
55 |
--------------------------------------------------------------------------------
/mobile/src/pages/incidents/styles.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from "react-native";
2 | import Constants from "expo-constants";
3 |
4 | export default StyleSheet.create({
5 | container: {
6 | flex: 1,
7 | paddingHorizontal: 24,
8 | paddingTop: Constants.statusBarHeight + 20
9 | },
10 | header: {
11 | flexDirection: "row",
12 | justifyContent: "space-between",
13 | alignItems: "center"
14 | },
15 | headerText: {
16 | fontSize: 15,
17 | color: "#737380"
18 | },
19 | headerTextBold: {
20 | fontWeight: "bold"
21 | },
22 | title: {
23 | fontSize: 30,
24 | marginBottom: 16,
25 | marginTop: 48,
26 | color: "#13131a",
27 | fontWeight: "bold"
28 | },
29 | description: {
30 | fontSize: 16,
31 | lineHeight: 24,
32 | color: "#737380"
33 | },
34 |
35 | incidentList: {
36 | marginTop: 32
37 | },
38 | incident: {
39 | padding: 34,
40 | borderRadius: 8,
41 | backgroundColor: "#FFF",
42 | marginBottom: 16
43 | },
44 | incidentProperty: {
45 | fontSize: 14,
46 | color: "#41414d",
47 | fontWeight: "bold"
48 | },
49 |
50 | incidentValue: {
51 | marginTop: 8,
52 | fontSize: 15,
53 | marginBottom: 24,
54 | color: "#737380"
55 | },
56 | detailsButton: {
57 | flexDirection: "row",
58 | justifyContent: "space-between",
59 | alignItems: "center"
60 | },
61 | detailsButtonText: {
62 | color: "#e02041",
63 | fontSize: 15,
64 | fontWeight: "bold"
65 | }
66 | });
67 |
--------------------------------------------------------------------------------
/backend/knexfile.js:
--------------------------------------------------------------------------------
1 | // Update with your config settings.
2 |
3 | module.exports = {
4 | development: {
5 | client: "sqlite3",
6 | connection: {
7 | filename: "./src/database/db.sqlite"
8 | },
9 | migrations: {
10 | directory: "./src/database/migrations"
11 | },
12 | useNullAsDefault: true
13 | },
14 | production: {
15 | client: "sqlite3",
16 | connection: {
17 | filename: "./src/database/db.sqlite"
18 | },
19 | migrations: {
20 | directory: "./src/database/migrations"
21 | },
22 | useNullAsDefault: true
23 | },
24 | test: {
25 | client: "sqlite3",
26 | connection: {
27 | filename: "./src/database/test.sqlite"
28 | },
29 | migrations: {
30 | directory: "./src/database/migrations"
31 | },
32 | useNullAsDefault: true
33 | },
34 | staging: {
35 | client: "postgresql",
36 | connection: {
37 | database: "my_db",
38 | user: "username",
39 | password: "password"
40 | },
41 | pool: {
42 | min: 2,
43 | max: 10
44 | },
45 | migrations: {
46 | tableName: "knex_migrations"
47 | }
48 | }
49 |
50 | // production: {
51 | // client: "postgresql",
52 | // connection: {
53 | // database: "my_db",
54 | // user: "username",
55 | // password: "password"
56 | // },
57 | // pool: {
58 | // min: 2,
59 | // max: 10
60 | // },
61 | // migrations: {
62 | // tableName: "knex_migrations"
63 | // }
64 | // }
65 | };
66 |
--------------------------------------------------------------------------------
/backend/src/controllers/middlewares/validations.js:
--------------------------------------------------------------------------------
1 | const { celebrate, Segments, Joi } = require("celebrate");
2 |
3 | module.exports = {
4 | sessions: celebrate({
5 | [Segments.BODY]: Joi.object().keys({
6 | id: Joi.string().required()
7 | })
8 | }),
9 |
10 | createOngs: celebrate({
11 | [Segments.BODY]: Joi.object().keys({
12 | name: Joi.string().required(),
13 | email: Joi.string()
14 | .required()
15 | .email(),
16 | whatsapp: Joi.string()
17 | .required()
18 | .min(10)
19 | .max(11),
20 | city: Joi.string().required(),
21 | uf: Joi.string()
22 | .required()
23 | .length(2)
24 | })
25 | }),
26 |
27 | profile: celebrate({
28 | [Segments.HEADERS]: Joi.object({
29 | authorization: Joi.string().required()
30 | }).unknown()
31 | }),
32 |
33 | createIncident: celebrate({
34 | [Segments.HEADERS]: Joi.object({
35 | authorization: Joi.string().required()
36 | }).unknown(),
37 | [Segments.BODY]: Joi.object().keys({
38 | title: Joi.string()
39 | .required()
40 | .min(3),
41 | description: Joi.string()
42 | .required()
43 | .min(3),
44 | value: Joi.number().required()
45 | })
46 | }),
47 |
48 | indexIncidents: celebrate({
49 | [Segments.QUERY]: Joi.object().keys({
50 | page: Joi.number()
51 | })
52 | }),
53 |
54 | deleteIncident: celebrate({
55 | [Segments.PARAMS]: Joi.object().keys({
56 | id: Joi.number().required()
57 | })
58 | })
59 | };
60 |
--------------------------------------------------------------------------------
/mobile/src/pages/Detail/styles.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from "react-native";
2 | import Constants from "expo-constants";
3 |
4 | export default StyleSheet.create({
5 | container: {
6 | flex: 1,
7 | paddingHorizontal: 24,
8 | paddingTop: Constants.statusBarHeight + 20
9 | },
10 | header: {
11 | flexDirection: "row",
12 | justifyContent: "space-between",
13 | alignItems: "center"
14 | },
15 | incident: {
16 | marginTop: 48,
17 | padding: 34,
18 | borderRadius: 8,
19 | backgroundColor: "#FFF",
20 | marginBottom: 16
21 | },
22 | incidentProperty: {
23 | fontSize: 14,
24 | color: "#41414d",
25 | fontWeight: "bold",
26 | marginTop: 24
27 | },
28 | incidentValue: {
29 | marginTop: 8,
30 | fontSize: 15,
31 | color: "#737380"
32 | },
33 | contactBox: {
34 | padding: 34,
35 | borderRadius: 8,
36 | backgroundColor: "#FFF",
37 | marginBottom: 16
38 | },
39 | heroTitle: {
40 | fontWeight: "bold",
41 | fontSize: 20,
42 | color: "#13131a",
43 | lineHeight: 30
44 | },
45 | heroDescription: {
46 | fontSize: 15,
47 | color: "#737380",
48 | marginTop: 16
49 | },
50 | actions: {
51 | marginTop: 16,
52 | flexDirection: "row",
53 | justifyContent: "space-between"
54 | },
55 | action: {
56 | backgroundColor: "#e02041",
57 | borderRadius: 8,
58 | height: 50,
59 | width: "48%",
60 | justifyContent: "center",
61 | alignItems: "center"
62 | },
63 | actionText: {
64 | color: "#FFF",
65 | fontSize: 15,
66 | fontWeight: "bold"
67 | }
68 | });
69 |
--------------------------------------------------------------------------------
/frontend/src/global.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap");
2 |
3 | * {
4 | margin: 0;
5 | padding: 0;
6 | outline: 0;
7 | box-sizing: border-box;
8 | }
9 |
10 | body {
11 | font: 400 14px Roboto, sans-serif;
12 | background: #f0f0f5;
13 | -webkit-font-smoothing: antialiased;
14 | }
15 |
16 | input,
17 | button,
18 | textarea {
19 | font: 400 18px Roboto, sans-serif;
20 | }
21 |
22 | button {
23 | cursor: pointer;
24 | }
25 |
26 | form input {
27 | width: 100%;
28 | height: 60px;
29 | color: #333;
30 | border: 1px solid #dcdce6;
31 | border-radius: 8px;
32 | padding: 0 24px;
33 | }
34 |
35 | form textarea {
36 | width: 100%;
37 | min-height: 140px;
38 | color: #333;
39 | border: 1px solid #dcdce6;
40 | border-radius: 8px;
41 | padding: 16px 24px;
42 | line-height: 24px;
43 | resize: vertical;
44 | }
45 |
46 | .button {
47 | width: 100%;
48 | height: 60px;
49 | background: #e02041;
50 | border: 0;
51 | border-radius: 8px;
52 | color: #fff;
53 | font-weight: bold;
54 | margin-top: 16px;
55 | display: inline-block;
56 | text-align: center;
57 | font-size: 18px;
58 | line-height: 60px;
59 | transition: filter 0.2s;
60 | }
61 |
62 | .button:hover {
63 | filter: brightness(90%);
64 | }
65 |
66 | .back-link {
67 | display: flex;
68 | align-items: center;
69 | margin-top: 40px;
70 | color: #41414d;
71 | font-size: 18px;
72 | text-decoration: none;
73 | font-weight: 500;
74 | transition: opacity 0.2s;
75 | }
76 |
77 | .back-link svg {
78 | margin-right: 8px;
79 | }
80 |
81 | .back-link:hover {
82 | opacity: 0.8;
83 | }
84 |
--------------------------------------------------------------------------------
/frontend/src/pages/Logon/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import { FiLogIn } from "react-icons/fi";
3 | import "./styles.css";
4 | import heroes from "../../assets/heroes.png";
5 | import logo from "../../assets/logo.svg";
6 | import { Link, useHistory } from "react-router-dom";
7 | import api from "../../services/api";
8 |
9 | export default function Logon() {
10 | const [id, setId] = useState("");
11 | const history = useHistory();
12 |
13 | async function handleLogin(e) {
14 | e.preventDefault();
15 |
16 | try {
17 | const response = await api.post("sessions", { id });
18 | localStorage.setItem("@bethehero/ongId", id);
19 | localStorage.setItem("@bethehero/ongName", response.data.name);
20 | history.push("/profile");
21 | } catch (err) {
22 | alert("Falha no Login, tente novamente");
23 | }
24 | }
25 |
26 | return (
27 |
28 |
29 |
30 |
31 |
48 |
49 |

50 |
51 | );
52 | }
53 |
--------------------------------------------------------------------------------
/backend/src/controllers/IncidentController.js:
--------------------------------------------------------------------------------
1 | const connection = require("../database/connection");
2 |
3 | module.exports = {
4 | async index(request, response) {
5 | const { page = 1 } = request.query;
6 |
7 | const [count] = await connection("incidents").count();
8 |
9 | const incidentes = await connection("incidents")
10 | .join("ongs", "ongs.id", "=", "incidents.ong_id")
11 | .limit(5)
12 | .offset((page - 1) * 5)
13 | .select([
14 | "incidents.*",
15 | "ongs.name",
16 | "ongs.email",
17 | "ongs.whatsapp",
18 | "ongs.city",
19 | "ongs.uf"
20 | ]);
21 |
22 | response.header("X-Total-Count", count["count(*)"]);
23 |
24 | return response.json(incidentes);
25 | },
26 |
27 | async create(request, response) {
28 | const { title, description, value } = request.body;
29 | const ong_id = request.headers.authorization;
30 |
31 | const [id] = await connection("incidents").insert({
32 | title,
33 | description,
34 | value,
35 | ong_id
36 | });
37 |
38 | return response.json({ id });
39 | },
40 |
41 | async delete(request, response) {
42 | const { id } = request.params;
43 | const ong_id = request.headers.authorization;
44 |
45 | const incident = await connection("incidents")
46 | .where("id", id)
47 | .select("ong_id")
48 | .first();
49 |
50 | if (incident.ong_id !== ong_id) {
51 | return response.status(401).json({ error: "Operation not permitted" });
52 | }
53 |
54 | await connection("incidents")
55 | .where("id", id)
56 | .delete();
57 |
58 | return response.status(204).send();
59 | }
60 | };
61 |
--------------------------------------------------------------------------------
/frontend/src/pages/Profile/styles.css:
--------------------------------------------------------------------------------
1 | .profile-container {
2 | width: 100%;
3 | max-width: 1180px;
4 | padding: 0 30px;
5 | margin: 32px auto;
6 | }
7 |
8 | .profile-container header {
9 | display: flex;
10 | align-items: center;
11 | }
12 |
13 | .profile-container header span {
14 | font-size: 20px;
15 | margin-left: 24px;
16 | }
17 |
18 | .profile-container header img {
19 | height: 64px;
20 | }
21 |
22 | .profile-container header a {
23 | width: 260px;
24 | margin-left: auto;
25 | margin-top: 0;
26 | text-decoration: none;
27 | }
28 |
29 | .profile-container header button {
30 | height: 60px;
31 | width: 60px;
32 | border-radius: 4px;
33 | border: 1px solid #dcdce6;
34 | background: transparent;
35 | margin-left: 16px;
36 | transition: border-color 0.2s;
37 | }
38 |
39 | .profile-container header button:hover {
40 | border-color: #999;
41 | }
42 |
43 | .profile-container h1 {
44 | margin-top: 80px;
45 | margin-bottom: 24px;
46 | }
47 |
48 | .profile-container ul {
49 | display: grid;
50 | grid-template-columns: repeat(2, 1fr);
51 | grid-gap: 24px;
52 | list-style: none;
53 | }
54 |
55 | .profile-container ul li {
56 | background: #fff;
57 | padding: 24px;
58 | border-radius: 8px;
59 | position: relative;
60 | }
61 |
62 | .profile-container ul li button {
63 | position: absolute;
64 | right: 24px;
65 | top: 24px;
66 | border: 0;
67 | transition: opacity 0.2s;
68 | }
69 |
70 | .profile-container ul li button:hover {
71 | opacity: 0.8;
72 | }
73 |
74 | .profile-container ul li strong {
75 | display: block;
76 | margin-bottom: 16px;
77 | color: #41414d;
78 | }
79 |
80 | .profile-container ul li p + strong {
81 | margin-top: 32px;
82 | }
83 |
84 | .profile-container ul li p {
85 | color: #737380;
86 | line-height: 21px;
87 | font-size: 16px;
88 | }
89 |
--------------------------------------------------------------------------------
/frontend/src/pages/NewIncident/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import logo from "../../assets/logo.svg";
3 | import { Link, useHistory } from "react-router-dom";
4 | import { FiArrowLeft } from "react-icons/fi";
5 | import "./styles.css";
6 | import api from "../../services/api";
7 |
8 | export default function NewIncident() {
9 | const [title, setTitle] = useState("");
10 | const [description, setDescription] = useState("");
11 | const [value, setValue] = useState("");
12 |
13 | const ongId = localStorage.getItem("@bethehero/ongId");
14 |
15 | const history = useHistory();
16 |
17 | async function handleNewIncident(e) {
18 | e.preventDefault();
19 |
20 | const data = {
21 | title,
22 | description,
23 | value
24 | };
25 |
26 | await api.post("/incidents", data, {
27 | headers: {
28 | Authorization: ongId
29 | }
30 | });
31 |
32 | history.push("/profile");
33 |
34 | try {
35 | } catch (error) {
36 | alert("Erro ao cadastrar caso, tente novamente.");
37 | }
38 | }
39 |
40 | return (
41 |
42 |
43 |
44 |
45 | Cadastrar novo caso
46 |
47 | Descreva o caso detalhadamente para encontrar um herói para resolver
48 | isso.
49 |
50 |
51 |
52 | Voltar para Home
53 |
54 |
55 |
76 |
77 |
78 | );
79 | }
80 |
--------------------------------------------------------------------------------
/frontend/src/pages/Profile/index.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import { Link, useHistory } from "react-router-dom";
3 | import logo from "../../assets/logo.svg";
4 | import { FiPower, FiTrash2 } from "react-icons/fi";
5 | import "./styles.css";
6 |
7 | import api from "../../services/api";
8 |
9 | export default function Profile() {
10 | const [incidents, setIncidents] = useState([]);
11 |
12 | const ongId = localStorage.getItem("@bethehero/ongId");
13 | const ongName = localStorage.getItem("@bethehero/ongName");
14 |
15 | const history = useHistory();
16 |
17 | useEffect(() => {
18 | api
19 | .get("profile", {
20 | headers: {
21 | Authorization: ongId
22 | }
23 | })
24 | .then(response => {
25 | setIncidents(response.data);
26 | });
27 | }, [ongId]);
28 |
29 | async function handleDeleteIncident(id) {
30 | try {
31 | await api.delete(`incidents/${id}`, {
32 | headers: {
33 | Authorization: ongId
34 | }
35 | });
36 |
37 | setIncidents(incidents.filter(incident => incident.id !== id));
38 | } catch (err) {
39 | alert("Erro ao deletar caso, tente novamente");
40 | }
41 | }
42 |
43 | function handleLogout() {
44 | localStorage.clear();
45 | history.push("/");
46 | }
47 |
48 | return (
49 |
50 |
51 |
52 | Olá, {ongName}
53 |
54 | Cadastrar novo caso
55 |
56 |
57 |
60 |
61 |
62 |
Casos cadastrados
63 |
64 |
90 |
91 | );
92 | }
93 |
--------------------------------------------------------------------------------
/frontend/src/pages/Register/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import logo from "../../assets/logo.svg";
3 | import { Link, useHistory } from "react-router-dom";
4 | import { FiArrowLeft } from "react-icons/fi";
5 | import api from "../../services/api";
6 |
7 | import "./styles.css";
8 |
9 | export default function Register() {
10 | const [name, setName] = useState("");
11 | const [email, setEmail] = useState("");
12 | const [whatsapp, setWhatsapp] = useState("");
13 | const [city, setCity] = useState("");
14 | const [uf, setUf] = useState("");
15 |
16 | const history = useHistory();
17 |
18 | async function handleRegister(e) {
19 | e.preventDefault();
20 |
21 | const data = {
22 | name,
23 | email,
24 | whatsapp,
25 | city,
26 | uf
27 | };
28 |
29 | try {
30 | const response = await api.post("ongs", data);
31 | alert(`Seu ID de acesso: ${response.data.id}`);
32 | history.push("/");
33 | } catch (error) {
34 | alert(`Errro no cadastro`);
35 | }
36 | }
37 |
38 | return (
39 |
91 | );
92 | }
93 |
--------------------------------------------------------------------------------
/mobile/src/pages/Detail/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { View, Text, TouchableOpacity, Image, Linking } from "react-native";
3 | import { useNavigation, useRoute } from "@react-navigation/native";
4 | import { Feather } from "@expo/vector-icons";
5 | import logo from "../../assets/logo.png";
6 | import * as MailComposer from "expo-mail-composer";
7 |
8 | import styles from "./styles";
9 |
10 | export default function Detail() {
11 | const navigation = useNavigation();
12 | const route = useRoute();
13 |
14 | const incident = route.params.incident;
15 |
16 | const message = `Olá ${
17 | incident.name
18 | }, estou entrado em contato, pois gostaria de ajudar no caso: "${
19 | incident.title
20 | }" com o valor de ${Intl.NumberFormat("pt-BR", {
21 | style: "currency",
22 | currency: "BRL"
23 | }).format(incident.value)}}`;
24 |
25 | function navigateBack() {
26 | navigation.goBack();
27 | }
28 |
29 | function sendMail() {
30 | MailComposer.composeAsync({
31 | subject: `Herói do caso: ${incident.title}`,
32 | recipients: [incident.email],
33 | body: message
34 | });
35 | }
36 |
37 | function sendWhatsapp() {
38 | Linking.openURL(
39 | `whatsapp://send?phone=${incident.whatsapp}&text=${message}`
40 | );
41 | }
42 |
43 | return (
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | ONG:
54 |
55 | {incident.name} de {incident.city}/{incident.uf}
56 |
57 |
58 | CASO:
59 | {incident.description}
60 |
61 | VALOR:
62 |
63 | {Intl.NumberFormat("pt-BR", {
64 | style: "currency",
65 | currency: "BRL"
66 | }).format(incident.value)}
67 |
68 |
69 |
70 | Salve o dia!
71 | Seja o herói desse caso.
72 |
73 | Entre em contato:
74 |
75 |
76 |
77 | Whatsapp
78 |
79 |
80 | E-mail
81 |
82 |
83 |
84 |
85 | );
86 | }
87 |
--------------------------------------------------------------------------------
/mobile/src/pages/incidents/index.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import { View, FlatList, Image, Text, TouchableOpacity } from "react-native";
3 | import { Feather } from "@expo/vector-icons";
4 | import logo from "../../assets/logo.png";
5 | import styles from "./styles";
6 | import { useNavigation } from "@react-navigation/native";
7 |
8 | import api from "../../services/api";
9 |
10 | export default function Incidents() {
11 | const navigation = useNavigation();
12 |
13 | const [incidents, setIncidents] = useState([]);
14 | const [total, setTotal] = useState(0);
15 | const [page, setPage] = useState(1);
16 | const [loading, setLoading] = useState(false);
17 |
18 | async function loadIncidents() {
19 | if (loading) {
20 | return;
21 | }
22 |
23 | if (total > 0 && incidents.length === total) {
24 | return;
25 | }
26 |
27 | setLoading(true);
28 |
29 | const response = await api.get("incidents", {
30 | params: { page }
31 | });
32 |
33 | setIncidents([...incidents, ...response.data]);
34 | setTotal(response.headers["x-total-count"]);
35 | setPage(page + 1);
36 | setLoading(false);
37 | }
38 |
39 | useEffect(() => {
40 | loadIncidents();
41 | }, []);
42 |
43 | function navigateToDetail(incident) {
44 | navigation.navigate("Detail", { incident });
45 | }
46 |
47 | return (
48 |
49 |
50 |
51 |
52 | Total de {total} casos.
53 |
54 |
55 |
56 | Bem vindo!
57 |
58 | Escolha um dos casos abaixo e salve o dia.
59 |
60 |
61 | String(incident.id)}
65 | // showsVerticalScrollIndicator={false}
66 | onEndReached={loadIncidents}
67 | onEndReachedThreshold={0.2}
68 | renderItem={({ item: incident }) => (
69 |
70 | ONG:
71 | {incident.name}
72 |
73 | CASO:
74 | {incident.description}
75 |
76 | VALOR:
77 |
78 | {Intl.NumberFormat("pt-BR", {
79 | style: "currency",
80 | currency: "BRL"
81 | }).format(incident.value)}
82 |
83 |
84 | navigateToDetail(incident)}
87 | >
88 | Ver mais detalhes
89 |
90 |
91 |
92 | )}
93 | />
94 |
95 | );
96 | }
97 |
--------------------------------------------------------------------------------
/.github/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontend/src/assets/logo.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | :construction: 🚀 Semana OmniStack 11.0 In progress.. :construction:
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | [](https://app.netlify.com/sites/be-the-super-hero/deploys)
34 |
35 |
36 | Project |
37 | Technologies |
38 | Layout |
39 | How to contribute |
40 | License
41 |
42 |
43 | ## 💻 Project
44 |
45 | Be The Hero is a project that aims to connect people who are willing to help ONGs.
46 |
47 |
48 |
49 |
50 |
51 | ## :rocket: Technologies
52 |
53 | This project was developed with the following technologies:
54 |
55 | - [Node.js](https://nodejs.org/en/)
56 | - [React](https://reactjs.org)
57 | - [React Native](https://facebook.github.io/react-native/)
58 | - [Expo](https://expo.io/)
59 |
60 | ## 🔖 Layout
61 |
62 | Para acessar o layout utilize a ferramenta [Figma](https://www.figma.com/file/2C2yvw7jsCOGmaNUDftX9n/Be-The-Hero---OmniStack-11?node-id=0%3A1).
63 |
64 | ## 🤔 How to contribute
65 |
66 | - Make a fork;
67 | - Create a branck with your feature: `git checkout -b my-feature`;
68 | - Commit changes: `git commit -m 'feat: My new feature'`;
69 | - Make a push to your branch: `git push origin my-feature`.
70 |
71 | After merging your receipt request to done, you can delete a branch from yours.
72 |
73 | ## 🎁 Marketing
74 |
75 | Acompanhei a Semana Omnistack 11 da Rocketseat e fiz projeto e hospedei o Backend no Heroku, Frontend no Netlify e Aplicativo no Google Play e todo o código no Github.
76 |
77 | Seguem os links:
78 | - [API Backend](https://be-the-super-hero.herokuapp.com/ongs)
79 | - [Frontend](https://be-the-super-hero.netlify.com/)
80 | - [App Google Play](https://play.google.com/store/apps/details?id=com.bethesuperhero)
81 | - [Código](https://github.com/tgmarinho/be-the-hero)
82 |
83 | #api #nodejs #backend #frontend #react #reactnative #appdeveloper #googleplay #heroku #netlify #rocketseat #omnistack #gostack #developer
84 |
85 |
86 | ## :memo: License
87 |
88 | This project is under the MIT license. See the [LICENSE](LICENSE.md) for details.
89 |
90 | ---
91 |
92 | Made with ♥ by Thiago Marinho :wave: [Get in touch!](https://www.linkedin.com/in/tgmarinho/)
93 |
--------------------------------------------------------------------------------
/backend/jest.config.js:
--------------------------------------------------------------------------------
1 | // For a detailed explanation regarding each configuration property, visit:
2 | // https://jestjs.io/docs/en/configuration.html
3 |
4 | module.exports = {
5 | // All imported modules in your tests should be mocked automatically
6 | // automock: false,
7 |
8 | // Stop running tests after `n` failures
9 | // bail: 0,
10 |
11 | // Respect "browser" field in package.json when resolving modules
12 | // browser: false,
13 |
14 | // The directory where Jest should store its cached dependency information
15 | // cacheDirectory: "/private/var/folders/4s/lh22vhl50wn202th6x39pt380000gn/T/jest_dx",
16 |
17 | // Automatically clear mock calls and instances between every test
18 | clearMocks: true,
19 |
20 | // Indicates whether the coverage information should be collected while executing the test
21 | // collectCoverage: false,
22 |
23 | // An array of glob patterns indicating a set of files for which coverage information should be collected
24 | // collectCoverageFrom: undefined,
25 |
26 | // The directory where Jest should output its coverage files
27 | // coverageDirectory: undefined,
28 |
29 | // An array of regexp pattern strings used to skip coverage collection
30 | // coveragePathIgnorePatterns: [
31 | // "/node_modules/"
32 | // ],
33 |
34 | // A list of reporter names that Jest uses when writing coverage reports
35 | // coverageReporters: [
36 | // "json",
37 | // "text",
38 | // "lcov",
39 | // "clover"
40 | // ],
41 |
42 | // An object that configures minimum threshold enforcement for coverage results
43 | // coverageThreshold: undefined,
44 |
45 | // A path to a custom dependency extractor
46 | // dependencyExtractor: undefined,
47 |
48 | // Make calling deprecated APIs throw helpful error messages
49 | // errorOnDeprecated: false,
50 |
51 | // Force coverage collection from ignored files using an array of glob patterns
52 | // forceCoverageMatch: [],
53 |
54 | // A path to a module which exports an async function that is triggered once before all test suites
55 | // globalSetup: undefined,
56 |
57 | // A path to a module which exports an async function that is triggered once after all test suites
58 | // globalTeardown: undefined,
59 |
60 | // A set of global variables that need to be available in all test environments
61 | // globals: {},
62 |
63 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64 | // maxWorkers: "50%",
65 |
66 | // An array of directory names to be searched recursively up from the requiring module's location
67 | // moduleDirectories: [
68 | // "node_modules"
69 | // ],
70 |
71 | // An array of file extensions your modules use
72 | // moduleFileExtensions: [
73 | // "js",
74 | // "json",
75 | // "jsx",
76 | // "ts",
77 | // "tsx",
78 | // "node"
79 | // ],
80 |
81 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
82 | // moduleNameMapper: {},
83 |
84 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
85 | // modulePathIgnorePatterns: [],
86 |
87 | // Activates notifications for test results
88 | // notify: false,
89 |
90 | // An enum that specifies notification mode. Requires { notify: true }
91 | // notifyMode: "failure-change",
92 |
93 | // A preset that is used as a base for Jest's configuration
94 | // preset: undefined,
95 |
96 | // Run tests from one or more projects
97 | // projects: undefined,
98 |
99 | // Use this configuration option to add custom reporters to Jest
100 | // reporters: undefined,
101 |
102 | // Automatically reset mock state between every test
103 | // resetMocks: false,
104 |
105 | // Reset the module registry before running each individual test
106 | // resetModules: false,
107 |
108 | // A path to a custom resolver
109 | // resolver: undefined,
110 |
111 | // Automatically restore mock state between every test
112 | // restoreMocks: false,
113 |
114 | // The root directory that Jest should scan for tests and modules within
115 | // rootDir: undefined,
116 |
117 | // A list of paths to directories that Jest should use to search for files in
118 | // roots: [
119 | // ""
120 | // ],
121 |
122 | // Allows you to use a custom runner instead of Jest's default test runner
123 | // runner: "jest-runner",
124 |
125 | // The paths to modules that run some code to configure or set up the testing environment before each test
126 | // setupFiles: [],
127 |
128 | // A list of paths to modules that run some code to configure or set up the testing framework before each test
129 | // setupFilesAfterEnv: [],
130 |
131 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing
132 | // snapshotSerializers: [],
133 |
134 | // The test environment that will be used for testing
135 | testEnvironment: "node",
136 |
137 | // Options that will be passed to the testEnvironment
138 | // testEnvironmentOptions: {},
139 |
140 | // Adds a location field to test results
141 | // testLocationInResults: false,
142 |
143 | // The glob patterns Jest uses to detect test files
144 | // testMatch: [
145 | // "**/__tests__/**/*.[jt]s?(x)",
146 | // "**/?(*.)+(spec|test).[tj]s?(x)"
147 | // ],
148 |
149 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
150 | // testPathIgnorePatterns: [
151 | // "/node_modules/"
152 | // ],
153 |
154 | // The regexp pattern or array of patterns that Jest uses to detect test files
155 | // testRegex: [],
156 |
157 | // This option allows the use of a custom results processor
158 | // testResultsProcessor: undefined,
159 |
160 | // This option allows use of a custom test runner
161 | // testRunner: "jasmine2",
162 |
163 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
164 | // testURL: "http://localhost",
165 |
166 | // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
167 | // timers: "real",
168 |
169 | // A map from regular expressions to paths to transformers
170 | // transform: undefined,
171 |
172 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
173 | // transformIgnorePatterns: [
174 | // "/node_modules/"
175 | // ],
176 |
177 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
178 | // unmockedModulePathPatterns: undefined,
179 |
180 | // Indicates whether each individual test should be reported during the run
181 | // verbose: undefined,
182 |
183 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
184 | // watchPathIgnorePatterns: [],
185 |
186 | // Whether to use watchman for file crawling
187 | // watchman: true,
188 | };
189 |
--------------------------------------------------------------------------------
/Insomnia_2020-03-24.json:
--------------------------------------------------------------------------------
1 | {
2 | "_type": "export",
3 | "__export_format": 4,
4 | "__export_date": "2020-03-24T20:30:29.017Z",
5 | "__export_source": "insomnia.desktop.app:v7.0.6",
6 | "resources": [
7 | {
8 | "_id": "req_d0345eab87d248b3813eb14692e78b45",
9 | "authentication": {},
10 | "body": {
11 | "mimeType": "application/json",
12 | "text": "{\n\t\"id\": \"{% response 'body', 'req_aa29252a9d734a159bf98fccbf8e9273', 'b64::JFswXS5pZA==::46b', 'always' %}\"\n}"
13 | },
14 | "created": 1585081027899,
15 | "description": "",
16 | "headers": [
17 | {
18 | "id": "pair_c87321b3563e4c19954c8eb6f97cdc9d",
19 | "name": "Content-Type",
20 | "value": "application/json"
21 | }
22 | ],
23 | "isPrivate": false,
24 | "metaSortKey": -1583143283732.25,
25 | "method": "POST",
26 | "modified": 1585081268697,
27 | "name": "LOGIN",
28 | "parameters": [],
29 | "parentId": "fld_e1ca9190c8e2443faf1d8a2c71607aaf",
30 | "settingDisableRenderRequestBody": false,
31 | "settingEncodeUrl": true,
32 | "settingFollowRedirects": "global",
33 | "settingRebuildPath": true,
34 | "settingSendCookies": true,
35 | "settingStoreCookies": true,
36 | "url": "{{ base_url }}/{{ resource }}",
37 | "_type": "request"
38 | },
39 | {
40 | "_id": "fld_e1ca9190c8e2443faf1d8a2c71607aaf",
41 | "created": 1585081103166,
42 | "description": "",
43 | "environment": { "resource": "sessions" },
44 | "environmentPropertyOrder": { "&": ["resource"] },
45 | "metaSortKey": -1585081103166,
46 | "modified": 1585081148396,
47 | "name": "Session",
48 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
49 | "_type": "request_group"
50 | },
51 | {
52 | "_id": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
53 | "created": 1585062435907,
54 | "description": "",
55 | "modified": 1585062435907,
56 | "name": "Omnistack11",
57 | "parentId": null,
58 | "_type": "workspace"
59 | },
60 | {
61 | "_id": "req_a79db039374845ababc0e18f75563e75",
62 | "authentication": {},
63 | "body": {},
64 | "created": 1585080808128,
65 | "description": "",
66 | "headers": [
67 | {
68 | "description": "",
69 | "id": "pair_b352871c9011427099a8b24e504fc564",
70 | "name": "Authorization",
71 | "value": "{% response 'body', 'req_aa29252a9d734a159bf98fccbf8e9273', 'b64::JFswXS5pZA==::46b', 'always' %}"
72 | }
73 | ],
74 | "isPrivate": false,
75 | "metaSortKey": -1583143283744.75,
76 | "method": "GET",
77 | "modified": 1585080888862,
78 | "name": "ONG INCIDENT",
79 | "parameters": [],
80 | "parentId": "fld_2e370ec4855740dca099dda9bb6d0c20",
81 | "settingDisableRenderRequestBody": false,
82 | "settingEncodeUrl": true,
83 | "settingFollowRedirects": "global",
84 | "settingRebuildPath": true,
85 | "settingSendCookies": true,
86 | "settingStoreCookies": true,
87 | "url": "{{ base_url }}/{{ resource }}",
88 | "_type": "request"
89 | },
90 | {
91 | "_id": "fld_2e370ec4855740dca099dda9bb6d0c20",
92 | "created": 1585080782862,
93 | "description": "",
94 | "environment": { "resource": "profile" },
95 | "environmentPropertyOrder": { "&": ["resource"] },
96 | "metaSortKey": -1585080782862,
97 | "modified": 1585080828734,
98 | "name": "Profile",
99 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
100 | "_type": "request_group"
101 | },
102 | {
103 | "_id": "req_d5e2810637e14731b6fa04b84e6f9899",
104 | "authentication": {},
105 | "body": {
106 | "mimeType": "application/json",
107 | "text": "{\n\t\"name\": \"{% uuid 'v4' %}\",\n\t\"email\": \"{% uuid 'v4' %}\",\n\t\"whatsapp\": \"00000000000\",\n\t\"city\": \"Okazaki\",\n\t\"uf\": \"JP\"\n}"
108 | },
109 | "created": 1585062497139,
110 | "description": "",
111 | "headers": [
112 | {
113 | "id": "pair_5c7aa08cb14f46d39cb2f81dcd858c6d",
114 | "name": "Content-Type",
115 | "value": "application/json"
116 | }
117 | ],
118 | "isPrivate": false,
119 | "metaSortKey": -1585062497139,
120 | "method": "POST",
121 | "modified": 1585068392862,
122 | "name": "CREATE ONGs",
123 | "parameters": [],
124 | "parentId": "fld_e42ab4eac4054b67b9ce38d13ace98f1",
125 | "settingDisableRenderRequestBody": false,
126 | "settingEncodeUrl": true,
127 | "settingFollowRedirects": "global",
128 | "settingRebuildPath": true,
129 | "settingSendCookies": true,
130 | "settingStoreCookies": true,
131 | "url": "{{ base_url }}/{{ resource }}",
132 | "_type": "request"
133 | },
134 | {
135 | "_id": "fld_e42ab4eac4054b67b9ce38d13ace98f1",
136 | "created": 1585062482437,
137 | "description": "",
138 | "environment": { "resource": "ongs" },
139 | "environmentPropertyOrder": { "&": ["resource"] },
140 | "metaSortKey": -1585062482437,
141 | "modified": 1585068383888,
142 | "name": "ONGS",
143 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
144 | "_type": "request_group"
145 | },
146 | {
147 | "_id": "req_cdf8a55cbfcd48a49e9e72f1914c7fc2",
148 | "authentication": {},
149 | "body": { "mimeType": "application/json", "text": "" },
150 | "created": 1585062506735,
151 | "description": "",
152 | "headers": [
153 | {
154 | "id": "pair_5c7aa08cb14f46d39cb2f81dcd858c6d",
155 | "name": "Content-Type",
156 | "value": "application/json"
157 | }
158 | ],
159 | "isPrivate": false,
160 | "metaSortKey": -1583783021559.5,
161 | "method": "PUT",
162 | "modified": 1585062539096,
163 | "name": "UPDATE ONGs",
164 | "parameters": [],
165 | "parentId": "fld_e42ab4eac4054b67b9ce38d13ace98f1",
166 | "settingDisableRenderRequestBody": false,
167 | "settingEncodeUrl": true,
168 | "settingFollowRedirects": "global",
169 | "settingRebuildPath": true,
170 | "settingSendCookies": true,
171 | "settingStoreCookies": true,
172 | "url": "",
173 | "_type": "request"
174 | },
175 | {
176 | "_id": "req_aa29252a9d734a159bf98fccbf8e9273",
177 | "authentication": {},
178 | "body": {},
179 | "created": 1585062521339,
180 | "description": "",
181 | "headers": [],
182 | "isPrivate": false,
183 | "metaSortKey": -1583143283769.75,
184 | "method": "GET",
185 | "modified": 1585074750961,
186 | "name": "LIST ONGs",
187 | "parameters": [],
188 | "parentId": "fld_e42ab4eac4054b67b9ce38d13ace98f1",
189 | "settingDisableRenderRequestBody": false,
190 | "settingEncodeUrl": true,
191 | "settingFollowRedirects": "global",
192 | "settingRebuildPath": true,
193 | "settingSendCookies": true,
194 | "settingStoreCookies": true,
195 | "url": "{{ base_url }}/{{ resource }}",
196 | "_type": "request"
197 | },
198 | {
199 | "_id": "req_396fff25bbf14abd8ba628b392f7ddca",
200 | "authentication": {},
201 | "body": {
202 | "mimeType": "application/json",
203 | "text": "{\n\t\"description\": \"asdfasfdasfsafsafd\",\n\t\"title\": \"teste\",\n\t\"value\": 150\n}"
204 | },
205 | "created": 1585074565727,
206 | "description": "",
207 | "headers": [
208 | {
209 | "description": "",
210 | "id": "pair_0a2091863ee74596b440d627e3e1210d",
211 | "name": "Content-Type",
212 | "value": "application/json"
213 | },
214 | {
215 | "description": "",
216 | "id": "pair_73aeb301f8ad4fa793eec5270ddcd114",
217 | "name": "authorization",
218 | "value": "d8e081b52301a558c58ccb10a5b0c8c1"
219 | }
220 | ],
221 | "isPrivate": false,
222 | "metaSortKey": -1585062497139,
223 | "method": "POST",
224 | "modified": 1585075984359,
225 | "name": "CREATE INCIDENT",
226 | "parameters": [],
227 | "parentId": "fld_7f57682471874b83891fc6b795da66f9",
228 | "settingDisableRenderRequestBody": false,
229 | "settingEncodeUrl": true,
230 | "settingFollowRedirects": "global",
231 | "settingRebuildPath": true,
232 | "settingSendCookies": true,
233 | "settingStoreCookies": true,
234 | "url": "{{ base_url }}/{{ resource }}",
235 | "_type": "request"
236 | },
237 | {
238 | "_id": "fld_7f57682471874b83891fc6b795da66f9",
239 | "created": 1585074565722,
240 | "description": "",
241 | "environment": { "resource": "incidents" },
242 | "environmentPropertyOrder": { "&": ["resource"] },
243 | "metaSortKey": -1583308336635.5,
244 | "modified": 1585074617705,
245 | "name": "Incidents",
246 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
247 | "_type": "request_group"
248 | },
249 | {
250 | "_id": "req_baacde76f7354989a8f33b9657a98aee",
251 | "authentication": {},
252 | "body": { "mimeType": "application/json", "text": "" },
253 | "created": 1585074565732,
254 | "description": "",
255 | "headers": [
256 | {
257 | "id": "pair_5c7aa08cb14f46d39cb2f81dcd858c6d",
258 | "name": "Content-Type",
259 | "value": "application/json"
260 | }
261 | ],
262 | "isPrivate": false,
263 | "metaSortKey": -1583783021559.5,
264 | "method": "PUT",
265 | "modified": 1585074586196,
266 | "name": "UPDATE INCIDENT",
267 | "parameters": [],
268 | "parentId": "fld_7f57682471874b83891fc6b795da66f9",
269 | "settingDisableRenderRequestBody": false,
270 | "settingEncodeUrl": true,
271 | "settingFollowRedirects": "global",
272 | "settingRebuildPath": true,
273 | "settingSendCookies": true,
274 | "settingStoreCookies": true,
275 | "url": "",
276 | "_type": "request"
277 | },
278 | {
279 | "_id": "req_a2f88e69acd548d48811d4f9cf0a218f",
280 | "authentication": {},
281 | "body": {},
282 | "created": 1585074565738,
283 | "description": "",
284 | "headers": [],
285 | "isPrivate": false,
286 | "metaSortKey": -1583143283769.75,
287 | "method": "GET",
288 | "modified": 1585081418280,
289 | "name": "LIST INCIDENTS",
290 | "parameters": [],
291 | "parentId": "fld_7f57682471874b83891fc6b795da66f9",
292 | "settingDisableRenderRequestBody": false,
293 | "settingEncodeUrl": true,
294 | "settingFollowRedirects": "global",
295 | "settingRebuildPath": true,
296 | "settingSendCookies": true,
297 | "settingStoreCookies": true,
298 | "url": "{{ base_url }}/{{ resource }}?page=1",
299 | "_type": "request"
300 | },
301 | {
302 | "_id": "req_ee96276120f7497fa4aa9a82fa05b238",
303 | "authentication": {},
304 | "body": {},
305 | "created": 1585080404689,
306 | "description": "",
307 | "headers": [
308 | {
309 | "description": "",
310 | "id": "pair_73aeb301f8ad4fa793eec5270ddcd114",
311 | "name": "authorization",
312 | "value": "d8e081b52301a558c58ccb10a5b0c8c1"
313 | }
314 | ],
315 | "isPrivate": false,
316 | "metaSortKey": -1583143283719.75,
317 | "method": "DELETE",
318 | "modified": 1585080539923,
319 | "name": "DELETE INCIDENT",
320 | "parameters": [],
321 | "parentId": "fld_7f57682471874b83891fc6b795da66f9",
322 | "settingDisableRenderRequestBody": false,
323 | "settingEncodeUrl": true,
324 | "settingFollowRedirects": "global",
325 | "settingRebuildPath": true,
326 | "settingSendCookies": true,
327 | "settingStoreCookies": true,
328 | "url": "{{ base_url }}/{{ resource }}/{% response 'body', 'req_396fff25bbf14abd8ba628b392f7ddca', 'b64::JC5pZA==::46b', 'always' %}",
329 | "_type": "request"
330 | },
331 | {
332 | "_id": "env_74b77e3a1f681f1a92efee92e9d013f6bfdbddfe",
333 | "color": null,
334 | "created": 1585062435955,
335 | "data": { "base_url": "http://localhost:3333" },
336 | "dataPropertyOrder": { "&": ["base_url"] },
337 | "isPrivate": false,
338 | "metaSortKey": 1585062435955,
339 | "modified": 1585062462125,
340 | "name": "Base Environment",
341 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
342 | "_type": "environment"
343 | },
344 | {
345 | "_id": "jar_74b77e3a1f681f1a92efee92e9d013f6bfdbddfe",
346 | "cookies": [],
347 | "created": 1585062435957,
348 | "modified": 1585062435957,
349 | "name": "Default Jar",
350 | "parentId": "wrk_52f6eb05b6b4497fa2c56e786dc53e16",
351 | "_type": "cookie_jar"
352 | }
353 | ]
354 | }
355 |
--------------------------------------------------------------------------------