├── .gitignore ├── client-side ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── index.html ├── src │ ├── urlConfig.js │ ├── helpers │ │ ├── isObjEmpty.js │ │ └── axios.js │ ├── store.js │ ├── index.css │ ├── assets │ │ ├── data │ │ │ └── categories.js │ │ └── images │ │ │ ├── client-signin.svg │ │ │ └── dealer-signin.svg │ ├── components │ │ ├── Layout │ │ │ ├── layout.style.css │ │ │ └── index.layout.js │ │ ├── HOC │ │ │ └── PrivateRoute.js │ │ └── UI │ │ │ ├── MessageBox.js │ │ │ ├── ImgsCard.js │ │ │ ├── Input.js │ │ │ ├── ProfileCards.js │ │ │ ├── LoginModel.js │ │ │ ├── DealsHistory.js │ │ │ ├── VenueCard.js │ │ │ ├── BookingModel.js │ │ │ └── AddVenueModel.js │ ├── reducers │ │ ├── server.reducers.js │ │ ├── dealsHistory.reducers.js │ │ ├── index.js │ │ ├── register.reducers.js │ │ ├── ownerVenues.reducers.js │ │ ├── allVenues.reducers.js │ │ ├── addVenue.reducers.js │ │ ├── userInfo.reducers.js │ │ ├── venue.reducers.js │ │ └── auth.reducers.js │ ├── index.js │ ├── actions │ │ ├── dealsHistory.actions.js │ │ ├── userInfo.actions.js │ │ ├── register.actions.js │ │ ├── constants.js │ │ ├── checkout.actions.js │ │ ├── auth.actions.js │ │ └── venue.actions.js │ ├── App.js │ └── containers │ │ ├── PaymentStatus.js │ │ ├── Signin.js │ │ ├── Home.js │ │ ├── Profile.js │ │ ├── Venue.js │ │ └── Signup.js ├── .gitignore └── package.json ├── routes ├── client.auth.js ├── dealer.auth.js ├── deal.js └── venue.js ├── models ├── deal.js ├── venue.js └── user.js ├── common_middlewares └── index.js ├── package.json ├── LICENSE ├── README.md ├── index.server.js ├── controllers ├── venue.js ├── client.auth.js ├── deal.js └── dealer.auth.js └── CODE_OF_CONDUCT.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env 3 | uploads/ -------------------------------------------------------------------------------- /client-side/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /client-side/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kanadeakshay/venue_booking_site/HEAD/client-side/public/favicon.ico -------------------------------------------------------------------------------- /client-side/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kanadeakshay/venue_booking_site/HEAD/client-side/public/logo192.png -------------------------------------------------------------------------------- /client-side/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kanadeakshay/venue_booking_site/HEAD/client-side/public/logo512.png -------------------------------------------------------------------------------- /client-side/src/urlConfig.js: -------------------------------------------------------------------------------- 1 | export const api = 'http://localhost:2000/api'; 2 | export const getPublicURL = (filename) => { 3 | return `http://localhost:2000/public/${filename}`; 4 | } -------------------------------------------------------------------------------- /client-side/src/helpers/isObjEmpty.js: -------------------------------------------------------------------------------- 1 | function isEmpty(obj) { 2 | for (var key in obj) { 3 | if (obj.hasOwnProperty(key)) 4 | return false; 5 | } 6 | return true; 7 | } 8 | 9 | export { 10 | isEmpty 11 | } -------------------------------------------------------------------------------- /client-side/src/store.js: -------------------------------------------------------------------------------- 1 | import { applyMiddleware, createStore } from 'redux'; 2 | import rootReducer from './reducers'; 3 | import thunk from 'redux-thunk'; 4 | 5 | const store = createStore(rootReducer, applyMiddleware(thunk)); 6 | 7 | export default store -------------------------------------------------------------------------------- /client-side/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: "Roboto", sans-serif; 4 | -webkit-font-smoothing: antialiased; 5 | -moz-osx-font-smoothing: grayscale; 6 | } 7 | 8 | code { 9 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 10 | monospace; 11 | } 12 | -------------------------------------------------------------------------------- /client-side/src/assets/data/categories.js: -------------------------------------------------------------------------------- 1 | const categories = [ 2 | 'Art Gallery', 3 | 'Academic Venues', 4 | 'Community Center', 5 | 'Conference Hall', 6 | 'Clubs', 7 | 'Game Arenas', 8 | 'Reception', 9 | 'Restaurant', 10 | 'Seminar Hall', 11 | 'Wedding', 12 | ]; 13 | 14 | export default categories -------------------------------------------------------------------------------- /client-side/src/components/Layout/layout.style.css: -------------------------------------------------------------------------------- 1 | .avatar-border { 2 | display : flex; 3 | justify-content: center; 4 | align-items: center; 5 | border: 1px solid white; 6 | padding: 1px; 7 | border-radius: 50%; 8 | } 9 | 10 | @media screen and (min-width: 992px) { 11 | .test { 12 | align-items: center; 13 | left: 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /client-side/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /routes/client.auth.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { requireSignIn, clientMiddleware } = require('../common_middlewares'); 3 | const { signup, signin, UserProfile, signout } = require('../controllers/client.auth'); 4 | const router = express.Router(); 5 | 6 | router.post('/signup', signup); 7 | router.post('/signin', signin); 8 | router.post('/sign-out', requireSignIn, signout) 9 | router.get('/user/:userId', requireSignIn, clientMiddleware, UserProfile); 10 | 11 | module.exports = router; -------------------------------------------------------------------------------- /routes/dealer.auth.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { requireSignIn, dealerMiddleware } = require('../common_middlewares'); 3 | const { signup, signin, DealerProfile, signout } = require('../controllers/dealer.auth'); 4 | const router = express.Router(); 5 | 6 | router.post('/dealer/signup', signup); 7 | router.post('/dealer/signin', signin); 8 | router.post('/sign-out', requireSignIn, signout); 9 | router.get('/dealer/:userId', requireSignIn, dealerMiddleware, DealerProfile); 10 | 11 | module.exports = router; -------------------------------------------------------------------------------- /client-side/src/reducers/server.reducers.js: -------------------------------------------------------------------------------- 1 | import { serverConstants } from "../actions/constants"; 2 | 3 | const initialState = { 4 | message: null 5 | } 6 | 7 | const serverReducer = (state = initialState, action) => { 8 | switch (action.type) { 9 | case serverConstants.SERVER_OFFLINE: 10 | state = { 11 | message: action.payload.msg 12 | } 13 | break; 14 | 15 | default: 16 | break; 17 | } 18 | return state; 19 | } 20 | 21 | export default serverReducer -------------------------------------------------------------------------------- /client-side/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import { Provider } from 'react-redux'; 6 | import store from './store'; 7 | import {BrowserRouter as Router} from 'react-router-dom'; 8 | 9 | window.store = store; 10 | 11 | ReactDOM.render( 12 | 13 | 14 | 15 | 16 | 17 | 18 | , 19 | document.getElementById('root') 20 | ); 21 | 22 | -------------------------------------------------------------------------------- /client-side/src/components/HOC/PrivateRoute.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Route, Redirect } from 'react-router-dom'; 3 | 4 | const PrivateRoute = (props) => { 5 | const { component: Component, ...rest } = props; 6 | return { 7 | const token = window.localStorage.getItem('token'); 8 | if (token) { 9 | return 10 | } else { 11 | return 12 | } 13 | }} /> 14 | } 15 | 16 | export default PrivateRoute -------------------------------------------------------------------------------- /client-side/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /client-side/src/assets/images/client-signin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /client-side/src/components/UI/MessageBox.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Modal } from 'react-bootstrap'; 3 | 4 | const MessageBox = (props) => { 5 | return ( 6 | 7 | 8 | Message 9 | 10 | 11 |
{props.message}
12 | 15 |
16 |
17 | ) 18 | } 19 | 20 | export default MessageBox -------------------------------------------------------------------------------- /routes/deal.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { getDeal, confirmDealsOfUser, confirmDealsOfDealer, checkout, confirmDeal, deleteUnconfirmDeal } = require('../controllers/deal'); 3 | const { requireSignIn, clientMiddleware, dealerMiddleware } = require('../common_middlewares/index') 4 | const router = express.Router(); 5 | 6 | router.post('/checkout', requireSignIn, checkout); 7 | router.patch('/confirm-deal/:dealId', requireSignIn, confirmDeal); 8 | router.delete('/delete-unconfirmDeal/:dealId', requireSignIn, deleteUnconfirmDeal); 9 | router.get('/confirm-deals/:userId', requireSignIn, clientMiddleware, confirmDealsOfUser); 10 | router.get('/confirm-deals-dealer/:dealerId', requireSignIn, dealerMiddleware, confirmDealsOfDealer); 11 | router.get('/deal/:dealId', requireSignIn, getDeal); 12 | 13 | module.exports = router; -------------------------------------------------------------------------------- /client-side/src/components/UI/ImgsCard.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Carousel } from 'react-bootstrap'; 3 | 4 | const ImgsCard = (props) => { 5 | const { img1, img2, alt, style } = props; 6 | return ( 7 | 8 | 9 | {alt} 15 | 16 | 17 | {alt} 23 | 24 | 25 | ); 26 | } 27 | 28 | export { ImgsCard } -------------------------------------------------------------------------------- /models/deal.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const dealSchema = new mongoose.Schema({ 4 | userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, 5 | venueId: { type: mongoose.Schema.Types.ObjectId, ref: 'Venue', required: true }, 6 | venueName: { 7 | type: String, 8 | required: true 9 | }, 10 | venueOwnerId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, 11 | eventDate: { 12 | type: String, 13 | required: true 14 | }, 15 | bill: { 16 | type: Number, 17 | required: true 18 | }, 19 | status: { 20 | type: String, 21 | default: "blue" 22 | }, 23 | date_added: { 24 | type: Date, 25 | default: Date.now 26 | } 27 | }, { timestamps: true }); 28 | 29 | module.exports = mongoose.model('Deal', dealSchema); -------------------------------------------------------------------------------- /client-side/src/assets/images/dealer-signin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /client-side/src/reducers/dealsHistory.reducers.js: -------------------------------------------------------------------------------- 1 | import { dealsConstants } from '../actions/constants'; 2 | 3 | const initialState = { 4 | allDeals: {}, 5 | message: '' 6 | } 7 | 8 | const dealsReducer = (state = initialState, action) => { 9 | console.log(action); 10 | switch (action.type) { 11 | case dealsConstants.GET_DEALS_REQUEST: 12 | state = { 13 | ...state 14 | } 15 | break; 16 | 17 | case dealsConstants.GET_DEALS_SUCCESS: 18 | state = { 19 | ...state, 20 | allDeals: action.payload 21 | } 22 | break; 23 | 24 | case dealsConstants.GET_DEALS_FAILURE: 25 | state = { 26 | ...state, 27 | message: action.payload 28 | } 29 | break; 30 | 31 | default: 32 | break; 33 | } 34 | return state; 35 | } 36 | 37 | export default dealsReducer -------------------------------------------------------------------------------- /common_middlewares/index.js: -------------------------------------------------------------------------------- 1 | const jwt = require('jsonwebtoken'); 2 | 3 | const requireSignIn = (req, res, next) => { 4 | if (req.headers.authorization) { 5 | const token = req.headers.authorization.split(" ")[1]; 6 | const user = jwt.verify(token, process.env.jwt_secret); 7 | req.user = user; 8 | } else { 9 | res.status(400).json({ msg: `Authorization required` }); 10 | } 11 | next(); 12 | } 13 | 14 | const clientMiddleware = (req, res, next) => { 15 | if (req.user.role !== 'client') { 16 | res.status(400).json({ 17 | msg: 'User access denide' 18 | }) 19 | } 20 | next(); 21 | } 22 | const dealerMiddleware = (req, res, next) => { 23 | if (req.user.role !== 'dealer') { 24 | res.status(400).json({ 25 | msg: 'Dealer access denide' 26 | }) 27 | } 28 | next(); 29 | } 30 | 31 | module.exports = { 32 | requireSignIn, 33 | clientMiddleware, 34 | dealerMiddleware 35 | } -------------------------------------------------------------------------------- /client-side/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | import authReducer from './auth.reducers' 3 | import registerReducer from './register.reducers'; 4 | import userInfoReducer from './userInfo.reducers'; 5 | import venuesInfoReducer from './allVenues.reducers'; 6 | import oneVenueInfoReducer from './venue.reducers'; 7 | import getOwnerVenuesReducer from './ownerVenues.reducers'; 8 | import addVenueReducer from './addVenue.reducers'; 9 | import dealsReducer from './dealsHistory.reducers'; 10 | import serverReducer from './server.reducers'; 11 | 12 | const rootReducer = combineReducers({ 13 | auth: authReducer, 14 | registrationStatus: registerReducer, 15 | userInfo: userInfoReducer, 16 | allVenuesInfo: venuesInfoReducer, 17 | oneVenueInfo: oneVenueInfoReducer, 18 | ownerVenues: getOwnerVenuesReducer, 19 | addVenueStatus: addVenueReducer, 20 | deals: dealsReducer, 21 | serverStatus: serverReducer 22 | }); 23 | 24 | export default rootReducer -------------------------------------------------------------------------------- /client-side/src/components/UI/Input.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Form } from 'react-bootstrap'; 3 | 4 | const Input = (props) => { 5 | return ( 6 | 7 | {props.label} 8 | {props.isReadOnly ? 9 | 17 | : 18 | 25 | } 26 | 27 | ) 28 | } 29 | 30 | export default Input 31 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "venue_booking_site", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.server.js", 6 | "scripts": { 7 | "start": "nodemon index.server.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/akshay782/venue_booking_site.git" 12 | }, 13 | "author": "Akshay Kanade", 14 | "license": "ISC", 15 | "bugs": { 16 | "url": "https://github.com/akshay782/venue_booking_site/issues" 17 | }, 18 | "homepage": "https://github.com/akshay782/venue_booking_site#readme", 19 | "dependencies": { 20 | "bcrypt": "^5.0.1", 21 | "cors": "^2.8.5", 22 | "dotenv": "^10.0.0", 23 | "express": "^4.17.1", 24 | "express-validator": "^6.12.1", 25 | "jsonwebtoken": "^9.0.0", 26 | "mongoose": "^5.13.7", 27 | "multer": "^1.4.3", 28 | "shortid": "^2.2.16", 29 | "slugify": "^1.6.0", 30 | "stripe": "^8.176.0" 31 | }, 32 | "devDependencies": { 33 | "nodemon": "^2.0.12" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /client-side/src/reducers/register.reducers.js: -------------------------------------------------------------------------------- 1 | import { registerConstants } from "../actions/constants"; 2 | 3 | const initialState = { 4 | message: '', 5 | loading: false 6 | } 7 | 8 | const registerReducer = (state = initialState, action) => { 9 | switch (action.type) { 10 | case registerConstants.REGISTER_REQUEST: 11 | state = { 12 | ...state, 13 | loading: true 14 | } 15 | break; 16 | 17 | case registerConstants.REGISTER_SUCCESS: 18 | state = { 19 | loading: false, 20 | message: action.payload.msg 21 | } 22 | break; 23 | 24 | case registerConstants.REGISTER_FAILURE: 25 | state = { 26 | loading: false, 27 | message: action.payload.msg 28 | } 29 | break; 30 | 31 | default: 32 | break; 33 | } 34 | return state; 35 | } 36 | 37 | export default registerReducer -------------------------------------------------------------------------------- /client-side/src/actions/dealsHistory.actions.js: -------------------------------------------------------------------------------- 1 | import { dealsConstants } from "./constants"; 2 | import axios from '../helpers/axios'; 3 | 4 | const getDeals = (user_role, _id) => { 5 | return async (dispatch) => { 6 | dispatch({ 7 | type: dealsConstants.GET_DEALS_REQUEST 8 | }); 9 | 10 | let res = {} 11 | if (user_role === 'client') { 12 | res = await axios.get(`/confirm-deals/${_id}`) 13 | } 14 | if (user_role === 'dealer') { 15 | res = await axios.get(`/confirm-deals-dealer/${_id}`) 16 | } 17 | 18 | if (res.status === 200) { 19 | dispatch({ 20 | type: dealsConstants.GET_DEALS_SUCCESS, 21 | payload: res.data._allDeals 22 | }) 23 | } 24 | if (res.status === 400) { 25 | dispatch({ 26 | type: dealsConstants.GET_DEALS_FAILURE, 27 | payload: res.data.msg 28 | }) 29 | } 30 | } 31 | } 32 | 33 | export default getDeals -------------------------------------------------------------------------------- /routes/venue.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { requireSignIn, dealerMiddleware } = require('../common_middlewares/index') 3 | const { getAllVenues, createVenue, getVenueByVenueId, getAllVenuesByOwnerId, checkAvailability } = require('../controllers/venue'); 4 | const router = express.Router(); 5 | const multer = require('multer') 6 | const shortid = require('shortid') 7 | const path = require('path') 8 | 9 | const storage = multer.diskStorage({ 10 | destination: function (req, file, cb) { 11 | cb(null, path.join(path.dirname(__dirname), 'uploads')) 12 | }, 13 | filename: function (req, file, cb) { 14 | cb(null, shortid.generate() + '-' + file.originalname) 15 | } 16 | }) 17 | 18 | const upload = multer({ storage }); 19 | 20 | router.post('/create-venue', requireSignIn, dealerMiddleware, upload.array('venuePicture'), createVenue) 21 | router.get('/venue/:venueId', getVenueByVenueId) 22 | router.get('/venues/:ownerId', getAllVenuesByOwnerId) 23 | router.get('/all-venues', getAllVenues); 24 | router.get('/available', checkAvailability) 25 | 26 | module.exports = router; -------------------------------------------------------------------------------- /client-side/src/reducers/ownerVenues.reducers.js: -------------------------------------------------------------------------------- 1 | import { venueConstants } from "../actions/constants"; 2 | 3 | const initialState = { 4 | error: null, 5 | allvenues: {}, 6 | message: '', 7 | loading: false 8 | } 9 | 10 | const getOwnerVenuesReducer = (state = initialState, action) => { 11 | switch (action.type) { 12 | case venueConstants.GETALL_VENUES_OF_DEALER_REQUEST: 13 | state = { 14 | ...state, 15 | loading: true 16 | } 17 | break; 18 | 19 | case venueConstants.GETALL_VENUES_OF_DEALER_SUCCESS: 20 | state = { 21 | ...state, 22 | allvenues: action.payload, 23 | loading: false 24 | } 25 | break; 26 | 27 | case venueConstants.GETALL_VENUES_OF_DEALER_FAILURE: 28 | state = { 29 | ...state, 30 | loading: false 31 | } 32 | break; 33 | 34 | default: 35 | break; 36 | } 37 | return state; 38 | } 39 | 40 | export default getOwnerVenuesReducer -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Akshay Kanade 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /client-side/src/reducers/allVenues.reducers.js: -------------------------------------------------------------------------------- 1 | import { venueConstants } from '../actions/constants'; 2 | 3 | const initialState = { 4 | message: '', 5 | allVenues: [], 6 | loading: false 7 | } 8 | 9 | const venuesInfoReducer = (state = initialState, action) => { 10 | console.log(action); 11 | switch (action.type) { 12 | case venueConstants.GETALL_VENUES_REQUEST: 13 | state = { 14 | ...state, 15 | loading: true 16 | } 17 | break; 18 | case venueConstants.GETALL_VENUES_SUCCESS: 19 | state = { 20 | ...state, 21 | loading: false, 22 | allVenues: action.payload.slice(0).reverse() 23 | } 24 | break; 25 | case venueConstants.GETALL_VENUES_FAILURE: 26 | state = { 27 | ...state, 28 | loading: false, 29 | message: 'Something went wrong...!' 30 | } 31 | break; 32 | 33 | default: 34 | break; 35 | } 36 | return state; 37 | } 38 | 39 | export default venuesInfoReducer -------------------------------------------------------------------------------- /client-side/src/reducers/addVenue.reducers.js: -------------------------------------------------------------------------------- 1 | import { addVenueConstants } from '../actions/constants'; 2 | 3 | const initialState = { 4 | error: null, 5 | message: '', 6 | saving: false 7 | } 8 | 9 | const addVenueReducer = (state = initialState, action) => { 10 | switch (action.type) { 11 | case addVenueConstants.ADD_VENUE_REQUEST: 12 | state = { 13 | ...state, 14 | saving: true, 15 | } 16 | break; 17 | 18 | case addVenueConstants.ADD_VENUE_SUCCESS: 19 | state = { 20 | ...state, 21 | saving: false, 22 | message: '🎉Venue added successfully! Refresh this page' 23 | } 24 | break; 25 | 26 | case addVenueConstants.ADD_VENUE_FAILURE: 27 | state = { 28 | ...state, 29 | error: action.payload.error, 30 | message: action.payload.msg, 31 | saving: false 32 | } 33 | break; 34 | 35 | default: 36 | break; 37 | } 38 | return state; 39 | } 40 | 41 | export default addVenueReducer -------------------------------------------------------------------------------- /client-side/src/actions/userInfo.actions.js: -------------------------------------------------------------------------------- 1 | import { userInfoConstants } from "./constants"; 2 | import axios from '../helpers/axios'; 3 | 4 | const userInfo = (_id, userType) => { 5 | return async (dispatch) => { 6 | dispatch({ 7 | type: userInfoConstants.USER_INFO_REQUEST 8 | }); 9 | 10 | let res = {}; 11 | if (userType === 'client') { 12 | res = await axios.get(`/user/${_id}`); 13 | } 14 | if (userType === 'dealer') { 15 | res = await axios.get(`/dealer/${_id}`); 16 | } 17 | 18 | if (res.status === 200) { 19 | dispatch({ 20 | type: userInfoConstants.USER_INFO_SUCCESS, 21 | payload: { user: res.data.user } 22 | }); 23 | } else { 24 | if (res.status === 404) { 25 | console.log(res); 26 | dispatch({ 27 | type: userInfoConstants.USER_INFO_FAILURE, 28 | payload: { 29 | error: res.data.error 30 | } 31 | }); 32 | } 33 | } 34 | } 35 | } 36 | 37 | export { 38 | userInfo 39 | } -------------------------------------------------------------------------------- /client-side/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client-side", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.14.1", 7 | "@testing-library/react": "^11.2.7", 8 | "@testing-library/user-event": "^12.8.3", 9 | "axios": "^0.21.2", 10 | "bootstrap": "^5.1.0", 11 | "boring-avatars": "^1.5.8", 12 | "react": "^17.0.2", 13 | "react-bootstrap": "^1.6.1", 14 | "react-dom": "^17.0.2", 15 | "react-redux": "^7.2.4", 16 | "react-router-dom": "^5.2.1", 17 | "react-scripts": "5.0.1", 18 | "redux": "^4.1.1", 19 | "redux-thunk": "^2.3.0", 20 | "web-vitals": "^1.1.2" 21 | }, 22 | "scripts": { 23 | "start": "react-scripts start", 24 | "build": "react-scripts build", 25 | "test": "react-scripts test", 26 | "eject": "react-scripts eject" 27 | }, 28 | "eslintConfig": { 29 | "extends": [ 30 | "react-app", 31 | "react-app/jest" 32 | ] 33 | }, 34 | "browserslist": { 35 | "production": [ 36 | ">0.2%", 37 | "not dead", 38 | "not op_mini all" 39 | ], 40 | "development": [ 41 | "last 1 chrome version", 42 | "last 1 firefox version", 43 | "last 1 safari version" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Venue Booking site 2 | 3 | ## Local Setup 4 | 5 | 1. clone it 6 | 7 | ```bash 8 | git clone https://github.com/akshay782/venue_booking_site.git 9 | # go to project directory 10 | cd venue_booking_site 11 | ``` 12 | 13 | 2. Install packages 14 | 15 | - Backend => In root directory run following command 16 | - Frontend => In client-side folder run same following command 17 | 18 | ```bash 19 | npm install 20 | ``` 21 | 22 | 3. Create `.env` file in the root directory and add following variables 23 | 24 | ```bash 25 | dburl = 'your mongodb cluster url' 26 | PORT = 'the port in which you want to run your nodejs/backend' 27 | jwt_secret = 'your jwt secret' 28 | ``` 29 | 30 | 4. Run it 🚴‍♂️ 31 | 32 | - Backend => First run following command in root directory, it will start server on port 2000 33 | - Frontend => Second run same command in client side folder on another terminal, it will lauch react app 34 | 35 | ```bash 36 | npm start 37 | ``` 38 | 39 | ## To commit and push changes 40 | 41 | Before you start working \ 42 | Always - 43 | 44 | ```bash 45 | git pull 46 | ``` 47 | 48 | After you done making some changes 49 | 50 | ```bash 51 | git checkout -b 52 | git add . 53 | git commit -m "message" 54 | git push 55 | ``` 56 | 57 | - **Note** \ 58 | Please don't commit on **main** branch 59 | -------------------------------------------------------------------------------- /models/venue.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const venueSchema = new mongoose.Schema({ 4 | venueName: { 5 | type: String, 6 | required: true, 7 | trim: true, 8 | min: 2, max: 50 9 | }, 10 | slug: { 11 | type: String, 12 | required: true, 13 | unique: true 14 | }, 15 | description: { 16 | type: String, 17 | required: true 18 | }, 19 | address: { 20 | type: String, 21 | required: true, 22 | trim: true, 23 | max: 70 24 | }, 25 | location: { 26 | type: String, 27 | required: true 28 | }, 29 | category: { 30 | type: String, 31 | required: true 32 | }, 33 | price: { 34 | type: Number, 35 | }, 36 | venuePictures: [ 37 | { img: { type: String } } 38 | ], 39 | reviews: [ 40 | { 41 | userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, 42 | review: String 43 | } 44 | ], 45 | ownerId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, 46 | ownerInfo: { 47 | ownerName: String, 48 | contactNumber: String 49 | } 50 | }, { timestamps: true }); 51 | 52 | module.exports = mongoose.model('Venue', venueSchema); -------------------------------------------------------------------------------- /client-side/src/helpers/axios.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import { api } from '../urlConfig'; 3 | import store from '../store'; 4 | import { authConstants, serverConstants } from '../actions/constants'; 5 | 6 | const token = window.localStorage.getItem('token'); 7 | 8 | const axiosInstance = axios.create({ 9 | baseURL: api, 10 | headers: { 11 | 'Authorization': token ? `Bearer ${token}` : '' 12 | } 13 | }) 14 | 15 | axiosInstance.interceptors.request.use((req) => { 16 | const { auth } = store.getState(); 17 | if (auth.token) { 18 | req.headers.Authorization = `Bearer ${auth.token}`; 19 | } 20 | return req; 21 | }) 22 | 23 | axiosInstance.interceptors.response.use((res) => { 24 | return res; 25 | }, (error) => { 26 | if (error.response === undefined) { 27 | store.dispatch({ 28 | type: serverConstants.SERVER_OFFLINE, 29 | payload: { 30 | msg: "Server is not running😢" 31 | } 32 | }) 33 | } else { 34 | const { status } = error.response; 35 | if (status === 500 || status === 400) { 36 | localStorage.clear(); 37 | store.dispatch({ type: authConstants.LOGOUT_SUCCESS }); 38 | } 39 | } 40 | return Promise.reject(error); 41 | }) 42 | 43 | export default axiosInstance -------------------------------------------------------------------------------- /client-side/src/reducers/userInfo.reducers.js: -------------------------------------------------------------------------------- 1 | import { userInfoConstants } from "../actions/constants" 2 | 3 | const initialState = { 4 | error: null, 5 | message: '', 6 | user: { 7 | _id: '', 8 | fullName: '', 9 | role: '', 10 | email: '', 11 | createdAt: '', 12 | userName: '', 13 | contactNumber: '', 14 | }, 15 | loading: false 16 | } 17 | 18 | const userInfoReducer = (state = initialState, action) => { 19 | console.log(action); 20 | switch (action.type) { 21 | case userInfoConstants.USER_INFO_REQUEST: 22 | state = { 23 | ...state, 24 | loading: true 25 | } 26 | break; 27 | 28 | case userInfoConstants.USER_INFO_SUCCESS: 29 | state = { 30 | ...state, 31 | loading: false, 32 | user: action.payload.user 33 | } 34 | break; 35 | 36 | case userInfoConstants.USER_INFO_FAILURE: 37 | state = { 38 | ...state, 39 | loading: false, 40 | error: action.payload.error 41 | } 42 | break; 43 | 44 | default: 45 | break; 46 | } 47 | return state; 48 | } 49 | 50 | export default userInfoReducer -------------------------------------------------------------------------------- /client-side/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { Route, Switch } from 'react-router-dom'; 3 | import PrivateRoute from './components/HOC/PrivateRoute'; 4 | import Home from './containers/Home'; 5 | import Signin from './containers/Signin'; 6 | import { useDispatch } from 'react-redux'; 7 | import { isUserLoggedIn } from './actions/auth.actions'; 8 | import Signup from './containers/Signup'; 9 | import ProfilePage from './containers/Profile'; 10 | import VenuePage from './containers/Venue'; 11 | import { PaymentStatus } from './containers/PaymentStatus'; 12 | 13 | function App() { 14 | 15 | const dispatch = useDispatch(); 16 | const auth = useDispatch(state => state.auth) 17 | 18 | useEffect(() => { 19 | if (!auth.authenticate) { 20 | dispatch(isUserLoggedIn()) 21 | } 22 | }, []) 23 | 24 | return ( 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | ); 36 | } 37 | 38 | export default App; 39 | -------------------------------------------------------------------------------- /client-side/src/reducers/venue.reducers.js: -------------------------------------------------------------------------------- 1 | import { venueConstants } from "../actions/constants"; 2 | 3 | const initialState = { 4 | venue: { 5 | _id: '', 6 | venueName: '', 7 | description: '', 8 | address: '', 9 | location: '', 10 | category: '', 11 | price: '', 12 | venuePictures: [], 13 | ownerInfo: {}, 14 | reviews: [], 15 | ownerId: '' 16 | }, 17 | error: null, 18 | message: '', 19 | loading: false 20 | } 21 | 22 | const oneVenueInfoReducer = (state = initialState, action) => { 23 | switch (action.type) { 24 | case venueConstants.GETONE_VENUE_REQUEST: 25 | state = { 26 | ...state, 27 | loading: true 28 | } 29 | break; 30 | case venueConstants.GETONE_VENUE_SUCCESS: 31 | state = { 32 | ...state, 33 | venue: action.payload.venue, 34 | loading: false 35 | } 36 | break; 37 | case venueConstants.GETONE_VENUE_FAILURE: 38 | state = { 39 | ...state, 40 | loading: false, 41 | message: action.payload.msg 42 | } 43 | break; 44 | 45 | default: 46 | break; 47 | } 48 | return state; 49 | } 50 | 51 | export default oneVenueInfoReducer -------------------------------------------------------------------------------- /client-side/src/actions/register.actions.js: -------------------------------------------------------------------------------- 1 | import { registerConstants } from './constants'; 2 | import axios from '../helpers/axios'; 3 | 4 | const userRegister = (userInfo) => { 5 | console.log(userInfo); 6 | return async (dispatch) => { 7 | dispatch({ 8 | type: registerConstants.REGISTER_REQUEST 9 | }); 10 | 11 | try { 12 | let res = {}; 13 | if (userInfo.userType === 'client') { 14 | res = await axios.post('/signup', { 15 | ...userInfo 16 | }); 17 | } 18 | if (userInfo.userType === 'dealer') { 19 | res = await axios.post('/dealer/signup', { 20 | ...userInfo 21 | }); 22 | } 23 | 24 | if (res.status === 201) { 25 | const { msg } = res.data; 26 | dispatch({ 27 | type: registerConstants.REGISTER_SUCCESS, 28 | payload: { msg } 29 | }) 30 | } 31 | } catch (error) { 32 | console.log(error); 33 | dispatch({ 34 | type: registerConstants.REGISTER_FAILURE, 35 | payload: { 36 | msg: "User already register !!" 37 | } 38 | }) 39 | } 40 | } 41 | } 42 | 43 | export { 44 | userRegister 45 | } -------------------------------------------------------------------------------- /index.server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const env = require('dotenv'); 3 | const app = express(); 4 | const mongoose = require('mongoose'); 5 | const path = require('path'); 6 | const cors = require('cors'); 7 | 8 | // enviourment variables 9 | env.config(); 10 | 11 | //middlewares 12 | app.use(cors()); 13 | app.use(express.json()); 14 | 15 | // Routes 16 | const dealerAuthRoutes = require('./routes/dealer.auth'); 17 | const clientAuthRoutes = require('./routes/client.auth'); 18 | const venueRoutes = require('./routes/venue'); 19 | const dealsRoutes = require('./routes/deal'); 20 | 21 | app.use("/public", express.static(path.join(__dirname, "uploads"))); 22 | app.use('/api', dealerAuthRoutes); 23 | app.use('/api', clientAuthRoutes); 24 | app.use('/api', venueRoutes); 25 | app.use('/api', dealsRoutes); 26 | 27 | // mongodb connection 28 | const connectDB = (dburl) => { 29 | return mongoose.connect(dburl, { 30 | useNewUrlParser: true, 31 | useUnifiedTopology: true, 32 | useCreateIndex: true, 33 | useFindAndModify: false, 34 | }).then(() => { 35 | console.log('Database Connected'); 36 | }) 37 | } 38 | 39 | const start = async () => { 40 | try { 41 | await connectDB(process.env.dburl); 42 | app.listen(process.env.PORT, () => { 43 | console.log(`Server is running on port ${process.env.PORT}`); 44 | }) 45 | } catch (error) { 46 | console.log(error); 47 | } 48 | } 49 | 50 | start(); 51 | -------------------------------------------------------------------------------- /client-side/src/containers/PaymentStatus.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Button, Spinner, Container } from 'react-bootstrap'; 3 | import { useDispatch } from 'react-redux'; 4 | import { Link, Redirect } from 'react-router-dom'; 5 | import { paymentSuccess, paymentCanceled } from '../actions/checkout.actions'; 6 | 7 | const PaymentStatus = () => { 8 | const dispatch = useDispatch(); 9 | const [checkoutMessage, setCheckoutMessage] = useState(""); 10 | 11 | useEffect(() => { 12 | const query = new URLSearchParams(window.location.search); 13 | if (query.get("success")) { 14 | dispatch(paymentSuccess(JSON.parse(localStorage.getItem("dealId")))); 15 | setCheckoutMessage("Booking confirmed 😇 !!") 16 | } 17 | 18 | if (query.get("canceled")) { 19 | dispatch(paymentCanceled(JSON.parse(localStorage.getItem("dealId")))); 20 | setCheckoutMessage("Failed to book the venue 😥 !!") 21 | } 22 | localStorage.removeItem("dealId"); 23 | }, []) 24 | 25 | return ( 26 | 27 | { 28 | checkoutMessage === "Booking confirmed 😇 !!" ? 29 |

