Skip to content

trungkientran84/share_square_back_end

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHARE SQUARE Project

I. Introduction

Share Square is a website which allow its member to share any kind of information. Register members can create a post to share their information. Members can also interact with each other through comment, rating, messaging etc.

Admin of website can manage all information on the system including but not limited to member's post related information, account information, role, category etc.

Currently, the system support on web and android. Some feature has been completed. Many other features are under developing

III. Database Design

database_model

IV. Feature Description

1. Admin Site - (Kien Tran)

1.1 Description

Setup laravel framework for the project. Configure the Voyager plugin to function the admin site of the website. With supporting of Voyager plugin, the admin site can manage CRUD for all model in database. Need to implement model class in project source code Then do some configuration in Voyager in order to create CRUD feature for the database model.

The Voyager also support create the dynamic menu system which return the json of dynamic menu. The Front side of website can consume that json and manipulate with html to create dynamic menu.

Create data migrate to all tables in database and create all table seeder to generate testing data for the project.

1.2 Project files
  • app/all model class
  • composer.json
1.3 Learning component
  • Setup laravel project
  • Laravel Database migration
  • Laravel Database seeder, and Data factory
  • Setup plugin for laravel project
  • Understand and use the Voyager plugin

2. Common Layout - Slide Menu - (Kien Tran)

2.1 Description

Create common layout and side menu bar which is applied for features of login user

The common layout is utilized the blade master template

The side menu bar is developed by using Vue.js which consumes the menu json collection that is configured in Voyager feature

2.2 Project files
  • app/Menu.php
  • public/css/profile.css
  • public/js/slide-menu-bar.js
  • resources/js/components/user_menu.vue
  • resources/views/dashboard/navbar.blade.php
  • resources/views/dashboard/sidebar.blade.php
  • resources/views/layouts/user-master.blade.php
2.3 Learning component
  • Understand blade template and laravel layout management
  • Understand bootstrap
  • Understand Vuejs component.

3. User Dashboard - (Kien Tran)

3.1 Description

The dashboard present some statistic information about user's posts as following

  1. Total posts, views, and ratings
  2. The monthly post chart
  3. The monthly statistic chart of all comments, rating, and views
  4. The summary of rating statistic

Upon login, the dashboard show the statistic of current year. User can select another year by the dropdown box on the top of page.

The charts are generated by using consoletvs/charts plugin

3.2 How to access the feature
  1. Go to http://kientran.herokuapp.com/
  2. Login with email: [email protected] - pass: 123456
  3. The website will navigate to user dashboard
3.3 Project files
  1. Router
    • routes/web.php
  2. Support class
    • app/Charts/UserChart.php
    • app/Helpers/helpers.php
  3. Controller
    • app/Http/Controllers/User/UserDashboardController.php
  4. Model
    • app/Post.php
    • app/Comment.php
    • app/PostView.php
    • app/Rating.php
  5. View
    • resources/views/user/dashboard.blade.php
3.4 Learning component
  • Laravel Security
  • Laravel Route
  • Eloquent Model, Model Relationship, Query
  • Laravel View
  • consoletvs/charts plugin

4. User's Draft, Published, Closed, Pending, Favorite Post List - (Kien Tran)

4.1 Description

The list page present different kind of posts of current user.

  1. Draft Post: The post is created but has not published.
  2. Pending Post: The post is published and waiting for approval for publishing
  3. Public Post: The post is visible to all member of system
  4. Closed Post: The post is set as private which can only view by post owner.

The user can only view those information after login

4.2 How to access the feature
  1. Go to http://kientran.herokuapp.com/
  2. Login with email: [email protected] - pass: 123456
  3. On the slide menu bar, select appropriate menu for each type of post.
4.3 Project files
  1. Router
    • routes/web.php
  2. Support class
    • app/Helpers/helpers.php
  3. Controller
    • app/Http/Controllers/User/MyPostController.php
  4. Model
    • app/Post.php
    • app/Comment.php
    • app/Favorite.php
    • app/PostView.php
    • app/Rating.php
  5. View
    • resources/views/user/post-list.blade.php
