ansualo / backend-proyectofinal

Home Page:https://backend-proyectofinal.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First in Spanish then in English

PROYECTO FINAL - VERDA - BACKEND

Contenido 📝
  1. Objetivo
  2. Sobre el proyecto
  3. Stack
  4. Diagrama
  5. Instalación
  6. Endpoints
  7. Licencia
  8. Contacto

Objetivo

En el siguiente proyecto se ha llevado a cabo la creación del backend para el proyecto final del bootcamp Full Stack Developer en GeeksHubs Academy. El proyecto completo debía realizarse en una duración de dos semanas y, en esta parte, se desarrolló una API REST utilizando Laravel, la cual fue utilizada para alimentar las vistas del frontend.

Sobre el proyecto

El proyecto consiste en una página web diseñada para los amantes de las plantas de interior. Los usuarios podrán buscar información detallada sobre diversas especies y, además, tendrán la opción de añadir las plantas que poseen a su perfil, lo que les permitirá llevar un control preciso de su riego y cuidado.

Stack

Tecnologías utilizadas:

PHP Laravel MySQL Docker Postman

Diagrama BD

'imagen-db'

Instalación en local

  1. Clona el repositorio $git clone 'url-repository'
  2. Instala las dependencias composer install
  3. Crea el archivo .env y configura la base de datos
  4. Ejecuta las migraciones y seeders php artisan migrate php artisan db:seed
  5. Conectamos el servidorphp artisan serve
  6. Ejecuta este archivo en Postman para habilitar el acceso a los endpoints del proyecto: Run in Postman

Endpoints

Endpoints
  • AUTH

    • REGISTER

        POST http://localhost:8000/api/register
      

      body:

          {
              "name": "Andrea",
              "surname": "Suarez",
              "email": "andrea@andrea.com",
              "password": "Andrea1234",
              "city": "Valencia",
              "country": "Spain"
          }
    • LOGIN

        POST http://localhost:8000/api/login
      

      body:

          {
              "email": "andrea@andrea.com",
              "password": "Andrea1234"
          }
    • LOGOUT

      POST http://localhost:8000/api/logout
      
  • USERS

    • GET PROFILE

        GET localhost:8000/api/profile
      
    • UPDATE PROFILE

        PUT localhost:8000/api/profile
      

      body:

          {
              "name": "Andrea",
              "surname": "Suarez",
              "city": "Valencia",
              "country": "Spain"
          }
    • DELETE PROFILE (as user)

        DELETE localhost:8000/api/profile
      
    • DELETE PROFILE AS ADMIN (admin)

       DELETE localhost:8000/api/profile/:id
      
    • RESTORE PROFILE (admin)

        POST localhost:8000/api/profile/:id
      
    • GET All USERS (admin)

        GET localhost:8000/api/allusers
      
    • GET DELETED USERS (admin)

        GET localhost:8000/api/allusers/deleted
      
  • PLANTS

    • GET ALL PLANTS

        GET localhost:8000/api/plants
      
    • GET PLANTS BY ID

        GET localhost:8000/api/plants/:id
      
    • GET PLANTS BY NAME

        POST localhost:8000/api/plants/name
      

      body:

          {
              "name": "aloe"
          }
    • GET PLANTS BY SUNLIGHT

        POST localhost:8000/api/plants/sunlight
      

      body:

          {
              "sunlight": "Full sun"
          }
    • GET PLANTS BY WATERING

        POST localhost:8000/api/plants/watering
      

      body:

          {
              "watering": "Part sun/Part shade"
          }
    • GET PLANTS BY FLOWERS

        POST localhost:8000/api/plants/flowers
      

      body:

          {
              "flowers": true
          }
    • GET PLANTS BY POISONOUS

        POST localhost:8000/api/plants/poisonous
      

      body:

          {
               "poisonous": false
          }
    • CREATE PLANT

        POST localhost:8000/api/plants
      

      body:

          {
              "common_name": "Example",
              "scientific_name": "Example",
              "sunlight": "Full Sun",
              "watering": "Average",
              "flowers": true,
              "poisonous_to_pets": false
          }
  • MY PLANTS

    • GET MY PLANTS BY USER

        GET localhost:8000/api/myplants
      
    • GET MY PLANTS BY ID

        GET localhost:8000/api/myplants/:id
      
    • GET MY PLANTS BY PLANT ID

        GET localhost:8000/api/myplants/plant/:id
      
    • GET MY PLANTS WATER TODAY

        GET localhost:8000/api/myplants/watertoday
      
    • GET MY PLANTS NOT WATER TODAY

        GET localhost:8000/api/myplants/notwatertoday
      
    • CREATE MY PLANT

        POST localhost:8000/api/myplants/:id
      

      body:

          {
              "name": "Kitchen little plant",
              "days_between_water" : 10
          }
    • UPDATE MY PLANT

        POST localhost:8000/api/myplants/:id
      

      body:

          {
              "name": "Kitchen big plant",
              "days_between_water" : 7
          }
    • DELETE MY PLANT

        DELETE localhost:8000/api/myplants/:id
      
  • WATERING DATES

    • GET WATERING DATE

        GET localhost:8000/api/water/:id
      
    • CREATE WATERING DATE

        POST localhost:8000/api/water
      

      body:

          {
              "my_plant_id": 20,
              "watered_on": "2023-07-22"
          }
    • UPDATE WATERING DATE

        POST localhost:8000/api/water
      

      body:

          {
              "id": 1,
              "watered_on": "2023-08-10"
          }
    • DELETE WATERING DATE

        DELETE localhost:8000/api/water/:id
      

