Giter Club home page Giter Club logo

sparkle's Introduction

Photoz : A RESTful Photo Gallery App

A simple photo gallery app made with Laravel 5.8, implementing a REST API

Updates

A Live Version of this application can be found here.

Instructions to run locally

  1. Set up .env file with database name, username and password.
  2. Migrate Database using php artisan migrate:fresh.
  3. Set up Personal Client for Laravel Passport. php artisan passport:install
  4. Symlink Storage php artisan storage:link
  5. Host the application on a virtual host.

Database Standards

User

  1. id- autoincremented, primary key
  2. username - string, candidate key
  3. first_name - string
  4. last_name - string
  5. email - email, candidate key
  6. gender - integer. 1: Male, 2: Female, 3: Others
  7. profile_picture - string (address to image in storage)

Album

  1. id - autoincremented, primary
  2. user_id - foregin to User->id
  3. album_name - string
  4. album_description - mediumtext
  5. cover_picture - string (address to image in storage)
  6. privacy - integer. 1: Public, 2: Link Accessible, 3: Private

Photo

  1. id - autoincremented, primary
  2. album_id - foregin to Album->id
  3. photo_description - mediumtext
  4. photo - string (address to image in storage)
  5. privacy - integer. 1: Public, 2: Link Accessible, 3: Private

Each table contains timestamps for created_at and updated_at

RESTful API

User

  1. Store - POST => app/api/users/
    request contains first_name,last_name,username,email,password_gender as required and profile_picture. Creates a User if details are valid and returns a access token.
  2. Update/{id} - PUT => app/api/users/{id}
    Bearer token passed with headers If logged in user has same {id}, updates the user with changes.
  3. Show/{id} - GET => app/api/users/{id}
    Bearer token may or may not be passed with headers Returns the User details, and if same as logged in user, returns all albums associated with it. For other users, or guest, returns User details and only public albums.
  4. Destroy{id} - DELETE => app/api/users/{id}
    Bearer token passed with headers If user exists and logged in user has permission, requests Albums/Delete API to delete all albums, Revoke all the users tokens, and then delete the User.
  5. Index - GET => app/api/users/
    Returns list of all users and corresponding details.

Album

  1. Store - POST => app/api/albums/
    Bearer token passed with headers request contains album_name,privacy as required and cover_picture,album_description. Creates the album for a valid user.
  2. Update/{id} - PUT => app/api/albums/{id}
    Bearer token passed with headers request contains album_name,privacy as required and cover_picture,album_description. Updates the album, if album exists and User has permission.
  3. Show/{id} - GET => app/api/albums/{id}
    Bearer token may or may not be passed with headers Returns the Album if User owns the album, and returns all photos associated with it. For other users, or guest, returns album if public or link accessible and returns only public photos.
  4. Destroy{id} - DELETE => app/api/albums/{id}
    Bearer token passed with headers If album exists and logged in user has permission, requests Photos/Delete API to delete all photos in the album and then delete the album.

Photo

  1. Store - POST => app/api/photos/
    Bearer token passed with headers request contains photo, privacy, album_id as required and photo_description. Uploads the photo to the album, if album exists and logged in User owns the album. If the album size is over 1000, the upload fails
  2. Update/{id} - PUT => app/api/photos/{id}
    Bearer token passed with headers request contains privacy, album_id as required and photo, photo_description. Updates the photo to the album, if photo/album exists and logged in User owns the album
  3. Show/{id} - GET => app/api/photos/{id}
    Bearer token may or may not be passed with headers Returns the photo if logged in user owns the photo, or if the photo has a privacy of public or link accessible
  4. Destroy{id} - DELETE => app/api/photos/{id}
    Bearer token passed with headers If photo exists and logged in user has permission, delete file from storage and entry from database.

Passport

  1. Login - POST => app/api/login
    request contains username and password. If verified, generates a token and returns it.
  2. Logout - GET => app/api/logout
    If user is authorized, revokes the login token and logs out.

sparkle's People

Contributors

trijeet avatar k2gsalem avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.