{checkoutMessage}

30 | : 31 |

{checkoutMessage}

32 | } 33 | 34 | 🏡 Home Page 35 |
36 | ) 37 | } 38 | 39 | export { 40 | PaymentStatus 41 | } -------------------------------------------------------------------------------- /models/user.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const bcrypt = require('bcrypt') 3 | 4 | const userSchema = new mongoose.Schema({ 5 | firstName: { 6 | type: String, 7 | required: true, 8 | trim: true, 9 | min: 2, 10 | max: 20 11 | }, 12 | lastName: { 13 | type: String, 14 | required: true, 15 | trim: true, 16 | min: 2, 17 | max: 20 18 | }, 19 | username: { 20 | type: String, 21 | required: true, 22 | trim: true, 23 | unique: true, 24 | index: true, 25 | lowercase: true 26 | }, 27 | role: { 28 | type: String, 29 | default: 'client' 30 | }, 31 | email: { 32 | type: String, 33 | required: true, 34 | unique: true, 35 | trim: true, 36 | unique: true, 37 | lowercase: true 38 | }, 39 | hash_password: { 40 | type: String, 41 | required: true, 42 | }, 43 | profilePicture: { 44 | type: String, 45 | }, 46 | contactNumber: { 47 | type: String, 48 | required: true 49 | } 50 | }, { timestamps: true }); 51 | 52 | userSchema.virtual('password') 53 | .set(function (password) { 54 | this.hash_password = bcrypt.hashSync(password, 10); 55 | }); 56 | 57 | userSchema.virtual('fullName') 58 | .get(function () { 59 | return `${this.firstName} ${this.lastName}` 60 | }); 61 | 62 | userSchema.methods = { 63 | authenticate: function (password) { 64 | return bcrypt.compareSync(password, this.hash_password); 65 | } 66 | } 67 | 68 | module.exports = mongoose.model('User', userSchema); -------------------------------------------------------------------------------- /client-side/src/reducers/auth.reducers.js: -------------------------------------------------------------------------------- 1 | import { authConstants } from '../actions/constants'; 2 | 3 | const initialState = { 4 | token: null, 5 | user: { 6 | firstName: '', 7 | lastName: '', 8 | email: '', 9 | _id: '', 10 | role: '', 11 | profilePicture: '' 12 | }, 13 | authenticate: false, 14 | authenticating: false, 15 | loading: false, 16 | error: null, 17 | message: '' 18 | } 19 | 20 | const authReducer = (state = initialState, action) => { 21 | console.log(action); 22 | switch (action.type) { 23 | case authConstants.LOGIN_REQUEST: 24 | state = { 25 | ...state, 26 | authenticating: true 27 | } 28 | break; 29 | 30 | case authConstants.LOGIN_SUCCESS: 31 | state = { 32 | ...state, 33 | user: action.payload.user, 34 | token: action.payload.token, 35 | authenticate: true, 36 | authenticating: false 37 | } 38 | break; 39 | 40 | case authConstants.LOGIN_FAILURE: 41 | state = { 42 | ...state, 43 | message: action.payload.msg 44 | } 45 | break; 46 | 47 | case authConstants.LOGOUT_REQUEST: 48 | state = { 49 | ...state, 50 | loading: true 51 | } 52 | break; 53 | 54 | case authConstants.LOGOUT_SUCCESS: 55 | state = { 56 | ...initialState, 57 | } 58 | break; 59 | 60 | case authConstants.LOGOUT_FAILURE: 61 | state = { 62 | ...state, 63 | error: action.payload.error, 64 | loading: false 65 | } 66 | break; 67 | 68 | default: 69 | break; 70 | } 71 | return state 72 | } 73 | 74 | export default authReducer 75 | -------------------------------------------------------------------------------- /client-side/src/components/UI/ProfileCards.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Avatar from 'boring-avatars'; 3 | 4 | const ProfileCard = (props) => { 5 | const { fullName, email, contactNumber } = props; 6 | return ( 7 |
8 |
9 |
10 | 16 |
17 |

{fullName}

18 |

Email - {email}

19 |

Contact no - {contactNumber}

20 |
21 |
22 |
23 |
24 | ); 25 | } 26 | 27 | const UserInfoCard = (props) => { 28 | const { role, username, createdAt } = props; 29 | return ( 30 |
31 |
    32 |
  • 33 |
    User Type
    34 | {role} 35 |
  • 36 |
  • 37 |
    Username
    38 | {username} 39 |
  • 40 |
  • 41 |
    User since
    42 | {createdAt} 43 |
  • 44 |
45 |
46 | ) 47 | } 48 | 49 | 50 | export { 51 | ProfileCard, 52 | UserInfoCard 53 | } 54 | -------------------------------------------------------------------------------- /client-side/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 25 | 27 | 28 | 29 | 30 | 31 | KAPPA 32 | 33 | 34 | 35 | 36 |
37 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /client-side/src/actions/constants.js: -------------------------------------------------------------------------------- 1 | const authConstants = { 2 | LOGIN_REQUEST: 'LOGIN_REQUEST', 3 | LOGIN_FAILURE: 'LOGIN_FAILURE', 4 | LOGIN_SUCCESS: 'LOGIN_SUCCESS', 5 | LOGOUT_REQUEST: 'LOGOUT_REQUEST', 6 | LOGOUT_SUCCESS: 'LOGOUT_SUCCESS', 7 | LOGOUT_FAILURE: 'LOGOUT_FAILURE', 8 | } 9 | 10 | const registerConstants = { 11 | REGISTER_REQUEST: 'REGISTER_REQUEST', 12 | REGISTER_FAILURE: 'REGISTER_FAILURE', 13 | REGISTER_SUCCESS: 'REGISTER_SUCCESS' 14 | } 15 | 16 | const userInfoConstants = { 17 | USER_INFO_REQUEST: 'USER_INFO_REQUEST', 18 | USER_INFO_FAILURE: 'USER_INFO_FAILURE', 19 | USER_INFO_SUCCESS: 'USER_INFO_SUCCESS' 20 | } 21 | 22 | const venueConstants = { 23 | GETALL_VENUES_REQUEST: 'GETALL_VENUES_REQUEST', 24 | GETALL_VENUES_SUCCESS: 'GETALL_VENUES_SUCCESS', 25 | GETALL_VENUES_FAILURE: 'GETALL_VENUES_FAILURE', 26 | 27 | GETONE_VENUE_REQUEST: 'GETONE_VENUE_REQUEST', 28 | GETONE_VENUE_FAILURE: 'GETONE_VENUE_FAILURE', 29 | GETONE_VENUE_SUCCESS: 'GETONE_VENUE_SUCCESS', 30 | 31 | GETALL_VENUES_OF_DEALER_REQUEST: 'GETALL_VENUES_OF_DEALER_REQUEST', 32 | GETALL_VENUES_OF_DEALER_FAILURE: 'GETALL_VENUES_OF_DEALER_FAILURE', 33 | GETALL_VENUES_OF_DEALER_SUCCESS: 'GETALL_VENUES_OF_DEALER_SUCCESS' 34 | } 35 | 36 | const addVenueConstants = { 37 | ADD_VENUE_REQUEST: 'ADD_VENUE_REQUEST', 38 | ADD_VENUE_FAILURE: 'ADD_VENUE_FAILURE', 39 | ADD_VENUE_SUCCESS: 'ADD_VENUE_SUCCESS', 40 | } 41 | 42 | const dealsConstants = { 43 | GET_DEALS_REQUEST: 'DEALS_REQUEST', 44 | GET_DEALS_FAILURE: 'DEALS_FAILURE', 45 | GET_DEALS_SUCCESS: 'DEALS_SUCCESS' 46 | } 47 | 48 | const saveDealConstants = { 49 | SAVE_DEAL_REQUEST: 'SAVE_DEAL_REQUEST', 50 | SAVE_DEAL_FAILURE: 'SAVE_DEAL_FAILURE', 51 | SAVE_DEAL_SUCCESS: 'SAVE_DEAL_SUCCESS', 52 | } 53 | const deleteDealConstants = { 54 | DELETE_DEAL_REQUEST: 'DELETE_DEAL_REQUEST', 55 | DELETE_DEAL_FAILURE: 'DELETE_DEAL_FAILURE', 56 | DELETE_DEAL_SUCCESS: 'DELETE_DEAL_SUCCESS', 57 | } 58 | 59 | const serverConstants = { 60 | SERVER_OFFLINE: 'SERVER_OFFLINE' 61 | } 62 | 63 | export { 64 | authConstants, 65 | registerConstants, 66 | userInfoConstants, 67 | venueConstants, 68 | addVenueConstants, 69 | dealsConstants, 70 | saveDealConstants, 71 | deleteDealConstants, 72 | serverConstants 73 | } 74 | 75 | -------------------------------------------------------------------------------- /client-side/src/components/UI/LoginModel.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Modal, Button, Form } from 'react-bootstrap'; 3 | import Input from './Input'; 4 | import { userlogin } from '../../actions/auth.actions'; 5 | import { useSelector, useDispatch } from 'react-redux'; 6 | 7 | const LoginModel = (props) => { 8 | 9 | const [email, setEmail] = useState(''); 10 | const [password, setPassword] = useState(''); 11 | const [errorMessage, setErrorMessage] = useState(''); 12 | 13 | const auth = useSelector(state => state.auth); 14 | const dispatch = useDispatch(); 15 | 16 | const userLogin = (e) => { 17 | e.preventDefault(); 18 | const user = { email, password } 19 | dispatch(userlogin(user, props.userType)); 20 | } 21 | 22 | return ( 23 | 29 | 30 | 31 | {props.title} 32 | 33 | 34 | 35 | 36 |
37 | setEmail(e.target.value)} 43 | /> 44 | setPassword(e.target.value)} 50 | /> 51 | { 52 | auth.message === '' ? 53 | null 54 | : 55 |
{errorMessage}
56 | } 57 | 60 |
61 |
62 |
63 | ) 64 | } 65 | 66 | export { 67 | LoginModel 68 | } -------------------------------------------------------------------------------- /client-side/src/components/UI/DealsHistory.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Table } from 'react-bootstrap'; 3 | import { isEmpty } from '../../helpers/isObjEmpty'; 4 | 5 | const DealsHistory = (props) => { 6 | return ( 7 |
8 |

Last few bookings

9 | { 10 | isEmpty(props.allDeals) ? 11 |
12 | { 13 | props.role === 'client' ? 14 | `You didn't booked any venues` 15 | : 16 | `Currently you don't have any bookings` 17 | } 18 |
19 | : 20 | 21 | 22 | 23 | 24 | 25 | 26 | { 27 | props.role === 'dealer' ? 28 | : 29 | } 30 | 31 | 32 | 33 | 34 | { 35 | props.allDeals.map((deal) => { 36 | const { date_added, venueName, eventDate, bill } = deal; 37 | return ( 38 | 39 | 40 | 41 | 42 | 43 | 46 | 47 | ) 48 | }) 49 | } 50 | 51 |
Deal DateVenue NameEvent DatePer deal revenueBill per deal
{date_added}{venueName}{eventDate}{bill} 44 | 45 |
52 | } 53 | 54 |
55 | ) 56 | } 57 | 58 | export { DealsHistory } 59 | -------------------------------------------------------------------------------- /client-side/src/actions/checkout.actions.js: -------------------------------------------------------------------------------- 1 | import { saveDealConstants, deleteDealConstants } from './constants'; 2 | import axios from '../helpers/axios'; 3 | 4 | const paymentSuccess = (dealId) => { 5 | return async (dispatch) => { 6 | dispatch({ 7 | type: saveDealConstants.SAVE_DEAL_REQUEST 8 | }); 9 | 10 | try { 11 | const res = await axios.patch(`/confirm-deal/${dealId}`); 12 | if (res.status === 200) { 13 | dispatch({ 14 | type: saveDealConstants.SAVE_DEAL_SUCCESS 15 | }) 16 | } 17 | } catch (error) { 18 | dispatch({ 19 | type: saveDealConstants.SAVE_DEAL_FAILURE 20 | }) 21 | } 22 | } 23 | } 24 | 25 | const paymentCanceled = (dealId) => { 26 | return async (dispatch) => { 27 | dispatch({ 28 | type: deleteDealConstants.DELETE_DEAL_REQUEST 29 | }); 30 | 31 | try { 32 | const res = await axios.delete(`delete-unconfirmDeal/${dealId}`); 33 | if (res.status === 200) { 34 | dispatch({ 35 | type: deleteDealConstants.DELETE_DEAL_SUCCESS 36 | }) 37 | } 38 | } catch (error) { 39 | dispatch({ 40 | type: deleteDealConstants.DELETE_DEAL_FAILURE 41 | }) 42 | } 43 | } 44 | } 45 | 46 | // const gotoCheckout = (dealInfo) => { 47 | // console.log(dealInfo); 48 | // return async (dispatch) => { 49 | // dispatch({ 50 | // type: checkoutConstants.CHECKOUT_REQUEST 51 | // }); 52 | 53 | // try { 54 | // const res = await axios.post(`/checkout`, dealInfo); 55 | 56 | // if (res.status === 201) { 57 | // localStorage.setItem('dealId', JSON.stringify(res.data.dealId)); 58 | // dispatch({ 59 | // type: checkoutConstants.CHECKOUT_SUCCESS, 60 | // payload: { 61 | // url: res.data.url, 62 | // dealId: res.data.dealId 63 | // } 64 | // }) 65 | // } else { 66 | // dispatch({ 67 | // type: checkoutConstants.CHECKOUT_FAILURE, 68 | // paylaod: { 69 | // error: res.data.msg 70 | // } 71 | // }) 72 | // } 73 | // } catch { 74 | // dispatch({ 75 | // type: checkoutConstants.CHECKOUT_FAILURE, 76 | // paylaod: { 77 | // error: "Something went wrong" 78 | // } 79 | // }) 80 | // } 81 | // } 82 | // } 83 | 84 | export { 85 | paymentSuccess, 86 | paymentCanceled 87 | } -------------------------------------------------------------------------------- /client-side/src/containers/Signin.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import Layout from '../components/Layout/index.layout' 3 | import { Button, Container, Row, Col, Card } from 'react-bootstrap'; 4 | import { Redirect } from 'react-router-dom'; 5 | import { useSelector } from 'react-redux'; 6 | import { LoginModel } from '../components/UI/LoginModel'; 7 | 8 | // Images 9 | import client_signin from '../assets/images/client-signin.svg'; 10 | import dealer_signin from '../assets/images/dealer-signin.svg'; 11 | 12 | const Signin = () => { 13 | document.title = "KAPPA | Sign In"; 14 | const [userModalShow, setUserModalShow] = useState(false); 15 | const [DealerModalShow, setDealerModalShow] = useState(false); 16 | 17 | const auth = useSelector(state => state.auth); 18 | if (auth.authenticate) { 19 | return 20 | } 21 | 22 | return ( 23 | 24 | 25 |