4.4 Learning component
  • Laravel Security
  • Laravel Route
  • Eloquent Model, Model Relationship, Query
  • Laravel View
  • Bootstrap css

5. API for post related information, secure API endpoint using Passport - (Kien Tran)

5.1 Description

Create several api endpoint which allow mobile application can access post information

  • Retrieve a list of different type of post such as public, pending, closed, draft and favorite.
  • Retrieve the post detail information
  • Retrieve list of image belong to a post
  • Retrieve the post attribute key-value pair
  • Retrieve the rating of post
  • Retrieve all comments of the post
  • Retrieve post' viewing information
  • Retrieve statistic information related to all post of current user.
  • Change the status of a post
  • Add comment to a post
  • Rating for a post
  • Add a view to a post when a user view the post detail.

The API endpoint is secure by using Laravel Passport. User from mobile app must login to the system through provided login route in order to receive api token. For each request to the api, the user have to add the token to header of request in other to authenticated by backend.

5.2 How to access the feature
  1. Install Postman Rest Tool
  2. Create a post request to http://kientran.herokuapp.com/api/login
  3. The request body must include two key-value pare as followiing
  4. Send the request and get the [api token] in response
  5. In subsequence post/get request, include following key-value pairs as follow
    • Accept : application/json
    • Authorization: Bear [api token]
5.3 Project files
  1. Router
    • routes/api.php
  2. Support class
    • app/Helpers/helpers.php
  3. Controller
    • app/Http/Controllers/Auth/ApiLoginController.php
    • app/Http/Controllers/Api/DashboardController.php
    • app/Http/Controllers/Api/PostApiController.php
  4. Model
    • app/Post.php
    • app/Comment.php
    • app/Favorite.php
    • app/PostView.php
    • app/Rating.php
    • app/PostDetail.php
    • app/Image.php
    • app/User.php
  5. Resources
    • app/Http/Resources/CommentResource.php
    • app/Http/Resources/ImageResource.php
    • app/Http/Resources/PostCollection.php
    • app/Http/Resources/PostDetailResource.php
    • app/Http/Resources/PostResource.php
    • app/Http/Resources/UserProfileResource.php
  6. View
    • Mobile Client
5.4 Learning component
  • Laravel Security using Passport to secure API
  • Laravel API authentication middelware
  • Laravel Route
  • Eloquent Model, Model Relationship, Query
  • Eloquent composite keys relationship using awobaz/compoships plugin
  • Laravel API handling
  • Laravel API Resource transformation

V. Tasks Status

Task Name POC Due Date Status
Setup Laravel Framework Kien Week 8 Done
Setup Admin Landing page and layout Kien Week 8 Done
Admin: CRUD for Category Kien Week 8 Done
Admin: CRUD for Post Kien Week 8 Done
Admin: CRUD User Kien Week 8 Done
Admin: CRUD Role Kien Week 8 Done
Admin: Website configuration Kien Week 8 Done
Admin: Website configuration Kien Week 8 Done
User registration - basic Kien Week 8 Done
User Authentication - basic Kien Week 8 Done
User Authorization - basic Kien Week 8 Done
Homepage layout Chi Week 8 Done
Merge Home page layout to laravel template Kien Week 8 Done
Update Readme.md file to guideline on how to setup project on local environment Kien Week 8 Done
Define commit process and update the process to Readme.md Kien Week 8 Done
Add UI mockup for advanced search page Tuong week 8 Done
Individual Feature Pages(Car,RealEstate,Jobs) Chi Week 9 In Progress
Create Add post form Chi week9 In Progress
Integrate and structure main layout using blade template Kien week 09 Done
Create User Main Layout (Including Dynamic Menu Side Bar and Navigation Bar) Kien Week09 Done
Create User Dashboard Layout (Statistic and Charts) Kien Week09 Done
Create User Profile Layout Kien Week09 Done
Create User Public Posts Layout Kien Week09 Done
Create User Pending Post Layout Kien Week09 Done
Create User Closed Post Layout Kien Week09 Done
Create User Favorite Post Layout Kien Week09 Done
Create User Recent View Post Layout Kien Week09 Done
Create Post Detail layout (include rating, comments) Pradeep Week 9 In Progress
Create Create Post layout Pradeep Week 9 In Progress
Create API Endpoint for post Kien Tran Week 11 Done
Create database mirgration and dummy data for comments, ratings, favorite, post images-list Kien Tran week11 Done
Create database seeder to comments, ratings, views, user tables Kien Tran week11 Done
Complete User Dashboard page include charts and statistic Kien Tran week11 Done
Create common search function for search post Kien Tran week11 Done
Create MyPostController which handle all public, pending, draft, close, favorite post Kien Tran week11 Done
Create Seeder for favorite post Kien Tran week11 Done
Merging home page and details page using Laravel Chi Bui week11 Done
Add Post via home page Chi Bui week11 Done
Update Post in details page Chi Bui week11 InProgess
Create Search Post helper function for post searching, filtering purpose include paging Kien Tran week12 Done
Create Post List layout for public, pending, draft, close, favorite Kien Tran week12 done
Do pagination for all the page and search on home page and add validation Chi Bui week13 Done
Setup awobaz/compoships library to implement composite keys relationship between model Kien Tran week13 done
Create Mobile Api for post list, post detail, post images, post attributes, and post comment Kien Tran week13 done
Setup Passport to secure API endpoint, create login endpoint for android app Kien Tran week13 done
Deploy the website on Heroku Kien Tran week14 done
Create the Markdown document on github Kien Tran week14 done

