GithubHelp home page GithubHelp logo

gsg-g8 / art-gallery Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 4.0 4.14 MB

https://art-gallery-v1.herokuapp.com/

HTML 0.33% JavaScript 88.18% PLpgSQL 1.39% TSQL 2.94% CSS 7.15%
ant-design expressjs hooks html-css-javascript nodejs posgresql reactjs

art-gallery's People

Contributors

alaasaadeddin avatar linayahya avatar mariamisa avatar mu7ammadabed avatar ranasobeid95 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

art-gallery's Issues

GET | /profile/:artistId

Relates #2

Route: GET api/v1/profile/:artistId

get the artist information by ID

Acceptance Criteria
  • Request
  • Response
  • Testing

Response

  • Success
{ statusCode:200 ,data : [{
id,
first_name,
last_name,
email,
mobile_no,
reviews,
profile_img,
social_accounts,
budget,
bio
}]  }

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"

admin controller

  • create admin table
  • alter artist table (add new column "active" with default value false)
  • add new case admin for login controller
  • make POST route for admin login
  • make GET rout for get all artist
  • make PATCH route for update table artist to activate

make admin dashboard

admin dashboard

  • make login page for admin
  • make dashboard with add artist
  • activate/not artist with switch button
  • admin can see budget
  • logout button

POST /login

Relates #2

Route: POST api/v1/login

Acceptance Criteria
  • Request
  • Response
  • Testing

Request body

 req.body =  {
      email,
      password,
      role,
  }

Validation

{
 email: yup.string().alphanum().required(),
 password: yup.string().min(8).required(),
}

Response

  • Success
{ statusCode:200 }
  • Failed
{statusCode:401, message:"Unauthorized"}

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"

Issues Template

Backend Route template

Name should be : METHOD /full-route

Acceptance Criteria

  • Validation Schema

  • Request body

  • Response

  • Testing


Validation schema

Request body

Response
  • Success
{ statusCode:  ,data : { }}
  • Failed
{statusCode: , message:" "}

Testing

Paintings Section component

Descreption

This component to display artworks stored in our database and filter them based on conditions

layout

Screenshot_from_2020-06-28_15-02-22

POST /signup

Relates #2

Route: POST api/v1/signup

Acceptance Criteria
  • Request
  • Response
  • Testing

Request body

 req.body =  {
      firstName,
      lastName,
      email,
      password,
      confirmPassword,
      role (artist or user),
  }

Validation

{
 email: yup.string().alphanum().required(),
 password: yup.string().min(8).required(),
 confirmPassword: yup.string().ref('password'),
 firstName: yup.string().required(),
 lastName: yup.string().required(),
 role: yup.string().required(),
}

Response

  • Success
{ statusCode:201 ,data : { }  }
  • Failed
{statusCode:401, message:"Unauthorized"}

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"

GET /logout

relates #2

Route: GET api/v1/logout

Acceptance Criteria
  • Response
  • Testing

res.clearCookie('token').redirect('/');

Response

  • Success
{ statusCode:200 ,
Location: '/login'
}
  • Failed
{statusCode:500, 
message:"Internal Server Error"}

Testing

to be a successful test

  • status === 200
  • location === '/login'

PATCH profile/customer

Relates #2

Route: PATCH api/v1/user/:id

Acceptance Criteria
  • Request
  • Response
  • Testing

Request body

 req.body =  {
      socialMediaAccounts,
      profileImg,
      budget,
      bio,
      mobileNo,
  }

Validation

{
 budget: yup.number().round(),
}

Response

  • Success
{ statusCode:200 ,data : { }  }

Testing

to be a successful test

  • status === 200

POST /review

Acceptance Criteria

  • Validation Schema

  • Request body

  • Response

  • Testing


Validation schema

{
details: yup.string().required(),
rate: yup.float().requird(),
artistsId: yup.number().integer().positive().required(),
}


Request body

req.body = {
details,
rate,
artistic,
}

Response
  • Success
{ statusCode: 201  ,  data: {rows} }
  • Failed
{statusCode: 400 , message:"Invalid Data "}

Testing

to be a successful test

status === 201
typeof(data) === "object"

POST /paintings

Acceptance Criteria

  • Validation Schema

  • Request body

  • Response

  • Testing


Validation schema

{
title: yup.string().required(),
description: yup.string().required(),
category: yup.string().required(),
property: yup.string().required(),
countSold: yup.number().integer().positive().required(),
painting_img: yup.string().required(),
artistsId: yup.number().integer().positive().required(),
}


Request body