✨Log In Options✨

26 |
27 | 28 | 29 | 30 | < Card.Img variant="top" src={client_signin} /> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | < Card.Img variant="top" src={dealer_signin} /> 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | setUserModalShow(false)} 50 | title='🛑 User/Client Sign In' 51 | userType='client' 52 | /> 53 | setDealerModalShow(false)} 56 | title='🛑 Dealer/Renter Sign In' 57 | userType='dealer' 58 | /> 59 |
60 |
61 | ) 62 | } 63 | 64 | export default Signin 65 | -------------------------------------------------------------------------------- /client-side/src/components/UI/VenueCard.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Button } from 'react-bootstrap'; 3 | import { Link } from 'react-router-dom'; 4 | import { getOneVenue } from '../../actions/venue.actions'; 5 | import { getPublicURL } from '../../urlConfig'; 6 | import { ImgsCard } from './ImgsCard'; 7 | import { useDispatch, useSelector } from 'react-redux'; 8 | import BookingModel from './BookingModel'; 9 | 10 | const VenueCard = (props) => { 11 | 12 | const [bookingModalShow, setBookingModalShow] = useState(false); 13 | const { img1, img2, category, venueName, ownerId, _id, price, location, address, style, isDelete } = props; 14 | 15 | const auth = useSelector(state => state.auth); 16 | 17 | const dispatch = useDispatch() 18 | const getVenueInfo = () => { 19 | dispatch(getOneVenue(_id)); 20 | } 21 | 22 | return ( 23 |
24 | 30 |
31 |
{category}
32 |
33 |
{venueName}
34 |
₹ {price}
35 |
36 |
{location}, {address}
37 | 38 |
39 | 40 | {' '} 41 | 42 | { 43 | isDelete === true ? 44 | 45 | : 46 | auth.user.role === 'dealer' ? 47 | <> 48 | : 49 | 50 | } 51 | setBookingModalShow(false)} 61 | /> 62 |
63 |
64 |
65 | ) 66 | } 67 | 68 | export default VenueCard -------------------------------------------------------------------------------- /client-side/src/containers/Home.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import Layout from '../components/Layout/index.layout'; 3 | import { Container, Spinner } from 'react-bootstrap'; 4 | import VenueCard from '../components/UI/VenueCard'; 5 | import { useDispatch, useSelector } from 'react-redux'; 6 | import { getVenues } from '../actions/venue.actions'; 7 | import { getPublicURL } from '../urlConfig'; 8 | import { isEmpty } from '../helpers/isObjEmpty'; 9 | 10 | function Home() { 11 | document.title = "KAPPA | Home"; 12 | const allVenuesInfo = useSelector(state => state.allVenuesInfo); 13 | const auth = useSelector(state => state.auth); 14 | const dispatch = useDispatch(); 15 | 16 | useEffect(() => { 17 | dispatch(getVenues()); 18 | }, []); 19 | 20 | if (allVenuesInfo.loading) { 21 | return ( 22 | 23 |
24 |

Getting all venues 🎉

25 | 26 |
27 |
28 | ); 29 | } 30 | 31 | return ( 32 | 33 | 34 |
35 | { 36 | isEmpty(allVenuesInfo.allVenues) ? 37 |
38 |

39 | No Venues currently😢

40 | Check again after sometime 41 |

42 |
43 | : 44 | allVenuesInfo.allVenues.map((venue) => { 45 | const { _id, venueName, address, location, category, price, venuePictures, ownerId } = venue; 46 | return ( 47 |
48 | 61 |
62 | ) 63 | }) 64 | } 65 |
66 |
67 |
68 | ) 69 | } 70 | 71 | export default Home 72 | -------------------------------------------------------------------------------- /client-side/src/actions/auth.actions.js: -------------------------------------------------------------------------------- 1 | import { authConstants } from './constants'; 2 | import axios from '../helpers/axios'; 3 | 4 | const userlogin = (user, userType) => { 5 | return async (dispatch) => { 6 | dispatch({ 7 | type: authConstants.LOGIN_REQUEST 8 | }); 9 | try { 10 | let res = {}; 11 | if (userType === 'client') { 12 | res = await axios.post('/signin', { 13 | ...user 14 | }); 15 | } 16 | if (userType === 'dealer') { 17 | res = await axios.post('/dealer/signin', { 18 | ...user 19 | }); 20 | } 21 | if (res.status === 200) { 22 | const { token, user } = res.data; 23 | localStorage.setItem('token', token); 24 | localStorage.setItem('user', JSON.stringify(user)); 25 | dispatch({ 26 | type: authConstants.LOGIN_SUCCESS, 27 | payload: { 28 | token, user 29 | } 30 | }); 31 | } 32 | // => This code is not working 33 | // if (res.status === 404) { 34 | // console.log(res.data.error); 35 | // dispatch({ 36 | // type: authConstants.LOGIN_FAILURE, 37 | // payload: { 38 | // msg: res.data.msg 39 | // } 40 | // }) 41 | // } 42 | } catch (error) { 43 | dispatch({ 44 | type: authConstants.LOGIN_FAILURE, 45 | payload: { 46 | msg: "Password is incorrect or You are not register" 47 | } 48 | }) 49 | } 50 | } 51 | 52 | } 53 | 54 | const isUserLoggedIn = () => { 55 | return async (dispatch) => { 56 | const token = localStorage.getItem('token'); 57 | if (token) { 58 | const user = JSON.parse(localStorage.getItem('user')); 59 | dispatch({ 60 | type: authConstants.LOGIN_SUCCESS, 61 | payload: { 62 | token, user 63 | } 64 | }); 65 | } else { 66 | dispatch({ 67 | type: authConstants.LOGIN_FAILURE, 68 | payload: { 69 | error: 'Failed to login' 70 | } 71 | }) 72 | } 73 | } 74 | } 75 | 76 | const signout = () => { 77 | return async (dispatch) => { 78 | dispatch({ 79 | type: authConstants.LOGIN_REQUEST 80 | }); 81 | const res = await axios.post('/sign-out'); 82 | if (res.status === 200) { 83 | localStorage.clear(); 84 | dispatch({ 85 | type: authConstants.LOGOUT_SUCCESS 86 | }); 87 | } else { 88 | dispatch({ 89 | type: authConstants.LOGOUT_FAILURE, 90 | payload: { error: res.data.error } 91 | }); 92 | } 93 | } 94 | } 95 | 96 | export { 97 | userlogin, 98 | isUserLoggedIn, 99 | signout 100 | } -------------------------------------------------------------------------------- /client-side/src/actions/venue.actions.js: -------------------------------------------------------------------------------- 1 | import { venueConstants, addVenueConstants } from "./constants"; 2 | import axios from '../helpers/axios'; 3 | 4 | const addVenue = (form) => { 5 | return async (dispatch) => { 6 | dispatch({ 7 | type: addVenueConstants.ADD_VENUE_REQUEST 8 | }); 9 | 10 | const res = await axios.post(`/create-venue`, form); 11 | 12 | if (res.status === 201) { 13 | dispatch({ 14 | type: addVenueConstants.ADD_VENUE_SUCCESS, 15 | payload: res.data._venue 16 | }); 17 | } else { 18 | dispatch({ 19 | type: addVenueConstants.ADD_VENUE_FAILURE, 20 | payload: { 21 | msg: res.data.msg, 22 | error: res.data.error 23 | } 24 | }); 25 | } 26 | } 27 | } 28 | 29 | const getVenues = () => { 30 | return async (dispatch) => { 31 | dispatch({ 32 | type: venueConstants.GETALL_VENUES_REQUEST 33 | }); 34 | 35 | const res = await axios.get(`/all-venues`); 36 | 37 | if (res.status === 200) { 38 | dispatch({ 39 | type: venueConstants.GETALL_VENUES_SUCCESS, 40 | payload: res.data.allVenues 41 | }); 42 | } else { 43 | dispatch({ 44 | type: venueConstants.GETALL_VENUES_FAILURE, 45 | payload: { 46 | msg: res.data.msg 47 | } 48 | }); 49 | } 50 | } 51 | } 52 | 53 | const getOneVenue = (id) => { 54 | return async (dispatch) => { 55 | dispatch({ 56 | type: venueConstants.GETONE_VENUE_REQUEST 57 | }); 58 | 59 | const res = await axios.get(`/venue/${id}`); 60 | 61 | if (res.status === 200) { 62 | dispatch({ 63 | type: venueConstants.GETONE_VENUE_SUCCESS, 64 | payload: { 65 | venue: res.data._venue 66 | } 67 | }); 68 | } else { 69 | dispatch({ 70 | type: venueConstants.GETONE_VENUE_FAILURE, 71 | payload: { 72 | msg: res.data.msg 73 | } 74 | }); 75 | } 76 | } 77 | } 78 | 79 | const getOwnerVenues = (ownerId) => { 80 | return async (dispatch) => { 81 | dispatch({ 82 | type: venueConstants.GETALL_VENUES_OF_DEALER_REQUEST 83 | }); 84 | 85 | const res = await axios.get(`/venues/${ownerId}`); 86 | 87 | if (res.status === 200) { 88 | dispatch({ 89 | type: venueConstants.GETALL_VENUES_OF_DEALER_SUCCESS, 90 | payload: res.data._allvenues 91 | }); 92 | } else { 93 | dispatch({ 94 | type: venueConstants.GETALL_VENUES_OF_DEALER_FAILURE, 95 | payload: { 96 | msg: res.data.msg, 97 | error: res.data.error 98 | } 99 | }); 100 | } 101 | } 102 | } 103 | 104 | export { 105 | addVenue, 106 | getVenues, 107 | getOneVenue, 108 | getOwnerVenues 109 | } -------------------------------------------------------------------------------- /controllers/venue.js: -------------------------------------------------------------------------------- 1 | const Venue = require('../models/venue'); 2 | const Deal = require('../models/deal'); 3 | const slugify = require('slugify'); 4 | 5 | function isEmpty(obj) { 6 | for (var key in obj) { 7 | if (obj.hasOwnProperty(key)) 8 | return false; 9 | } 10 | return true; 11 | } 12 | 13 | const createVenue = (req, res) => { 14 | const { venueName, address, location, category, price, description } = req.body; 15 | const ownerInfo = { 16 | ownerName: req.user.fullName, 17 | contactNumber: req.user.contactNumber 18 | } 19 | 20 | let venuePictures = []; 21 | if (req.files.length > 0) { 22 | venuePictures = req.files.map((file) => { 23 | return { img: file.filename }; 24 | }) 25 | } 26 | 27 | const venue = new Venue({ 28 | venueName: venueName, 29 | slug: slugify(venueName), 30 | address: address, 31 | description: description, 32 | location: location, 33 | category: category, 34 | price: price, 35 | venuePictures, 36 | ownerId: req.user.id, 37 | ownerInfo: ownerInfo 38 | }); 39 | venue.save((error, _venue) => { 40 | if (error) return res.status(400).json({ msg: `While saving venue omething went wrong`, error }); 41 | if (_venue) return res.status(201).json({ _venue, files: req.files }); 42 | }) 43 | } 44 | 45 | const getVenueByVenueId = (req, res) => { 46 | const { venueId } = req.params; 47 | if (venueId) { 48 | Venue.findOne({ _id: venueId }) 49 | .exec((error, _venue) => { 50 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 51 | if (_venue) res.status(200).json({ _venue }); 52 | }) 53 | } else { 54 | return res.status(400).json({ msg: `Venue dosen't exit` }); 55 | } 56 | } 57 | 58 | const getAllVenuesByOwnerId = async (req, res) => { 59 | const { ownerId } = req.params; 60 | if (ownerId) { 61 | Venue.find({ ownerId: ownerId }) 62 | .exec((error, _allvenues) => { 63 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 64 | if (_allvenues) res.status(200).json({ _allvenues }); 65 | }) 66 | } 67 | } 68 | 69 | const getAllVenues = async (req, res) => { 70 | const allVenues = await Venue.find({}); 71 | if (allVenues) return res.status(200).json({ allVenues }); 72 | else return res.status(400).json({ msg: `Something happend while fectching all venues` }); 73 | } 74 | 75 | const checkAvailability = (req, res) => { 76 | const { venueId, eventDate } = req.body; 77 | Deal.find({ venueId: venueId, eventDate: eventDate }) 78 | .exec((error, _deal) => { 79 | if (error) return res.status(400).json({ msg: "Something went wrong", error }); 80 | if (isEmpty(_deal)) { 81 | return res.status(200).json({ msg: "No deal found, Available" }); 82 | } else { 83 | return res.status(200).json({ msg: "Venue is booked for date, choose another date" }) 84 | } 85 | }) 86 | } 87 | 88 | module.exports = { 89 | createVenue, 90 | getVenueByVenueId, 91 | getAllVenuesByOwnerId, 92 | getAllVenues, 93 | checkAvailability 94 | } -------------------------------------------------------------------------------- /controllers/client.auth.js: -------------------------------------------------------------------------------- 1 | const User = require('../models/user'); 2 | const jwt = require('jsonwebtoken'); 3 | const shortid = require('shortid'); 4 | 5 | const signup = (req, res) => { 6 | User.findOne({ email: req.body.email }) 7 | .exec((error, user) => { 8 | // If user already exists 9 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 10 | if (user) return res.status(409).json({ msg: 'User already exits' }); 11 | 12 | // If new user trys to login 13 | const { firstName, lastName, email, password, contactNumber } = req.body; 14 | const _user = new User({ 15 | firstName, lastName, email, password, contactNumber, 16 | username: shortid.generate() 17 | }) 18 | 19 | _user.save((error, data) => { 20 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 21 | if (data) return res.status(201).json({ msg: 'User Successfully register !!' }); 22 | }) 23 | }) 24 | } 25 | 26 | const signin = (req, res) => { 27 | User.findOne({ email: req.body.email }) 28 | .exec((error, user) => { 29 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 30 | if (user) { 31 | if (user.authenticate(req.body.password) && user.role === 'client') { 32 | const token = jwt.sign( 33 | { id: user._id, role: user.role }, 34 | process.env.jwt_secret, 35 | { expiresIn: '2h' } 36 | ) 37 | const { _id, firstName, lastName, profilePicture, email, role, fullName, username, contactNumber } = user; 38 | res.cookie('token', token, { expiresIn: '2h' }); 39 | res.status(200).json({ 40 | token, 41 | user: { 42 | _id, firstName, lastName, profilePicture, email, role, fullName, username, contactNumber 43 | } 44 | }) 45 | } else { 46 | return res.status(400).json({ msg: `Invalid Password` }) 47 | } 48 | } 49 | if (!user) { 50 | return res.status(404).json({ msg: `User dosen't not exits` }) 51 | } 52 | }) 53 | } 54 | 55 | const UserProfile = (req, res) => { 56 | const { userId } = req.params; 57 | if (userId) { 58 | User.findById({ _id: userId }) 59 | .exec((error, _user) => { 60 | if (error) return res.status(404).json({ msg: `Something went wrong`, error }); 61 | if (_user) { 62 | const { _id, fullName, firstName, lastName, profilePicture, email, role, username, contactNumber, createdAt } = _user; 63 | return res.status(200).json({ 64 | user: { _id, fullName, firstName, lastName, profilePicture, email, role, username, contactNumber, createdAt } 65 | }); 66 | } 67 | }) 68 | } else { 69 | return res.status(404).json({ msg: `User dosen't exits` }); 70 | } 71 | } 72 | 73 | const signout = (req, res) => { 74 | res.clearCookie("token"); 75 | res.status(200).json({ msg: `Sign-out Successfully...!` }); 76 | } 77 | 78 | module.exports = { 79 | signup, 80 | signin, 81 | signout, 82 | UserProfile 83 | } -------------------------------------------------------------------------------- /controllers/deal.js: -------------------------------------------------------------------------------- 1 | const stripe = require('stripe')(process.env.stripe_key); 2 | const Deal = require('../models/deal'); 3 | 4 | const checkout = async (req, res) => { 5 | const { venueId, eventDate, bill, venueName, venueOwnerId } = req.body; 6 | 7 | try { 8 | const session = await stripe.checkout.sessions.create({ 9 | payment_method_types: ['card'], 10 | mode: 'payment', 11 | success_url: `${process.env.global_client_url}/payment-status?success=true`, 12 | cancel_url: `${process.env.global_client_url}/payment-status?canceled=true`, 13 | line_items: [ 14 | { 15 | price_data: { 16 | currency: 'inr', 17 | product_data: { 18 | name: venueName 19 | }, 20 | unit_amount: bill * 100 21 | }, 22 | quantity: 1 23 | } 24 | ] 25 | }) 26 | if (session) { 27 | const deal = new Deal({ 28 | venueId, eventDate, venueName, venueOwnerId, 29 | bill: bill, 30 | userId: req.user.id 31 | }); 32 | deal.save((error, _deal) => { 33 | if (error) return res.status(400).json({ msg: "Something went wrong", error }); 34 | if (_deal) return res.status(201).json({ url: session.url, dealId: _deal._id }) 35 | }) 36 | } else { 37 | res.status(400).json({ msg: `session not created` }) 38 | } 39 | } catch (e) { 40 | return res.status(400).json({ msg: e }) 41 | } 42 | } 43 | 44 | const confirmDeal = async (req, res) => { 45 | const { dealId } = req.params; 46 | const deal = await Deal.findOneAndUpdate({ _id: dealId }, { 47 | status: "green" 48 | }); 49 | res.status(200).json({ deal }); 50 | } 51 | 52 | const deleteUnconfirmDeal = (req, res) => { 53 | const { dealId } = req.params; 54 | Deal.findByIdAndDelete({ _id: dealId }) 55 | .exec((error, deal) => { 56 | if (!deal) return res.status(200).json({ msg: 'Deal got deleted' }); 57 | if (error) return res.status(400).json({ msg: 'Something went wrong', error }); 58 | }) 59 | } 60 | 61 | const confirmDealsOfUser = (req, res) => { 62 | const { userId } = req.params; 63 | Deal.find({ userId: userId, status: "green" }) 64 | .exec((error, _allDeals) => { 65 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 66 | if (_allDeals) return res.status(200).json({ _allDeals }); 67 | }) 68 | } 69 | const confirmDealsOfDealer = (req, res) => { 70 | const { dealerId } = req.params; 71 | Deal.find({ venueOwnerId: dealerId, status: "green" }) 72 | .exec((error, _allDeals) => { 73 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 74 | if (_allDeals) return res.status(200).json({ _allDeals }); 75 | }) 76 | } 77 | 78 | const getDeal = (req, res) => { 79 | const dealId = req.params; 80 | Deal.findById({ _id: dealId }) 81 | .exec((error, _deal) => { 82 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 83 | if (_deal) return res.status(200).json({ _deal }); 84 | }) 85 | } 86 | 87 | module.exports = { 88 | checkout, 89 | confirmDealsOfUser, 90 | confirmDealsOfDealer, 91 | getDeal, 92 | confirmDeal, 93 | deleteUnconfirmDeal 94 | } -------------------------------------------------------------------------------- /controllers/dealer.auth.js: -------------------------------------------------------------------------------- 1 | const User = require('../models/user'); 2 | const jwt = require('jsonwebtoken'); 3 | const shortid = require('shortid'); 4 | 5 | const signup = (req, res) => { 6 | User.findOne({ email: req.body.email }) 7 | .exec((error, user) => { 8 | // If user already exists 9 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 10 | if (user) return res.status(409).json({ msg: 'User already exits' }); 11 | 12 | // If new user trys to login 13 | const { firstName, lastName, email, password, contactNumber } = req.body; 14 | const _user = new User({ 15 | firstName, lastName, email, password, contactNumber, 16 | username: shortid.generate(), role: 'dealer' 17 | }) 18 | 19 | _user.save((error, data) => { 20 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 21 | if (data) return res.status(201).json({ msg: 'User Successfully register !!' }); 22 | }) 23 | }) 24 | } 25 | 26 | const signin = (req, res) => { 27 | User.findOne({ email: req.body.email }) 28 | .exec((error, user) => { 29 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 30 | if (user) { 31 | if (user.authenticate(req.body.password) && user.role === 'dealer') { 32 | const token = jwt.sign( 33 | { id: user._id, role: user.role, fullName: user.fullName, contactNumber: user.contactNumber }, 34 | process.env.jwt_secret, 35 | { expiresIn: '2h' } 36 | ) 37 | const { _id, firstName, lastName, profilePicture, email, role, fullName, username, contactNumber } = user; 38 | res.cookie('token', token, { expiresIn: '2h' }); 39 | res.status(200).json({ 40 | token, 41 | user: { 42 | _id, firstName, lastName, profilePicture, email, role, fullName, username, contactNumber 43 | } 44 | }) 45 | } else { 46 | return res.status(400).json({ msg: `Invalid Password` }) 47 | } 48 | } 49 | if (!user) { 50 | return res.status(404).json({ msg: `User dosen't not exits` }) 51 | } 52 | }) 53 | } 54 | 55 | const DealerProfile = (req, res) => { 56 | const { userId } = req.params; 57 | if (userId) { 58 | User.findById({ _id: userId }) 59 | .exec((error, _user) => { 60 | if (error) return res.status(400).json({ msg: `Something went wrong`, error }); 61 | if (_user) { 62 | const { _id, fullName, firstName, lastName, profilePicture, email, role, username, contactNumber, createdAt } = _user; 63 | return res.status(200).json({ 64 | user: { _id, fullName, firstName, lastName, profilePicture, email, role, username, contactNumber, createdAt } 65 | }); 66 | } 67 | }) 68 | } else { 69 | return res.status(404).json({ msg: `Dealer dosen't exits` }); 70 | } 71 | } 72 | 73 | const signout = (req, res) => { 74 | res.clearCookie("token"); 75 | res.status(200).json({ msg: `Sign-out Successfully...!` }); 76 | } 77 | 78 | module.exports = { 79 | signup, 80 | signin, 81 | signout, 82 | DealerProfile 83 | } -------------------------------------------------------------------------------- /client-side/src/components/Layout/index.layout.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { NavLink, Link } from 'react-router-dom' 3 | import { Navbar, Container, Nav, Button } from 'react-bootstrap'; 4 | import { useSelector, useDispatch } from 'react-redux'; 5 | import { signout } from '../../actions/auth.actions'; 6 | import { userInfo } from '../../actions/userInfo.actions'; 7 | import { getOwnerVenues } from '../../actions/venue.actions'; 8 | import getDeals from '../../actions/dealsHistory.actions'; 9 | import Avatar from 'boring-avatars'; 10 | import './layout.style.css'; 11 | 12 | const Layout = (props) => { 13 | 14 | const auth = useSelector(state => state.auth); 15 | const serverStatus = useSelector(state => state.serverStatus); 16 | const dispatch = useDispatch(); 17 | 18 | const logout = () => { 19 | dispatch(signout()); 20 | } 21 | 22 | const getUserInfo = () => { 23 | const { _id, role } = auth.user; 24 | dispatch(userInfo(_id, role)); 25 | if (role === 'dealer') { 26 | dispatch(getOwnerVenues(_id)); 27 | } 28 | dispatch(getDeals(role, _id)) 29 | } 30 | 31 | const LoggedInLinks = (props) => { 32 | const { _id } = auth.user; 33 | return ( 34 | 54 | ); 55 | } 56 | 57 | const NotLoggedInLinks = () => { 58 | return ( 59 | 67 | ); 68 | } 69 | 70 | const refresh = () => { 71 | window.location.reload(); 72 | } 73 | 74 | if (serverStatus.message === null) { 75 | return ( 76 | <> 77 | 78 | 79 | 🤝KAPPA 80 | 81 | 82 | 83 | {auth.authenticate ? LoggedInLinks() : NotLoggedInLinks()} 84 | 85 | 86 | 87 | {props.children} 88 | 89 | ) 90 | } else { 91 | return ( 92 | 93 |

{serverStatus.message}

94 | 97 |
98 | ) 99 | } 100 | 101 | } 102 | 103 | export default Layout -------------------------------------------------------------------------------- /client-side/src/components/UI/BookingModel.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Modal, Button, Form, Row, Col, Spinner } from 'react-bootstrap'; 3 | import { Link } from 'react-router-dom'; 4 | import { Redirect } from 'react-router-dom'; 5 | import Input from './Input'; 6 | import { useDispatch, useSelector } from 'react-redux'; 7 | import axios from '../../helpers/axios'; 8 | 9 | const BookingModel = (props) => { 10 | 11 | const { _id, venueName, price, category, location, address, ownerId } = props; 12 | const [date, setDate] = useState(new Date()); 13 | const [isLoading, setIsLoading] = useState(false); 14 | 15 | const auth = useSelector(state => state.auth); 16 | 17 | const gotoCheckoutPage = async (e) => { 18 | if (!auth.authenticate) { 19 | return 20 | } 21 | else { 22 | e.preventDefault(); 23 | setIsLoading(true); 24 | const dealInfo = { 25 | venueId: _id, 26 | venueName: venueName, 27 | venueOwnerId: ownerId, 28 | bill: price, 29 | eventDate: date.toString() 30 | } 31 | console.log(dealInfo); 32 | const res = await axios.post(`/checkout`, dealInfo); 33 | localStorage.setItem('dealId', JSON.stringify(res.data.dealId)); 34 | window.location.href = res.data.url; 35 | } 36 | } 37 | 38 | return ( 39 | 45 | 46 | 47 | Booking Details📝 48 | 49 | 50 | 51 | 52 |
53 | Note: 54 | Before booking always contact owner 55 |
56 |
57 |
58 | 59 | 60 | setDate(e.target.value)} 65 | /> 66 | 67 | 68 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 86 | 92 | 93 | 94 | 95 | 96 | 102 | 103 | 104 | 111 | 112 | 113 | 114 |
115 | 126 | 127 |
128 |
129 |
130 |
131 | ); 132 | } 133 | 134 | export default BookingModel -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | akshaykanade628@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /client-side/src/containers/Profile.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Container, Spinner, Button } from 'react-bootstrap'; 3 | import Layout from '../components/Layout/index.layout'; 4 | import { useDispatch, useSelector } from 'react-redux'; 5 | import { Redirect } from 'react-router'; 6 | import VenueCard from '../components/UI/VenueCard'; 7 | import { ProfileCard, UserInfoCard } from '../components/UI/ProfileCards'; 8 | import { DealsHistory } from '../components/UI/DealsHistory'; 9 | import { isEmpty } from '../helpers/isObjEmpty'; 10 | import AddVenueModel from '../components/UI/AddVenueModel'; 11 | import getDeals from '../actions/dealsHistory.actions'; 12 | 13 | const ProfilePage = (props) => { 14 | document.title = "KAPPA | Profile"; 15 | const dispatch = useDispatch(); 16 | const auth = useSelector(state => state.auth); 17 | const userInfo = useSelector(state => state.userInfo); 18 | const ownerVenues = useSelector(state => state.ownerVenues); 19 | const deals = useSelector(state => state.deals); 20 | 21 | const [addVenueModalShow, setAddVenueModalShow] = useState(false); 22 | 23 | if (auth.token === null) { 24 | return 25 | } 26 | if (userInfo.loading) { 27 | return ( 28 | 29 |
30 |

Getting your info 🎉

31 | 32 |
33 |
34 | ); 35 | } 36 | 37 | const { fullName, email, contactNumber, role, username, createdAt } = userInfo.user; 38 | 39 | return ( 40 | 41 | 42 |
43 |
44 |
45 | 50 | 55 |
56 | 57 |
58 |
59 | 63 |
64 | { 65 | userInfo.user.role === 'dealer' ? 66 | <> 67 | 71 | 72 |
73 |
74 |

Your All venues

75 | { 76 | isEmpty(ownerVenues.allvenues) ? 77 |
78 | Currently you don't have any venues to rent😢 79 |
80 | : 81 | ownerVenues.allvenues.map((venue) => { 82 | const { _id, venueName, address, location, category, price, venuePictures } = venue; 83 | return ( 84 |
85 | 97 |
98 | ) 99 | }) 100 | } 101 |
102 | 103 | : <> 104 | } 105 | setAddVenueModalShow(false)} 108 | /> 109 |
110 |
111 | 112 |
113 |
114 |
115 | ); 116 | } 117 | 118 | export default ProfilePage -------------------------------------------------------------------------------- /client-side/src/containers/Venue.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Container, Button, Spinner } from 'react-bootstrap'; 3 | import Layout from '../components/Layout/index.layout'; 4 | import { ImgsCard } from '../components/UI/ImgsCard'; 5 | import { useDispatch, useSelector } from 'react-redux'; 6 | import { getOneVenue } from '../actions/venue.actions'; 7 | import { getPublicURL } from '../urlConfig'; 8 | import { userInfo } from '../actions/userInfo.actions'; 9 | import BookingModel from '../components/UI/BookingModel'; 10 | import { Redirect } from 'react-router'; 11 | 12 | const VenuePage = (props) => { 13 | document.title = "KAPPA | Venue Details"; 14 | const dispatch = useDispatch(); 15 | const auth = useSelector(state => state.auth) 16 | const [bookingModalShow, setBookingModalShow] = useState(false); 17 | const oneVenueInfo = useSelector(state => state.oneVenueInfo); 18 | const { _id, venueName, description, address, location, category, price, venuePictures, ownerInfo, ownerId } = oneVenueInfo.venue; 19 | 20 | if (oneVenueInfo.loading) { 21 | return ( 22 | 23 |
24 |

Getting venue info 🎉

25 | 26 |
27 |
28 | ); 29 | } 30 | if (oneVenueInfo.venue._id === '') { 31 | return 32 | } 33 | 34 | return ( 35 | 36 | 37 |
38 |
39 |
40 | 45 |
46 | 47 |
48 |

{venueName}

49 |

{category}

50 |

₹ {price}

51 |
52 |

53 |

Some words from Dealer -
54 | {description} 55 |

56 | 57 |
58 | 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
Location{location}
Address{address}
72 |
73 | 74 | 75 | 76 | 77 | { 78 | auth.token === null ? 79 | 82 | : 83 | 84 | } 85 | 86 | 87 | 88 | { 89 | auth.token === null ? 90 | null : 91 | 92 | } 93 | 94 | 95 |
Dealer Name 80 | Login to see the Dealer Details 81 | {ownerInfo.ownerName}
Contact no{ownerInfo.contactNumber}
96 |
97 | 98 | 99 | { 100 | auth.user.role === "client" ? 101 | <> 102 |
103 | 104 | 105 | : 106 | null 107 | } 108 | setBookingModalShow(false)} 118 | /> 119 |
120 |
121 |
122 |
123 |
124 | ) 125 | } 126 | 127 | export default VenuePage -------------------------------------------------------------------------------- /client-side/src/containers/Signup.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import Layout from '../components/Layout/index.layout'; 3 | import { Container, Form, Button, Row, Col, Spinner } from 'react-bootstrap'; 4 | import Input from '../components/UI/Input'; 5 | import { Redirect } from 'react-router'; 6 | import { useSelector, useDispatch } from 'react-redux'; 7 | import { userRegister } from '../actions/register.actions'; 8 | import MessageBox from '../components/UI/MessageBox'; 9 | 10 | const Signup = (props) => { 11 | document.title = "KAPPA | Sign Up"; 12 | const [firstName, setFirstName] = useState(''); 13 | const [lastName, setLastName] = useState(''); 14 | const [contactNumber, setContactNumber] = useState(''); 15 | const [userType, setUserType] = useState(''); 16 | const [email, setEmail] = useState(''); 17 | const [password, setPassword] = useState(''); 18 | 19 | const [messageModalShow, setMessageModalShow] = useState(false); 20 | 21 | const dispatch = useDispatch(); 22 | 23 | const register = (e) => { 24 | e.preventDefault(); 25 | const userInfo = { userType, firstName, lastName, contactNumber, email, password }; 26 | dispatch(userRegister(userInfo)); 27 | setMessageModalShow(true); 28 | } 29 | 30 | const auth = useSelector(state => state.auth); 31 | const registrationStatus = useSelector(state => state.registrationStatus); 32 | if (auth.authenticate) { 33 | return 34 | } 35 | 36 | if (registrationStatus.loading) { 37 | return ( 38 | 39 |
40 |

Saving your info 🎉

41 | 42 |
43 |
44 | ); 45 | } 46 | 47 | return ( 48 | 49 | 50 | setMessageModalShow(false)} 53 | message={registrationStatus.message} 54 | /> 55 |

SIGN UP 📝

56 | 57 | 58 |
59 | 60 | 61 | setFirstName(e.target.value)} 67 | /> 68 | 69 | 70 | setLastName(e.target.value)} 76 | /> 77 | 78 | 79 | 80 | setContactNumber(e.target.value)} 86 | /> 87 | 88 | 89 | 90 |
91 | Choose User Type 92 |
93 | setUserType(e.target.value)} 102 | /> 103 | setUserType(e.target.value)} 111 | /> 112 |
113 | 114 |
115 | 116 | setEmail(e.target.value)} 122 | /> 123 | setPassword(e.target.value)} 129 | /> 130 | 133 | 134 |
135 | 136 |
137 |
138 |
139 | ) 140 | } 141 | 142 | export default Signup -------------------------------------------------------------------------------- /client-side/src/components/UI/AddVenueModel.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import { Modal, Button, Form, Row, Col } from 'react-bootstrap'; 3 | import Input from './Input'; 4 | import { addVenue } from '../../actions/venue.actions'; 5 | import { useDispatch, useSelector } from 'react-redux'; 6 | import MessageBox from './MessageBox'; 7 | import categories from '../../assets/data/categories' 8 | 9 | const AddVenueModel = (props) => { 10 | 11 | const dispatch = useDispatch(); 12 | const addVenueStatus = useSelector(state => state.addVenueStatus); 13 | 14 | const [venueName, setVenueName] = useState(''); 15 | const [location, setLocation] = useState(''); 16 | const [address, setAddress] = useState(''); 17 | const [description, setDescription] = useState(''); 18 | const [price, setPrice] = useState(''); 19 | const [category, setCategory] = useState(''); 20 | const [venuePictures, setVenuePictures] = useState([]); 21 | const [messageModalShow, setMessageModalShow] = useState(false); 22 | 23 | const handleVenuePictures = (e) => { 24 | setVenuePictures([ 25 | ...venuePictures, 26 | e.target.files[0] 27 | ]) 28 | } 29 | 30 | const saveVenue = (e) => { 31 | e.preventDefault(); 32 | const form = new FormData(); 33 | form.append('venueName', venueName); 34 | form.append('location', location); 35 | form.append('address', address); 36 | form.append('description', description); 37 | form.append('price', price); 38 | form.append('category', category); 39 | 40 | for (let picture of venuePictures) { 41 | form.append('venuePicture', picture); 42 | } 43 | console.log(form); 44 | dispatch(addVenue(form)); 45 | setMessageModalShow(true); 46 | } 47 | 48 | return ( 49 | <> 50 | setMessageModalShow(false)} 53 | message={addVenueStatus.message} 54 | /> 55 | 61 | 62 | 63 | 🆕Add New Venue 64 | 65 | 66 | 67 | 68 |
69 | 70 | 71 | setVenueName(e.target.value)} 77 | /> 78 | 79 | 80 | setLocation(e.target.value)} 86 | /> 87 | 88 | 89 | setAddress(e.target.value)} 95 | /> 96 | 97 | Description 98 | setDescription(e.target.value)} 104 | /> 105 | 106 | 107 | 108 | setPrice(e.target.value)} 114 | /> 115 | 116 | 117 | 118 | Category 119 | 129 | 130 | 131 | 132 | 133 |
134 | 135 | 136 |
137 |

Uploaded pictures will display here -

138 | 139 | { 140 | venuePictures.length > 0 ? 141 | venuePictures.map((picture) => { 142 | return ( 143 |

{picture.name}

144 | ) 145 | }) : null 146 | } 147 | 148 | 149 | 150 |
151 |
152 |
153 | 154 | ) 155 | } 156 | 157 | export default AddVenueModel 158 | --------------------------------------------------------------------------------