├── frontend ├── README.md ├── public │ ├── _redirects │ ├── robots.txt │ ├── close.png │ ├── edit.png │ ├── logo.png │ ├── menu.png │ ├── user.png │ ├── camera.png │ ├── default.png │ ├── delete.png │ ├── favicon.ico │ ├── logo16.png │ ├── logo192.png │ ├── logo24.png │ ├── logo32.png │ ├── logo512.png │ ├── logo64.png │ ├── add_button.png │ ├── animales.png │ ├── manifest.json │ ├── index.html │ ├── bootstrap-4.6.0-dist │ │ └── css │ │ │ ├── bootstrap-reboot.min.css │ │ │ └── bootstrap-reboot.css │ ├── firebase-messaging-sw.js │ └── js │ │ └── popper.min.js ├── .directory ├── .netlify │ └── state.json ├── src │ ├── Utils │ │ └── Bus.js │ ├── background.png │ ├── TEXTURA 3-01.png │ ├── TEXTURA 4-01.png │ ├── TEXTURA 5-01.png │ ├── TEXTURA 6-01.png │ ├── Components │ │ ├── Layout │ │ │ ├── Logo │ │ │ │ ├── Logo.css │ │ │ │ └── Logo.js │ │ │ ├── FilterForm │ │ │ │ ├── FilterForm.css │ │ │ │ └── FilterForm.js │ │ │ ├── Card │ │ │ │ ├── Card.css │ │ │ │ └── Card.js │ │ │ ├── Backdrop │ │ │ │ ├── Backdrop.css │ │ │ │ └── Backdrop.js │ │ │ ├── Error │ │ │ │ └── Error.js │ │ │ ├── Spinner │ │ │ │ ├── Spinner.js │ │ │ │ └── Spinner.css │ │ │ ├── Layout.css │ │ │ ├── NavigationItems │ │ │ │ ├── NavigationItems.css │ │ │ │ ├── NavigationItem │ │ │ │ │ ├── NavigationItem.js │ │ │ │ │ └── NavigationItem.css │ │ │ │ └── Navigationitems.js │ │ │ ├── Toolbar │ │ │ │ ├── Toolbar.js │ │ │ │ └── Toolbar.css │ │ │ ├── Modal │ │ │ │ ├── Modal.css │ │ │ │ └── Modal.js │ │ │ ├── SideDrawer │ │ │ │ ├── SideDrawer.css │ │ │ │ └── SideDrawer.js │ │ │ ├── Layout.js │ │ │ ├── PictureModal │ │ │ │ └── PictureModal.js │ │ │ ├── Input │ │ │ │ └── Input.js │ │ │ ├── UserIcon │ │ │ │ └── UserIcon.js │ │ │ ├── PostsTabs │ │ │ │ └── PostsTabs.js │ │ │ └── MenuIcon │ │ │ │ └── MenuIcon.js │ │ ├── AboutUs │ │ │ ├── AboutUs.css │ │ │ └── AboutUs.js │ │ ├── TopHeader │ │ │ ├── TopHeader.css │ │ │ └── TopHeader.js │ │ ├── Footer │ │ │ ├── Footer.css │ │ │ └── Footer.js │ │ ├── Flash │ │ │ ├── Flash.css │ │ │ └── Flash.js │ │ ├── PostDetails │ │ │ ├── PostDetails.css │ │ │ └── PostDetails.js │ │ ├── Posts │ │ │ ├── Posts.css │ │ │ ├── Post │ │ │ │ ├── Post.css │ │ │ │ └── Post.js │ │ │ └── Posts.js │ │ ├── NewPost │ │ │ ├── NewPost.css │ │ │ └── NewPost.js │ │ ├── MyPosts │ │ │ └── MyPosts.js │ │ ├── Authentication │ │ │ ├── Login.js │ │ │ └── Register.js │ │ └── EditPost │ │ │ └── EditPost.js │ ├── setupTests.js │ ├── App.test.js │ ├── store │ │ ├── actions.js │ │ └── reducer.js │ ├── reportWebVitals.js │ ├── index.css │ ├── App.css │ ├── Constants │ │ └── constants.js │ ├── App.js │ ├── index.js │ └── logo.svg └── package.json ├── backend ├── static │ └── pictures │ │ └── .gitinclude ├── controllers │ └── controller.js ├── jsconfig.json ├── models │ ├── token.js │ ├── user.js │ └── alert.js ├── managers │ ├── user-manager.js │ ├── token-manager.js │ ├── manager.js │ └── alert-manager.js ├── test │ ├── data │ │ └── data.js │ ├── cleaner.js │ ├── manual-test.js │ ├── data-access │ │ └── user.js │ └── endpoints │ │ ├── token.js │ │ ├── user.js │ │ └── alert.js ├── config │ ├── constant.js │ └── mongoose.js ├── README.md ├── package.json ├── repositories │ └── repository.js └── index.js ├── push-notification-test ├── private-key.txt ├── key-pair.txt ├── server-key.txt ├── package.json ├── firebase.js ├── request-notification-template.txt ├── firebase-messaging-sw.js ├── firebase-script.html └── yarn.lock ├── .directory ├── .github └── workflows │ └── backend-test.yml ├── LICENSE ├── .gitignore ├── README.md └── CONTRIBUTING.md /frontend/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/static/pictures/.gitinclude: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/public/_redirects: -------------------------------------------------------------------------------- 1 | /* /index.html 200 -------------------------------------------------------------------------------- /backend/controllers/controller.js: -------------------------------------------------------------------------------- 1 | import { get } from "mongoose"; 2 | -------------------------------------------------------------------------------- /push-notification-test/private-key.txt: -------------------------------------------------------------------------------- 1 | OSwKRaPU17JdUQwgol8iTORvPyd-PKskVX_A5FT2bZ8 -------------------------------------------------------------------------------- /.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2021,5,19,16,4,4 3 | Version=4 4 | ViewMode=1 5 | -------------------------------------------------------------------------------- /frontend/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | Timestamp=2021,5,13,17,0,1 3 | Version=4 4 | ViewMode=1 5 | -------------------------------------------------------------------------------- /frontend/.netlify/state.json: -------------------------------------------------------------------------------- 1 | { 2 | "siteId": "f0f3f40c-3b55-4d72-af81-79b279347fbc" 3 | } -------------------------------------------------------------------------------- /frontend/src/Utils/Bus.js: -------------------------------------------------------------------------------- 1 | import EventEmitter from "events" 2 | 3 | export default new EventEmitter() -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/public/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/close.png -------------------------------------------------------------------------------- /frontend/public/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/edit.png -------------------------------------------------------------------------------- /frontend/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo.png -------------------------------------------------------------------------------- /frontend/public/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/menu.png -------------------------------------------------------------------------------- /frontend/public/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/user.png -------------------------------------------------------------------------------- /frontend/public/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/camera.png -------------------------------------------------------------------------------- /frontend/public/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/default.png -------------------------------------------------------------------------------- /frontend/public/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/delete.png -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/logo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo16.png -------------------------------------------------------------------------------- /frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo192.png -------------------------------------------------------------------------------- /frontend/public/logo24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo24.png -------------------------------------------------------------------------------- /frontend/public/logo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo32.png -------------------------------------------------------------------------------- /frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo512.png -------------------------------------------------------------------------------- /frontend/public/logo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/logo64.png -------------------------------------------------------------------------------- /frontend/src/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/src/background.png -------------------------------------------------------------------------------- /frontend/public/add_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/add_button.png -------------------------------------------------------------------------------- /frontend/public/animales.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/public/animales.png -------------------------------------------------------------------------------- /frontend/src/TEXTURA 3-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/src/TEXTURA 3-01.png -------------------------------------------------------------------------------- /frontend/src/TEXTURA 4-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/src/TEXTURA 4-01.png -------------------------------------------------------------------------------- /frontend/src/TEXTURA 5-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/src/TEXTURA 5-01.png -------------------------------------------------------------------------------- /frontend/src/TEXTURA 6-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tribilin-cuba/to-the-rescue/HEAD/frontend/src/TEXTURA 6-01.png -------------------------------------------------------------------------------- /push-notification-test/key-pair.txt: -------------------------------------------------------------------------------- 1 | BAq83TbJIFswfdiiTny27GwlEr6SJF-CMUvF2iuK8V7_wOqMXpT8k5TgtQkXLFWhwjMDf81Ez9ks1kGANUdJ0AU -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Logo/Logo.css: -------------------------------------------------------------------------------- 1 | .Logo { 2 | background-color: white; 3 | padding: 8px; 4 | height: 100%; 5 | } 6 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/FilterForm/FilterForm.css: -------------------------------------------------------------------------------- 1 | .filter-header { 2 | font-weight: bold; 3 | color: #edc00f; 4 | border-bottom: 1px solid lightgray; 5 | } 6 | -------------------------------------------------------------------------------- /push-notification-test/server-key.txt: -------------------------------------------------------------------------------- 1 | AAAAFK1fL-w:APA91bHZgYm-eIXt95rBvIuoWCOGX3W6DqudtmskiW2KDnVHOZMExApFBDf7N-U2mibj76zNFjISy1FHLtCdW91cAnghozk0UBYZnBvV7HUwVTHg_EJMP2pEuR1V_MujVuTzpqx5RIof -------------------------------------------------------------------------------- /frontend/src/Components/AboutUs/AboutUs.css: -------------------------------------------------------------------------------- 1 | .about-us-div { 2 | display: flex; 3 | justify-content: flex-start; 4 | } 5 | .about-us-div h5 { 6 | color: #edc00f; 7 | font-weight: bold; 8 | } 9 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Card/Card.css: -------------------------------------------------------------------------------- 1 | .Card { 2 | width: 100%; 3 | height: 90px; 4 | margin-top: 15px; 5 | border-radius: 10px 10px 0px 10px; 6 | background-color: white; 7 | border: lightgray solid 1px; 8 | } 9 | -------------------------------------------------------------------------------- /push-notification-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "push-notification-test", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "firebase": "^8.4.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Backdrop/Backdrop.css: -------------------------------------------------------------------------------- 1 | .Backdrop { 2 | width: 100%; 3 | height: 100%; 4 | position: fixed; 5 | z-index: 100; 6 | left: 0; 7 | top: 0; 8 | background-color: rgba(0, 0, 0, 0.5); 9 | } 10 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Backdrop/Backdrop.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import "./Backdrop.css" 3 | const backdrop = (props) => ( 4 | props.show ?
: null 5 | ) 6 | 7 | export default backdrop -------------------------------------------------------------------------------- /backend/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "./**/*" 4 | ], 5 | "compilerOptions": { 6 | "target": "esnext", 7 | "module": "es2015", 8 | "allowSyntheticDefaultImports": true, 9 | "experimentalDecorators": true 10 | } 11 | } -------------------------------------------------------------------------------- /frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Error/Error.js: -------------------------------------------------------------------------------- 1 | import { Alert } from "react-bootstrap"; 2 | 3 | function Error({ message }) { 4 | return ( 5 | 6 |