req.body = { title,
description,
category,
property,
countSold,
artistsId,
painting_img
}

Response
  • Success
{ statusCode: 201  ,  data: {artId, message: "Art Added Successfully} }
  • Failed
{statusCode: 400 , message:"Invalid Data "}

Testing

to be a successful test

status === 201
typeof(data) === "object"

Backend Routes

Routes

Paintings

Route Method Description Status
/paintings GET #13 ๐Ÿ‘
/paintings POST #16
/paintings/:artistId GET #12 ๐Ÿ‘
/buy GET
/paintings/:id DELETE #18

Cart

Route Method Description Status
/cart/ GET #14
/cart/ POST #17
/cart/:paintingsId DELETE #19

Log

Route Method Description Status
/login POST #9 ๐Ÿ‘
/signup POST #10
/logout GET #20

Artist

Route Method Description Status
/profile/:artistId GET without password #21
/profile/:userId GET without password #22
/artist/:id PATCH to update artist profile
/user/:id PATCH to update user profile

Review

Route Method Description Status
/review/:artistId GET without password #21
/review/:userId POST without password #22

PATCH /buy/:productId

Relates #2

Route: PATCH api/v1/buy/:productId

This route when user buy product to update both budget for customer and artist and count_sold at product table

Acceptance Criteria
  • Request
  • Response
  • Testing

Response

  • Success
{ statusCode:200 ,data : { }  }

Testing

to be a successful test

  • status === 200

PATCH /artist/:id

Relates #2

Route: PATCH api/v1/artist/:id

Acceptance Criteria
  • Request
  • Response
  • Testing

Request body

 req.body =  {
      socialMediaAccounts,
      profileImg,
      budget,
      bio,
      mobileNo,
  }

Validation

{
 socialMediaAccounts: yup.array(),
 profileImg: yup.string(),
 budget: yup.number().round(),
 bio: yup.string(),
 mobileNo: yup.string(),
}

Response

  • Success
{ statusCode:200 ,data : { }  }

Testing

to be a successful test

  • status === 200

GET /paintings/:artistId

Relates #2

Route: GET api/v1/paintings/:artistId

get the artworks for specific artist by artist ID

Acceptance Criteria
  • Request
  • Response
  • Testing

Response

  • Success
{ statusCode:200 ,data : [{
id,
title,
description,
category,
property,
count_sold,
artisit_id,
}]  }

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"

File structure

File Structure

  • client/

    • public/
    • src/
      • assets/
        • icons/
          • .gitkeep
        • images/
          • .gitkeep
      • components/
        • index.js
      • constants/
        • routes.js
      • containers/
        • index.js
      • app/
        - index.js
        - app.module.css
    • .gitignore
    • .eslintrc.json
    • package-lock.json
    • package.json
  • server/

    • controllers/
      - index.js
      - errorHandle/
      - index.js

    • database/

      • data/
        • build.sql
        • fakeData.sql
        • build.js
      • queries/
        • index.js
      • connection.js
    • utils/

      • validation/
        • index.js
    • app.js

    • index.js

    • .env

  • test/

    • index.js
  • .travis.yml

  • .gitignore

  • .eslintrc.json

  • package-lock.json

  • package.json

Use nodemailer module

I will try to use nodemailer module in order to send an email to customer after buying a product.

review page

  • create a review page for user to add a review about the artist

Checkout Page

Acceptance Criteria

  • State
  • Props
  • Components
  • Snapshot

State

Default state will be as follows:

state = {
customerDate: []
}

Component

Then, when the components did mount and request the data from the API it will be as follows:

state = {
customerData:[
   {
    id: integer,
    first_name: string,
    last_name: string,
    email: string,
    budget: integer,
},
...
]
}

Props

There are no props for this page

Snapshot

Screenshot from 2020-06-29 10-26-25

GET /cart

Name : GET /cart

Description

  • get all product for specific user

Acceptance Criteria

  • Response

  • Testing


Response
  • Success
{ 200:  ,data : { }}
  • Failed
{[400,500]: , message:" "}

Testing

Frontend Routes

Routes

Home

Route Protected? Description Issues
/login false Login page
/signup false sign up page
/ false Home page
/cart true cart page
/review false review page
/art/:artId false Specific art page
/artist/:artistId false Specific artist page
/admin false admin dashboard

GET |/profile/:userId

Relates #2

Route: GET api/v1/profile/:userId

get the customer information by ID

Acceptance Criteria
  • Request
  • Response
  • Testing

Response

  • Success
{ statusCode:200 ,data : [{
id,
first_name,
last_name,
email,
mobile_no,
profile_img,
budget
}]  }

Testing

to be a successful test

  • status === 200
  • typeof(data) === "object"

Project Setup

#4

Acceptance Criteria

  • File Structure
  • Server Setup
  • Client (React) Setup
  • ESLINT config

File Strucutre

  • Client
  • Server
  • Testing
    #3

Server Setup

  • Install modules :
    • express
    • jsonwebtoken
    • yup
    • dotenv
    • cookie-parser
    • compression
    • pg
    • nodemon
    • supertest
    • jest
    • eslint
    • pre-commit

React Setup

Generate react app for the client using command

npx create-react-app 
  • Install modules :
    • prop-types
    • react-router-dom
    • axios
    • antd

Travis CI

add .yml to the structure

ESLINT config

  • ESLINT for the server

        eslint
        eslint-config-airbnb-base
        eslint-plugin-import
        eslint-config-prettier
        eslint-plugin-prettier
        eslint-plugin-flowtype
        eslint-plugin-jsx-a11y
        eslint-plugin-react
        eslint-plugin-react-hooks
        prettier
  • ESLINT for the react

        eslint
        eslint-config-airbnb
        eslint-plugin-prettier
        save-exact prettier
        eslint-config-prettier
        prettier

Mockup component

Description

A component that lets the user upload background image and try our painting on his wall and resize it.

GET | reviews/:artistID

Relates #2

Name : GET /cart

Description

  • get all reviews for specific artist by artistID as params

Acceptance Criteria

  • Response

  • Testing


Response
  • Success
{ 200:  ,data : { }}
  • Failed
{[400,500]: , message:" "}

Testing

DELETE /paintings/:id

relates #2

Route: DELETE api/v1/paintings/:id

Acceptance Criteria

  • Request
  • Response
  • Testing

DB query

DELETE FROM product WHERE id = id;

Response

  • Success
{ StatusCode: 200,
  data: { message: "painting deleted successfully" }
}

Testing

to be a successful test

  • status === 200

Readme

Write the README which should contain the following ๐Ÿ‘

  • Project Title
  • Team Members
  • About Project ( a small summary to explain for what our app is )
  • Challenge
  • Solution
  • User Stories
    • As an artist
    • As an user
    • As a admin
  • Set up the app locally
  • Data Base Schema
  • Technologies ( what we use to build the app )

artist profile

artist profile

  • view all artist data
  • edit artist info
  • add art picture
  • view all picture relates to artist
  • artist can delete his artist

GET /auth

Route: GET api/v1/auth

Description

route to decode token and send userID and role

Response

{ statusCode:200 ,data : {
userID,
role,
} }

GET /paintings

Route: GET api/v1/paintings

Acceptance Criteria
  • Response
  • Testing

Response

  • Success
{ statusCode:200,
 data: [{
          id,
          title,
          description,
          category,
          property,
          countSold,
          artistsId
        }] }
  • Failed
{statusCode:400, message:" Bad Request"}

Testing

to be a successful test

  • status === 200
  • typeof(data) === "array"
  • data.length !== 0

Database schema

Create the database tables using Postgres according to this schema

Copy of art gallery (2)

is-Auth ?

Some frontend routes have to be protected so in order to achieve this purpose we handled a backend route which send a response with status code 200 and user id and role if he is authorized to access this route, and a response of status code 401 and message Un-Authorize if he wasn't authorized, We will check these responses and handle our frontend protected routes in response to them

set-up travis

Travis CI

  • Create a config file [ .travis.yml ]
  • Connect repository with travis.

POST /cart

Backend Route template

Name : POST /cart

Acceptance Criteria

  • Validation Schema

  • Request body

  • Response

  • Testing


Validation schema

Request body
  • product id
  • price

Response
  • Success
{ 200:  ,data : { }}
  • Failed
{[400,500]: , message:" "}

Testing

DELETE /cart/:paintingsId

Name : DELETE /cart/:paintingsId

Description :

  • delete product from cart

Acceptance Criteria

  • Response

  • Testing


Validation schema

Request body

Response
  • Success
{ 200:  ,data : { }}
  • Failed
{[400,500]: , message:" "}

Testing

Server setup

Initialize the express app by

  • setup express server on port 5000 and

    • use these middleware
      • app.use(cookieParser());
      • app.use(express.json());
      • app.use(compression());
    • set the port
    • disable powered by
  • import app.js on index.js and listen to our app

Also install morgan package to make HTTP request logger for node.js

Fake data

  • add a fake data to the data base .

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.