Licencia

Este proyecto se encuentra bajo licencia MIT.

La información de la tabla de plantas se ha obtenido de perenual.com/docs/api

Contacto




FINAL PROJECT - VERDA - BACKEND

Contenido 📝
  1. Objective
  2. About the project
  3. Stack
  4. Diagram
  5. Local installation
  6. Endpoints
  7. License
  8. Contact

Objective

The following project involved the creation of the backend for the final project of the Full Stack Developer bootcamp at GeeksHubs Academy. The whole project needed to be completed in a duration of two weeks and, in this part, a REST API was developed using Laravel, which was used to feed the frontend views.

About the project

The project consists of a website designed for indoor plant lovers. Users will be able to search for detailed information on various species and will also have the option to add the plants they own to their profile, allowing them to keep precise control of their watering and care.

Stack

Technologies used:

PHP Laravel MySQL Docker Postman

DB Diagram

'imagen-db'

Local installation

  1. Clone the repository $git clone 'url-repository'.
  2. Install dependencies $composer install.
  3. Create the .env file and set up the database.
  4. Run the php artisan migrate php artisan db:seed migrations and seeders.
  5. Connect the php artisan serve server.
  6. Run this file in Postman to enable access to the project endpoints:Run in Postman

Endpoints

Endpoints
  • AUTH

    • REGISTER

        POST http://localhost:8000/api/register
      

      body:

          {
              "name": "Andrea",
              "surname": "Suarez",
              "email": "andrea@andrea.com",
              "password": "Andrea1234",
              "city": "Valencia",
              "country": "Spain"
          }
    • LOGIN

        POST http://localhost:8000/api/login
      

      body:

          {
              "email": "andrea@andrea.com",
              "password": "Andrea1234"
          }
    • LOGOUT

      POST http://localhost:8000/api/logout
      
  • USERS

    • GET PROFILE

        GET localhost:8000/api/profile
      
    • UPDATE PROFILE

        PUT localhost:8000/api/profile
      

      body:

          {
              "name": "Andrea",
              "surname": "Suarez",
              "city": "Valencia",
              "country": "Spain"
          }
    • DELETE PROFILE (as user)

        DELETE localhost:8000/api/profile
      
    • DELETE PROFILE AS ADMIN (admin)

       DELETE localhost:8000/api/profile/:id
      
    • RESTORE PROFILE (admin)

        POST localhost:8000/api/profile/:id
      
    • GET All USERS (admin)

        GET localhost:8000/api/allusers
      
    • GET DELETED USERS (admin)

        GET localhost:8000/api/allusers/deleted
      
  • PLANTS

    • GET ALL PLANTS

        GET localhost:8000/api/plants
      
    • GET PLANTS BY ID

        GET localhost:8000/api/plants/:id
      
    • GET PLANTS BY NAME

        POST localhost:8000/api/plants/name
      

      body:

          {
              "name": "aloe"
          }
    • GET PLANTS BY SUNLIGHT

        POST localhost:8000/api/plants/sunlight
      

      body:

          {
              "sunlight": "Full sun"
          }
    • GET PLANTS BY WATERING

        POST localhost:8000/api/plants/watering
      

      body:

          {
              "watering": "Part sun/Part shade"
          }
    • GET PLANTS BY FLOWERS

        POST localhost:8000/api/plants/flowers
      

      body:

          {
              "flowers": true
          }
    • GET PLANTS BY POISONOUS

        POST localhost:8000/api/plants/poisonous
      

      body:

          {
               "poisonous": false
          }
    • CREATE PLANT

        POST localhost:8000/api/plants
      

      body:

          {
              "common_name": "Example",
              "scientific_name": "Example",
              "sunlight": "Full Sun",
              "watering": "Average",
              "flowers": true,
              "poisonous_to_pets": false
          }
  • MY PLANTS

    • GET MY PLANTS BY USER

        GET localhost:8000/api/myplants
      
    • GET MY PLANTS BY ID

        GET localhost:8000/api/myplants/:id
      
    • GET MY PLANTS BY PLANT ID

        GET localhost:8000/api/myplants/plant/:id
      
    • GET MY PLANTS WATER TODAY

        GET localhost:8000/api/myplants/watertoday
      
    • GET MY PLANTS NOT WATER TODAY

        GET localhost:8000/api/myplants/notwatertoday
      
    • CREATE MY PLANT

        POST localhost:8000/api/myplants/:id
      

      body:

          {
              "name": "Kitchen little plant",
              "days_between_water" : 10
          }
    • UPDATE MY PLANT

        POST localhost:8000/api/myplants/:id
      

      body:

          {
              "name": "Kitchen big plant",
              "days_between_water" : 7
          }
    • DELETE MY PLANT

        DELETE localhost:8000/api/myplants/:id
      
  • WATERING DATES

    • GET WATERING DATE

        GET localhost:8000/api/water/:id
      
    • CREATE WATERING DATE

        POST localhost:8000/api/water
      

      body:

          {
              "my_plant_id": 20,
              "watered_on": "2023-07-22"
          }
    • UPDATE WATERING DATE

        POST localhost:8000/api/water
      

      body:

          {
              "id": 1,
              "watered_on": "2023-08-10"
          }
    • DELETE WATERING DATE

        DELETE localhost:8000/api/water/:id
      

License

This project is under MIT licence.

The information in the table plants has been obtained from perenual.com/docs/api

Contact

About

https://backend-proyectofinal.vercel.app

License:MIT License


Languages

Language:PHP 82.3%Language:Blade 17.5%Language:JavaScript 0.2%