Ups algo salio mal: {message}

7 |
8 | ) 9 | } 10 | export default Error -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Card/Card.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import "./Card.css" 3 | 4 | const card = (props) => ( 5 |
6 |
7 | {props.children} 8 |
9 |
10 | ) 11 | 12 | export default card -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Spinner/Spinner.js: -------------------------------------------------------------------------------- 1 | import "./Spinner.css" 2 | function Spinner() { 3 | return ( 4 |
5 |
Cargando...
6 |
7 | ) 8 | } 9 | 10 | export default Spinner -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Layout.css: -------------------------------------------------------------------------------- 1 | .Content { 2 | margin-top: 65px; 3 | margin-left: 15px; 4 | margin-right: 15px; 5 | margin-bottom: 15px; 6 | font-family: Verdana, Geneva, Tahoma, sans-serif; 7 | color: #464646; 8 | overflow-x: hidden; 9 | overflow: hidden; 10 | max-width: 100%; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Logo/Logo.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import "./Logo.css" 3 | 4 | const logo = (props) => ( 5 |
6 | Al Rescate 7 |
8 | ) 9 | 10 | export default logo; -------------------------------------------------------------------------------- /frontend/src/Components/TopHeader/TopHeader.css: -------------------------------------------------------------------------------- 1 | .TopHeader { 2 | width: 100%; 3 | } 4 | 5 | .TopHeaderDiv { 6 | width: 100%; 7 | } 8 | 9 | .TopHeaderText { 10 | color: #e27e22; 11 | margin-bottom: 7px !important; 12 | font-weight: bold; 13 | } 14 | 15 | .TopHeaderIcon { 16 | margin-left: 5px; 17 | } 18 | -------------------------------------------------------------------------------- /backend/models/token.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | var TokenSchema = new mongoose.Schema({ 4 | token:{ 5 | type: String, 6 | required: true 7 | }, 8 | user_id: { 9 | type: String 10 | } 11 | }) 12 | 13 | var TokenModel = mongoose.model('token', TokenSchema) 14 | 15 | export default TokenModel -------------------------------------------------------------------------------- /frontend/src/Components/Layout/NavigationItems/NavigationItems.css: -------------------------------------------------------------------------------- 1 | .NavigationItems { 2 | margin: 0; 3 | padding: 0; 4 | list-style: none; 5 | display: flex; 6 | align-items: center; 7 | flex-flow: column; 8 | height: 100%; 9 | } 10 | 11 | @media (min-width: 500px) { 12 | .NavigationItems { 13 | flex-flow: row; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /backend/managers/user-manager.js: -------------------------------------------------------------------------------- 1 | import UserModel from "../models/user.js"; 2 | import Repository from "../repositories/repository.js"; 3 | import Manager from "./manager.js"; 4 | 5 | class UserManager extends Manager{ 6 | 7 | constructor(){ 8 | super(new Repository(UserModel)) 9 | } 10 | 11 | } 12 | 13 | export default UserManager -------------------------------------------------------------------------------- /backend/test/data/data.js: -------------------------------------------------------------------------------- 1 | export const dummyUser = { 2 | firstName: 'John', 3 | lastName: 'Doe', 4 | email: 'john@doe.com' 5 | } 6 | 7 | export const dummyAlert = { 8 | author_id: '1', 9 | province: 'La Habana', 10 | municipality: 'Playa', 11 | alert_type: 'Perdido', 12 | description: 'Perrito en la esquina de 31 y 10' 13 | } -------------------------------------------------------------------------------- /backend/managers/token-manager.js: -------------------------------------------------------------------------------- 1 | import TokenModel from "../models/token.js"; 2 | import Repository from "../repositories/repository.js"; 3 | import Manager from "./manager.js"; 4 | 5 | class TokenManager extends Manager{ 6 | 7 | constructor(){ 8 | super(new Repository(TokenModel)) 9 | } 10 | 11 | } 12 | 13 | export default TokenManager -------------------------------------------------------------------------------- /frontend/src/Components/Footer/Footer.css: -------------------------------------------------------------------------------- 1 | .footer { 2 | position: fixed; 3 | bottom: 0; 4 | left: 0; 5 | width: 100%; 6 | background-color: rgb(255, 250, 238); 7 | padding: 5px; 8 | } 9 | 10 | .footer a { 11 | color: #e27e22; 12 | font-weight: bold; 13 | padding: 0.5rem; 14 | } 15 | 16 | .footer a:hover { 17 | color: rgb(44, 43, 43); 18 | } 19 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/NavigationItems/NavigationItem/NavigationItem.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Link } from "react-router-dom" 3 | import "./NavigationItem.css" 4 | 5 | const navigationItem = (props) => ( 6 |
  • 7 | {props.children} 8 |
  • 9 | ) 10 | 11 | export default navigationItem -------------------------------------------------------------------------------- /frontend/src/Components/Layout/NavigationItems/Navigationitems.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import "./NavigationItems.css" 3 | import NavigationItem from "./NavigationItem/NavigationItem" 4 | 5 | const navigationItems = (props) => ( 6 | 9 | ) 10 | 11 | export default navigationItems -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Toolbar/Toolbar.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import "./Toolbar.css" 3 | // import Logo from "../Logo/Logo" 4 | // import NavigationItems from "../NavigationItems/Navigationitems" 5 | 6 | const toolbar = (props) => ( 7 |
    8 | logo 9 |
    10 | ) 11 | 12 | export default toolbar -------------------------------------------------------------------------------- /frontend/src/store/actions.js: -------------------------------------------------------------------------------- 1 | 2 | export const POPULATE_POSTS = "POPULATE_POSTS" 3 | 4 | export const POPULATE_SELECTED_POST = "POPULATE_SELECTED_POST" 5 | 6 | export const UPDATE_NEW_POST_INPUT = "UPDATE_NEW_POST_INPUT" 7 | 8 | export const OPEN_SIDE_DRAWER = "OPEN_SIDE_DRAWER" 9 | 10 | export const CLOSE_SIDE_DRAWER = "CLOSE_SIDE_DRAWER" 11 | 12 | export const SET_USER_ID = "SET_USER_ID" 13 | 14 | export const LOG_OUT = "LOG_OUT" -------------------------------------------------------------------------------- /backend/config/constant.js: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | console.log(process.env.NODE_ENV); 5 | 6 | export const PICTURES_DIR = "/static/pictures" 7 | 8 | export const URL = process.env.URL && process.env.PORT ? 9 | process.env.URL + ':' + process.env.PORT : 10 | 'http://localhost:8080' 11 | 12 | export const TOY_DETA_KEY = 'b05adlw0_WSQqvBzkzp6x7XbJ6nQKA3Tx3C7nQQ6k' -------------------------------------------------------------------------------- /frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /backend/test/cleaner.js: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose" 2 | import MongooseConnection from "../config/mongoose.js" 3 | 4 | before((done) => { 5 | var connector = new MongooseConnection() 6 | connector.getConnection() 7 | 8 | while(connector.connection == null) 9 | continue 10 | 11 | connector.connection.dropDatabase() 12 | 13 | done() 14 | }) 15 | 16 | after((done) => { 17 | mongoose.disconnect(done) 18 | }) -------------------------------------------------------------------------------- /frontend/src/Components/Flash/Flash.css: -------------------------------------------------------------------------------- 1 | .alert { 2 | top: 50px; 3 | right: 10px; 4 | display: flex; 5 | justify-content: center; 6 | } 7 | .alert-success { 8 | background-color: #2ec871; 9 | color: white; 10 | font-weight: bold; 11 | } 12 | .alert-error { 13 | background-color: #e34c3c; 14 | color: white; 15 | font-weight: bold; 16 | } 17 | .alert-info { 18 | background-color: #e27e22; 19 | color: white; 20 | font-weight: bold; 21 | } 22 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Modal/Modal.css: -------------------------------------------------------------------------------- 1 | .Modal { 2 | position: fixed; 3 | z-index: 500; 4 | background-color: white; 5 | width: 100%; 6 | border: 1px solid #ccc; 7 | box-shadow: 1 1 1 black; 8 | padding: 16px; 9 | left: 15%; 10 | top: 30%; 11 | box-sizing: border-box; 12 | transition: all 0.3s ease-in-out; 13 | } 14 | 15 | @media (min-width: 600px) { 16 | .Modal { 17 | width: 500px; 18 | left: calc(50% - 250px); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/SideDrawer/SideDrawer.css: -------------------------------------------------------------------------------- 1 | .SideDrawer { 2 | position: fixed; 3 | width: 280px; 4 | max-width: 70%; 5 | height: 100%; 6 | left: 0; 7 | top: 0; 8 | z-index: 200; 9 | background-color: white; 10 | padding: 32px 16px; 11 | box-sizing: border-box; 12 | transition: transform 0.3s ease-out; 13 | } 14 | 15 | .Open { 16 | transform: translateX(45%); 17 | } 18 | 19 | .Close { 20 | transform: translateX(+500%); 21 | } 22 | 23 | .Logo { 24 | height: 11%; 25 | margin-bottom: 32px; 26 | } 27 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Layout.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import "./Layout.css" 3 | import Toolbar from "./Toolbar/Toolbar" 4 | import { Component } from "react"; 5 | 6 | class Layout extends Component { 7 | 8 | render() { 9 | return ( 10 | 11 | 12 |
    13 | {this.props.children} 14 |
    15 |
    16 | ) 17 | } 18 | 19 | } 20 | 21 | export default Layout -------------------------------------------------------------------------------- /backend/managers/manager.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Manager { 4 | 5 | constructor(repository){ 6 | this.repository = repository 7 | } 8 | 9 | 10 | insert(entry){ 11 | return this.repository.create(entry) 12 | } 13 | 14 | find(filters){ 15 | return this.repository.find(filters) 16 | } 17 | 18 | update(filters, newFields){ 19 | return this.repository.update(filters, newFields) 20 | } 21 | 22 | delete(filters){ 23 | return this.repository.remove(filters) 24 | } 25 | } 26 | 27 | export default Manager -------------------------------------------------------------------------------- /push-notification-test/firebase.js: -------------------------------------------------------------------------------- 1 | import firebase from "firebase"; 2 | import "firebase/analytics"; 3 | import "firebase/messaging"; 4 | 5 | var firebaseConfig = { 6 | apiKey: "AIzaSyCOl76atKnpcjHsrK6MknUXRBekDK_dJl8", 7 | authDomain: "to-the-rescue-4c250.firebaseapp.com", 8 | projectId: "to-the-rescue-4c250", 9 | storageBucket: "to-the-rescue-4c250.appspot.com", 10 | messagingSenderId: "88808042476", 11 | appId: "1:88808042476:web:b3d36e2fff4b43c5c05ac9", 12 | measurementId: "G-SE04L5SX65" 13 | }; 14 | 15 | firebase.initializeApp(firebaseConfig); -------------------------------------------------------------------------------- /backend/test/manual-test.js: -------------------------------------------------------------------------------- 1 | // import chai from 'chai' 2 | // import chaiHttp from 'chai-http' 3 | 4 | // import app from "../app.js" 5 | // import { dummyUser, dummyAlert } from "./data/data.js"; 6 | 7 | // const should = chai.should(); 8 | 9 | 10 | // chai.use(chaiHttp) 11 | 12 | // chai.request(app) 13 | // .get('/user/' + "60f33f011c988f549c8928e2") 14 | // .end((err, res) => { 15 | // res.should.have.status(200) 16 | // res.body.should.be.a('object') 17 | // res.body.firstName.should.be.equal(dummyUser.firstName) 18 | // done() 19 | // }) -------------------------------------------------------------------------------- /backend/README.md: -------------------------------------------------------------------------------- 1 | # "Al Rescate" API 2 | 3 | This is the API of "Al Rescate", a web application to help the animals that need us 4 | 5 | ## Setup 6 | 7 | You need to install MongoDb locally 8 | 9 | Then run ```yarn``` inside this directory and all the dependencies will be set up 10 | appropriately. 11 | 12 | ## Running the API locally 13 | 14 | Run ```yarn start``` and the API will be running in **http://localhost:8080**. 15 | 16 | To set another port change the PORT variable in the _.env_ file to the desired value. 17 | 18 | ## Running tests 19 | 20 | Run ```yarn test``` to run the tests 21 | -------------------------------------------------------------------------------- /frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Tribilin", 3 | "name": "Tribilin", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Modal/Modal.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react" 2 | import "./Modal.css" 3 | import Backdrop from "../Backdrop/Backdrop" 4 | 5 | 6 | const modal = (props) => ( 7 | 8 | 9 |
    15 | {props.children} 16 | 17 |
    18 |
    19 | ) 20 | 21 | export default modal -------------------------------------------------------------------------------- /frontend/src/Components/Layout/PictureModal/PictureModal.js: -------------------------------------------------------------------------------- 1 | import { Modal } from "react-bootstrap"; 2 | 3 | function PictureModal({ show, imgSrc, handleClose }) { 4 | return ( 5 | 6 | 7 | 8 |
    9 | details 10 |
    11 |
    12 |
    13 | ) 14 | } 15 | 16 | export default PictureModal -------------------------------------------------------------------------------- /.github/workflows/backend-test.yml: -------------------------------------------------------------------------------- 1 | name: Node CI 2 | 3 | on: [push, pull_request] 4 | 5 | defaults: 6 | run: 7 | working-directory: backend 8 | 9 | jobs: 10 | build-node: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v1 14 | - name: Use Node.js 14.x 15 | uses: actions/setup-node@v1 16 | with: 17 | node-version: 14.x 18 | - name: Start Docker for Mongodb 19 | run: docker run -d -p 27017:27017 mongo 20 | - name: yarn install and test 21 | run: | 22 | sudo yarn 23 | sudo yarn test 24 | env: 25 | CI: true -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Toolbar/Toolbar.css: -------------------------------------------------------------------------------- 1 | .Toolbar { 2 | height: 7%; 3 | width: 100%; 4 | position: fixed; 5 | top: 0; 6 | left: 0; 7 | background-color: white; 8 | display: flex; 9 | justify-content: center; 10 | padding: 0 20px; 11 | box-sizing: border-box; 12 | z-index: 90; 13 | /* border-bottom: solid 3px #cccccc; */ 14 | box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.2); 15 | } 16 | .Toolbar img { 17 | height: 40px; 18 | } 19 | 20 | .Toolbar nav { 21 | height: 100%; 22 | } 23 | 24 | .Logo { 25 | height: 80%; 26 | } 27 | 28 | @media (max-width: 499px) { 29 | .DesktopOnly { 30 | display: none; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /frontend/src/Components/PostDetails/PostDetails.css: -------------------------------------------------------------------------------- 1 | .posts-details-edit-button { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | background-color: #edc00f; 6 | border-radius: 50% 50% 50% 50%; 7 | height: 60px; 8 | width: 60px; 9 | margin-bottom: 5px; 10 | } 11 | .posts-details-delete-button { 12 | display: flex; 13 | align-items: center; 14 | justify-content: center; 15 | background-color: #e34c3c; 16 | border-radius: 50% 50% 50% 50%; 17 | height: 60px; 18 | width: 60px; 19 | } 20 | 21 | .posts-details-actions-div { 22 | position: fixed; 23 | bottom: 15px; 24 | right: 20px; 25 | z-index: 10; 26 | } 27 | -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: rgb(255, 250, 238); 3 | background-image: linear-gradient( 4 | rgba(255, 255, 255, 0.5), 5 | rgba(255, 255, 255, 0.5) 6 | ); 7 | background-attachment: fixed; 8 | background-size: cover; 9 | margin: 0; 10 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 11 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | -moz-osx-font-smoothing: grayscale; 15 | } 16 | 17 | code { 18 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 19 | monospace; 20 | } 21 | -------------------------------------------------------------------------------- /frontend/src/Components/Posts/Posts.css: -------------------------------------------------------------------------------- 1 | .PostsAddButton { 2 | width: 60px; 3 | position: fixed; 4 | bottom: 60px; 5 | right: 20px; 6 | z-index: 10; 7 | } 8 | .posts-filter-button { 9 | background-color: #e27e22 !important; 10 | border-color: #e27e22 !important; 11 | font-weight: bold; 12 | margin-bottom: 10px; 13 | height: 30px; 14 | } 15 | .posts-filter-button:focus { 16 | box-shadow: rgba(226, 126, 34, 0.5) 0px 0px 0px 3.2px !important; 17 | } 18 | .posts-filter-button:hover { 19 | background-color: #e27e22; 20 | border-color: #e27e22; 21 | } 22 | .post-tabs { 23 | color: #e27e22; 24 | } 25 | 26 | .no-alerts { 27 | font-style: italic; 28 | color: #464646; 29 | margin-top: 10px; 30 | } 31 | -------------------------------------------------------------------------------- /frontend/src/Components/Layout/SideDrawer/SideDrawer.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import "./SideDrawer.css" 3 | import Backdrop from "../Backdrop/Backdrop" 4 | import Logo from "../Logo/Logo" 5 | // import NavigationItems from "../NavigationItems/Navigationitems" 6 | 7 | const SideDrawer = (props) => { 8 | 9 | let attachedClasses = ["SideDrawer", "Close"] 10 | if (props.open) { 11 | attachedClasses = ["SideDrawer", "Open"] 12 | } 13 | return ( 14 |
    15 | 16 |
    17 |
    18 | 19 |
    20 |
    21 |
    22 | ) 23 | } 24 | export default SideDrawer -------------------------------------------------------------------------------- /frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | 36 | to { 37 | transform: rotate(360deg); 38 | } 39 | } 40 | 41 | .section { 42 | min-height: calc(100vh - 18rem); 43 | } -------------------------------------------------------------------------------- /backend/models/user.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | var UserSchema = new mongoose.Schema({ 4 | firstName: { 5 | type: String, 6 | maxLength: 30, 7 | required: false, 8 | }, 9 | 10 | lastName: { 11 | type: String, 12 | maxLength: 30, 13 | required: false, 14 | }, 15 | 16 | secondLastName: { 17 | type: String, 18 | maxLength: 30, 19 | required: false, 20 | }, 21 | 22 | email: { 23 | type: String, 24 | maxLength: 30, 25 | required: true, 26 | }, 27 | 28 | phone: { 29 | type: String, 30 | maxLength: 15, 31 | required: false, 32 | } 33 | }) 34 | 35 | var UserModel = mongoose.model('user', UserSchema) 36 | 37 | export default UserModel -------------------------------------------------------------------------------- /frontend/src/Constants/constants.js: -------------------------------------------------------------------------------- 1 | export const SERVER_URL = process.env.NODE_ENV === "development" ? "http://localhost:8080/" : "https://to-the-rescue-api-staging.herokuapp.com/" 2 | 3 | export const TOY_DETA_KEY = 'b05adlw0_WSQqvBzkzp6x7XbJ6nQKA3Tx3C7nQQ6k' 4 | 5 | export const TOY_DETA_ID = 'b05adlw0' 6 | 7 | export const DETA_URL = 'https://drive.deta.sh/v1/' 8 | 9 | export const DETA_PROJECT_ID = process.env.DETA_PROJECT_ID 10 | 11 | export const DETA_API_KEY = process.env.DETA_API_KEY 12 | 13 | export const PROVINCES = [ 14 | "Pinar del río", 15 | "Artemisa", 16 | "La Habana", 17 | "Mayabeque", 18 | "Matanzas", 19 | "Cienfuegos", 20 | "Villa Clara", 21 | "Sancti Spíritus", 22 | "Ciego de Ávila", 23 | "Camagüey", 24 | "Las Tunas", 25 | "Granma", 26 | "Holguín", 27 | "Santiago de Cuba", 28 | "Guantánamo", 29 | "Isla de la Juventud" 30 | ] -------------------------------------------------------------------------------- /push-notification-test/request-notification-template.txt: -------------------------------------------------------------------------------- 1 | https://fcm.googleapis.com//v1/projects//messages:send 2 | Content-Type: application/json 3 | Authorization: bearer AAAAFK1fL-w:APA91bHZgYm-eIXt95rBvIuoWCOGX3W6DqudtmskiW2KDnVHOZMExApFBDf7N-U2mibj76zNFjISy1FHLtCdW91cAnghozk0UBYZnBvV7HUwVTHg_EJMP2pEuR1V_MujVuTzpqx5RIof 4 | 5 | { 6 | "message": { 7 | "token": , 8 | "notification": { 9 | "title": "Background Message Title", 10 | "body": "Background message body" 11 | }, 12 | "webpush": { 13 | "fcm_options": { 14 | "link": "https://dummypage.com" 15 | } 16 | } 17 | } 18 | } 19 | 20 | 21 | 22 | 23 | 24 | curl -X POST -H "Authorization: key=YOUR_SERVER_KEY" -H "Content-Type: application/json" -d '{ 25 | "notification": { 26 | "title": "First notif", 27 | "body": "Hello world", 28 | "icon": "firebase-logo.png", 29 | "click_action": "http://localhost:8081" 30 | }, 31 | "to": "CLIENT_TOKEN" 32 | }' "https://fcm.googleapis.com/fcm/send" -------------------------------------------------------------------------------- /frontend/src/Components/Layout/NavigationItems/NavigationItem/NavigationItem.css: -------------------------------------------------------------------------------- 1 | /* .NavigationItem { 2 | margin: 10px 0; 3 | box-sizing: border-box; 4 | display: block; 5 | width: 100%; 6 | align-items: center; 7 | } 8 | 9 | .NavigationItem a { 10 | color: darkcyan; 11 | text-decoration: none; 12 | width: 100%; 13 | box-sizing: border-box; 14 | display: block; 15 | } 16 | 17 | .NavigationItem a:hover, 18 | .NavigationItem a:active, 19 | .NavigationItem a.active { 20 | border-bottom: 4px solid #40a4c8; 21 | } 22 | 23 | @media (min-width: 500px) { */ 24 | .NavigationItem { 25 | margin: 0; 26 | display: flex; 27 | height: 100%; 28 | width: auto; 29 | align-items: center; 30 | } 31 | 32 | .NavigationItem a { 33 | color: white; 34 | height: 100%; 35 | padding: 16px 10px; 36 | border-bottom: 4px solid transparent; 37 | } 38 | 39 | .NavigationItem a:hover, 40 | .NavigationItem a:active, 41 | .NavigationItem a.active { 42 | background-color: darkcyan; 43 | border-bottom: 4px solid #40a4c8; 44 | color: white; 45 | } 46 | /* } */ 47 | -------------------------------------------------------------------------------- /frontend/src/Components/Footer/Footer.js: -------------------------------------------------------------------------------- 1 | import { GrGithub } from "react-icons/gr"; 2 | import { SiFacebook } from "react-icons/si"; 3 | import { AiFillTwitterCircle, AiFillInstagram } from "react-icons/ai"; 4 | import "./Footer.css"; 5 | 6 | export default function Footer() { 7 | return ( 8 | 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 José Jorge Rodríguez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /backend/config/mongoose.js: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose" 2 | import dotenv from 'dotenv' 3 | 4 | dotenv.config() 5 | class MongooseConnection{ 6 | 7 | connection = null 8 | 9 | getConnection(){ 10 | 11 | if(this.connection !== null) 12 | return this.connection 13 | 14 | mongoose.Promise = global.Promise 15 | 16 | const DB_URL = process.env.MONGODB_URL || "mongodb://localhost:27017/to-the-rescue-dev" 17 | console.log(DB_URL) 18 | 19 | mongoose.connect(DB_URL, { 20 | useNewUrlParser: true, 21 | useUnifiedTopology: true 22 | }) 23 | 24 | mongoose.connection 25 | .once('open', () => { 26 | console.log('CONNECTED TO DB'); 27 | }) 28 | .on('error', (error)=> { 29 | console.error('CONNECTION ERROR:', error) 30 | process.exit(1) 31 | }) 32 | .on('close', () => console.log('CLOSING CONNECTION')) 33 | 34 | this.connection = mongoose.connection 35 | } 36 | } 37 | 38 | export default MongooseConnection -------------------------------------------------------------------------------- /frontend/src/Components/Layout/Input/Input.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | const input = (props) => { 4 | let inputElement = null 5 | const style = { 6 | outline: "none", 7 | border: "1px solid #ccc", 8 | backgroundColor: "white", 9 | font: "inherit", 10 | padding: "6px 10px", 11 | display: "block", 12 | width: "100%" 13 | } 14 | 15 | switch (props.config.type) { 16 | case ('input'): 17 | inputElement = ; 18 | break; 19 | case ('textarea'): 20 | inputElement =