Skip to content

dleloutre/giphy-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Giphy Integration

Overview

Giphy Integration is a REST API that allows users to search for GIFs using the Giphy API, save their favorite GIFs, and manage user authentication via OAuth2.

Table of Contents

  1. Requirements
  2. Installation
  3. Running the Application
  4. API Endpoints
  5. Testing
  6. Diagrams

Requirements

  • Docker
  • Docker Compose
  • Git

Installation

To build and run the application, follow these steps:

  1. Clone the repository:

    git clone git@github.com:dleloutre/giphy-integration.git
    cd giphy-integration
  2. Copy the environment configuration file:

    cp ./src/.env.example ./src/.env
  3. Build and run the Docker containers:

    docker-compose up -d --build
  4. Install the dependencies:

    docker exec -it app composer install
  5. Set the appropriate permissions for the storage directory:

    docker exec -it app chmod -R 777 storage
  6. Generate the application key:

    docker exec -it app php artisan key:generate
  7. Run the database migrations:

    docker exec -it app php artisan migrate
  8. Install Passport:

    docker exec -it app php artisan passport:install
  9. Seed the database:

    docker exec -it app php artisan db:seed

Running the Application

Once the installation is complete, the application should be running and accessible via the configured URL. Don't forget to add your Giphy api key to the .env file. Use the provided endpoints to interact with the API.

API Endpoints

The following endpoints are available in the Giphy Integration API:

1. Login

  • Endpoint: /api/login
  • Method: POST
  • Description: Authenticates the user and provides an OAuth2 token.

2. Search GIF by Keyword

  • Endpoint: /api/gifs/search
  • Method: GET
  • Description: Searches for GIFs based on the provided keyword.
  • Authorization: Required

3. Search GIF by ID

  • Endpoint: /api/gifs/{gifId}
  • Method: GET
  • Description: Retrieves a GIF by its ID.
  • Authorization: Required

4. Save Favorite GIF

  • Endpoint: /api/users/{userId}/favorite-gifs
  • Method: POST
  • Description: Saves a GIF to the user's favorites.
  • Authorization: Required

For detailed API documentation, refer to the Postman Collection.

Testing

To run the tests, use the following command:

docker exec -it app php artisan test

Diagrams

The following diagrams are included to illustrate the application flow and data relationships:

1. Sequence Diagram

Login + Request log

Login Sequence Diagram

Search GIFs

Search Sequence Diagram

Search GIF by ID

Search By Id Sequence Diagram

Save favorite GIF

Save Favorite Sequence Diagram

2. Entity-Relationship Diagram (ERD)

ERD Diagram

3. Use Case Diagram

Use Case Diagram

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages