An open API service indexing awesome lists of open source software.

https://github.com/sangqle/mysql-crud-nodejs

The webapp to booking movie online and payment with google pay then check QR code to coming
https://github.com/sangqle/mysql-crud-nodejs

mysql-server nodejs sample-project

Last synced: 5 months ago
JSON representation

The webapp to booking movie online and payment with google pay then check QR code to coming

Awesome Lists containing this project

README

        

# :stuck_out_tongue_winking_eye: This is project of Database management.

:+1: This PR looks great

## :blush: Booking online movie in cinema.

![alt text](https://s3-ap-southeast-1.amazonaws.com/dbms-photo-movies/gitui.jpeg)

## :blush: Demo.

> [Client](https://bookingpicker.firebaseapp.com/)

> [Verify](https://verifybookingorder.firebaseapp.com/)

[![Build Status](https://vscode.visualstudio.com/_apis/public/build/definitions/a4cdce18-a05c-4bb8-9476-5d07e63bfd76/1/badge?branchName=master)](https://aka.ms/vscode-builds)

## :smiley: Requirement

> [Nodejs](https://nodejs.org/en/)
> [Mysql Server](https://dev.mysql.com/downloads/mysql/)
> [MySQL Workbench](https://dev.mysql.com/downloads/workbench/)
> [PostMan TestAPI](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=vi)

## How to run:

### Config MySQL server

```javascript
// Create a file in /server/src/mysql/config.js
{
const config = {
host: "yourHostName",
port: 3306,
user: "yourUser",
password: "yourPassWord",
database: "yourDatabaseName",
multipleStatements: true
};
/* User for AWS config S3
const accessKey = "xxxxxxxxxxxxxxxxxx";
const secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const Bucket = "??????";
const ACL = "public-read-write";
const ContentType = "image/jpg";
*/
module.exports = {
config,
};
}
```

### Config Server && Client

```
1. Open a terminal
$ git clone https://github.com/lequangsang97/mysql-crud-nodejs.git
$ cd mysql-crud-nodejs && code .
$ cd server && npm install nodemon
$ npm install
$ npm run dev:start

2. Open another terminal
$ cd client && npm install
$ npm start

```

## Node Host: [http://localhost:8080](http://localhost:8080)

## React Host: [http://localhost:3000](http://localhost:3000)

## :ok_hand: API
- [x] Post: http://localhost:8080/user/create/account

- [x] Post: http://localhost:8080/user/login

- [x] Get: http://localhost:8080/user/get/all/movie

- [x] Get: http://localhost:8080/user/get/date/:idMovie

- [x] Get: http://localhost:8080/user/get/time/:idMovie/:idDate

- [x] Get: http://localhost:8080/user/get/seated/:idMovie/:idDate/:idTime

- [x] Post: http://localhost:8080/user/booking

- [x] Get: http://localhost:8080/user/get/order

- [x] Path: http://localhost:8080/user/update/seat

- [x] Post: http://localhost:8080/admin/add/movie

- [x] Get: http://localhost:8080/admin/get/all/order

- [x] Get: http://localhost:8080/admin/get/all/order/bymovie/:idMovie

- [x] Get: http://localhost:8080/admin/get/all/order/bydate/:date

- [x] Get: http://localhost:8080/admin/get/all/order/bytime/:timeStart/:timeEnd

- [x] Delete: http://localhost:8080/admin/delete/movie/:idMovie

- [x] Delete: http://localhost:8080/admin/get/movie/:idMovie

- [x] Delete: http://localhost:8080/admin/edit/movie/:idMovie

- User
- [x] POST: [http://localhost:8080/user/create/account](http://localhost:8080/user/create/account)

Request:
```javascript
{
"name": "Nguyen Phuoc Thanh",
"email": "[email protected]",
"password": "makhau8kytu",
"sdt": "0123456789"
}
```
Response:
```javascript
{
"name": "Nguyen Phuoc Thanh",
"email": "[email protected]",
"sdt": "0123456789"
}
```
- [x] POST: [http://localhost:8080/user/login](http://localhost:8080/user/login)

Request:
```javascript
{
"email": "[email protected]",
"password": "pass",
}
```
Response:
```javascript
{
"id_user": 35,
"name": "Nguyen Phuoc Thanh",
"email": "[email protected]",
"role": "admin",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZF91c2VyIjozMywibmFtZSI6IkxlIFF1YW5nIFNhbmciLCJlbWFpbCI6InNhbmcubGVxdWFuZ0BnbWFpbC5jb20iLCJyb2xlIjoidXNlciIsImlhdCI6MTU0MTA0NTIwMH0.0b_pHp5e49SVP-Mod8SVr0oRzizPKcpSy07yaCgTbn4"
}
```
- [x] GET: [http://localhost:8080/user/get/all/movie](http://localhost:8080/user/get/all/movie)

```javascript
{
"instaces": 6,
"movies": [
{
"id_movie": 1,
"title": "Bad Times At The El Royale",
"director": "Bridges",
"released": 2018,
"length": 110,
"price": 120,
"imagUrl": "https://lottecinemavn.com/Lotte/files/44/4427ab16-6b3e-45c8-9dee-58c8ad84304b.png"
}
...
]
}
```
- [x] GET: [http://localhost:8080/user/get/date/:id_movie](http://localhost:8080/user/get/date/1)

> Ex: http://localhost:8080/user/get/date/1

> Response:
```javascript
{
"instaces": 3,
"dates": [
{
"id_date": 1,
"date": 19
},
{
"id_date": 2,
"date": 20
}
]
}
```
- [x] GET: [http://localhost:8080/user/get/time/:id_movie/:id_date](http://localhost:8080/user/get/time/1/2)

> Ex: http://localhost:8080/user/get/time/1/1

> Response:
```javascript
{
"instaces": 1,
"times": [
{
"id_time": 1,
"time": 1140
}
]
}
```
- [x] GET: [http://localhost:8080/user/get/seated/:id_movie/:id_date/:id_time](http://localhost:8080//user/get/seated/1/2/1)

> Ex: http://localhost:8080/user/get/time/1/1/2

> Response:
```javascript
{
"max_numRow": 4,
"max_numCol": 4,
"instaces": 0,
"seated": []
}
```
- [x] POST: [http://localhost:8080/user/booking](http://localhost:8080/user/booking)

Request:
```javascript
body: {
"id_movie": "1",
"id_date": "1",
"id_time": "1",
"id_seat": "1",
}
```
Response:
```javascript
{
"order": {
"id_order": 3,
"name": "tran cong an",
"title": "Bad Times At The El Royale",
"date": 19,
"time": 1140,
"id_seat": 1
}
}
```
- [x] GET: [http://localhost:8080/user/get/all/order](http://localhost:8080/user/get/all/order)

Request:
Response:
```javascript
{
"instance": 1,
"order": [
{
"id_order": 8,
"title": "Bad Times At The El Royale",
"date": 19,
"time": 1140,
"price": 120,
"id_seat": 2
}
]
}
```
- [x] POST: [http://localhost:8080/user/delete/order](http://localhost:8080/user/delete/order)

Request:
```javascript
body: {
"id_user": "35",
}
```
Response:
```javascript
{
"statusCode": 200,
"results": {
"fieldCount": 0,
"affectedRows": 1,
"insertId": 0,
"serverStatus": 2,
"warningCount": 0,
"message": "",
"protocol41": true,
"changedRows": 0
}
}
```
- [x] POST: [http://localhost:8080/user/update/seat](http://localhost:8080/user/update/seat)

Request:
```javascript
body: {
"id_order": "2",
"id_newSeat" : "3"
}
```
Response:
```javascript
{
"statusCode": 200,
"results": {
"fieldCount": 0,
"affectedRows": 1,
"insertId": 0,
"serverStatus": 2,
"warningCount": 0,
"message": "",
"protocol41": true,
"changedRows": 0
}
}
```
- [x] GET: [http://localhost:8080/logout](http://localhost:8080/logout)


- Administrator
- [x] POST: [http://localhost:8080/admin/add/movie](http://localhost:8080/admin/add/movie)

Request:
![alt text](https://s3-ap-southeast-1.amazonaws.com/dbms-photo-movies/Capture.PNG)
Response:
```javascript
{
message: 'Insert Thanh Cong'
}
````
- [x] GET: [http://localhost:8080/admin/get/all/order/:date](http://localhost:8080/admin/get/all/order/21)

```javascript
{
"instance": 1,
"order": [
{
"id_order": 2,
"name": "Le Quang Sang",
"title": "Bad Times At The El Royale",
"date": 21,
"time": 1140,
"price": 120,
"id_seat": 3
}
]
}
```
- [x] GET: [http://localhost:8080/admin/get/all/order/bymovie/:idMovie]

- [x] GET: [http://localhost:8080/admin/get/all/order/bytime/:timeStart/:timeEnd]


* Item 2b
// le quang sang