VI. How to setup project on local environment

Following is step to setup project on local environment:

  1. Install Composer : https://getcomposer.org/ .
    Run following comment to make sure you have composer in your environment. Please pay attention on version .
    composer -v .
    Composer version 1.9.0 2019-08-02 20:55:32 .

  2. Install NodeJS: https://nodejs.org/en/ .

    • Check version by command node -v
      v12.11.1
    • Check laravel is installed by command laravel .
      Laravel Installer 2.1.0
  3. Clone the project to a local folder (ex: C:\Project): https://github.com/2019-fall-ite-5330-0na/project-user-interface-sharesquare.git

  4. Use command line to go to C:\Project folder cd C:\Project

  5. Install Composer Dependencies: composer install

  6. Install NPM Dependencies: npm install

  7. Generate an app encryption key: php artisan key:generate

  8. Create an empty database for our application in MYSQL Database: ex: project

  9. In the .env file, Edit database information to connect to the database according to your database configuration. You can file .env file in the project root folder .

    • DB_CONNECTION=mysql
    • DB_HOST=127.0.0.1
    • DB_PORT=3306
    • DB_DATABASE=project
    • DB_USERNAME=root
    • DB_PASSWORD=root
  10. Migrate the database: It means create database table in your database based on migrate feature of laravel

  • In project folder, run command: php artisan migrate
  1. Add dummy data to database:
  • In project folder, run command: php artisan db:seed
  1. Run the project
  • In project folder, run command: php artisan serve
  1. Access the website: http://127.0.0.1:8000
  2. Access the admin page: http://127.0.0.1:8000/admin (email: [email protected]/pass: password)
  3. Enjoy :)

VII. The project to work with github .

We are working in the project where serveral members will coding and commit contemporarily. As the result, code conflict will happen and one member might overide the code of other member when he commit if we don't have a process of how we commit code to github. Fortunately, github gives us the feature to handle it. Please strickly compliance with following process when working in the project

  1. Go to github website of our repository. Create a new branch from the master branch and named with your task name.
  2. Go to local environment, pull the repository
  3. Switch to your new created branch
  4. Coding for your task in your branch
  5. Before commit your code: merge the master branch to your branch then test whether your code work normally
  6. Commit code to your branch
  7. Push the code to github repository
  8. Go to github website to create a pull request to merge your branch to the master branch.
  9. Assign the pull request to other member of the team for review and merge code.
  10. To reviewer, please review the code then -> merge master branch to the branch being merged by the pull request. If there is any conflict, please ask member who created the pull request to resolve the conflict. If there is not any conflict, please merge the pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages