From 5ba194875b50c156105ddb3ba6aa96ee188c9e80 Mon Sep 17 00:00:00 2001 From: Jansen-Stanlie Date: Mon, 26 Jul 2021 21:38:36 +0700 Subject: [PATCH] Update Database and API --- ... \360\237\217\246.postman_collection.json" | 288 ++++++++++++++++++ HotelThirdParty_travelapps.sql | 129 ++++++++ User_travelapps.sql | 72 +++++ 3 files changed, 489 insertions(+) create mode 100644 "Final_Hotel \360\237\217\246.postman_collection.json" create mode 100644 HotelThirdParty_travelapps.sql create mode 100644 User_travelapps.sql diff --git "a/Final_Hotel \360\237\217\246.postman_collection.json" "b/Final_Hotel \360\237\217\246.postman_collection.json" new file mode 100644 index 0000000..07a7252 --- /dev/null +++ "b/Final_Hotel \360\237\217\246.postman_collection.json" @@ -0,0 +1,288 @@ +{ + "info": { + "_postman_id": "b2c558d6-94f1-4974-a739-0ae859e4b2d0", + "name": "Final_Hotel 🏦", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Booking Hotel", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJMb3JkQ2FoeWFudG9AZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTYyNjAyNDYwOCwiZXhwIjoxNjI2MDI1MjA4fQ.dSywfY3tH4xxjjvIkFHn8AiF2xrdFWopfmaxVurl2Fbc5RrjkI7pgTf9cnUhQGwdwGV_aMjSnjlenNHIYjQ4XQ", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"Booking\":{\r\n \"name\":\"Lord Eko\",\r\n \"hotel name\":\"JW Marriot\",\r\n \"Room\":{\r\n \"Type\":\"suite\",\r\n \"Quantity\":5,\r\n \"Nights\": 15,\r\n \"CheckIn Date\": \"2021-07-10\"\r\n }\r\n \r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/hotel/Booking", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "hotel", + "Booking" + ] + } + }, + "response": [] + }, + { + "name": "ALL Hotel Room", + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJMb3JkQ2FoeWFudG9AZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTYyNTg5ODk1NywiZXhwIjoxNjI1ODk5NTU3fQ.obDO-CnZR2KmrUYjCR8vT3R6doB52yCkHd4UWXv74yy7035FiMP54tnXAhLzwkiLjsUy0ITgeXHgow0oDRedUg", + "type": "text" + } + ], + "url": { + "raw": "localhost:8083/User/hotel/All", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "hotel", + "All" + ] + } + }, + "response": [] + }, + { + "name": "Login", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\":\"Jansen24@gmail.com\",\r\n \"password\":\"Jo@han_72\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/login", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "login" + ] + } + }, + "response": [] + }, + { + "name": "Register User", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\":\"LordCahyanto@gmail.com\",\r\n \"password\":\"Lord90_as\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/register", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "register" + ] + } + }, + "response": [] + }, + { + "name": "Hotel by Ratings", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJMb3JkQ2FoeWFudG9AZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTYyNTg5ODk1NywiZXhwIjoxNjI1ODk5NTU3fQ.obDO-CnZR2KmrUYjCR8vT3R6doB52yCkHd4UWXv74yy7035FiMP54tnXAhLzwkiLjsUy0ITgeXHgow0oDRedUg", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/hotel/Ratings/2", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "hotel", + "Ratings", + "2" + ] + } + }, + "response": [] + }, + { + "name": "Hotel by location", + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJMb3JkQ2FoeWFudG9AZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTYyNTg5ODk1NywiZXhwIjoxNjI1ODk5NTU3fQ.obDO-CnZR2KmrUYjCR8vT3R6doB52yCkHd4UWXv74yy7035FiMP54tnXAhLzwkiLjsUy0ITgeXHgow0oDRedUg", + "type": "text" + } + ], + "url": { + "raw": "localhost:8083/User/hotel/jakarta", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "hotel", + "jakarta" + ] + } + }, + "response": [] + }, + { + "name": "forgetPass request token", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\":\"Jansen24@gmail.com\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/forgetPass", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "forgetPass" + ] + } + }, + "response": [] + }, + { + "name": "Reset Password", + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJKYW5zZW4yNEBnbWFpbC5jb20iLCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwiaWF0IjoxNjI1ODc1NjA2LCJleHAiOjE2MjU4NzYyMDZ9.m_pyVz_N3L9Zt8HospFvRkS3SN9c9n05Je65yXNke2rYNw3JBZ2cWasILMp0nvJ8u4rpAkxkUySzZOq0DA1htg", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"username\":\"Jansen24@gsmail.com\",\r\n \"password\":\"Jo@han_72\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/Resetpass", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "Resetpass" + ] + } + }, + "response": [] + }, + { + "name": "Payment", + "request": { + "method": "PUT", + "header": [ + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiJUcmF2ZWxva2EiLCJzdWIiOiJMb3JkQ2FoeWFudG9AZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImlhdCI6MTYyNTg5ODk1NywiZXhwIjoxNjI1ODk5NTU3fQ.obDO-CnZR2KmrUYjCR8vT3R6doB52yCkHd4UWXv74yy7035FiMP54tnXAhLzwkiLjsUy0ITgeXHgow0oDRedUg", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"booking_id\":\"elZSR4xC\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8083/User/hotel/Payment", + "host": [ + "localhost" + ], + "port": "8083", + "path": [ + "User", + "hotel", + "Payment" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/HotelThirdParty_travelapps.sql b/HotelThirdParty_travelapps.sql new file mode 100644 index 0000000..b6041e5 --- /dev/null +++ b/HotelThirdParty_travelapps.sql @@ -0,0 +1,129 @@ +/* +SQLyog Ultimate v13.1.1 (64 bit) +MySQL - 5.5.62 : Database - hotel +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/`hotel` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `hotel`; + +/*Table structure for table `list_hotel` */ + +DROP TABLE IF EXISTS `list_hotel`; + +CREATE TABLE `list_hotel` ( + `ID` int(3) NOT NULL AUTO_INCREMENT, + `nama_hotel` varchar(30) DEFAULT NULL, + `location` varchar(30) DEFAULT NULL, + `hotel_id` varchar(8) DEFAULT NULL, + `status` varchar(30) DEFAULT NULL, + `ratings` varchar(30) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; + +/*Data for the table `list_hotel` */ + +insert into `list_hotel`(`ID`,`nama_hotel`,`location`,`hotel_id`,`status`,`ratings`) values +(1,'JW Marriot','Jakarta','JKT001','Available','5.0 Star'), +(2,'Maple Hotel Grogo','Jakarta','JKT002','FULL','3.0 Star'), +(3,'Kytos Hotel','Bandung','BDG001','Available','4.5 Star'), +(4,'Atlantic City Hotel','Bandung','BDG002','Available','4.0 Star'), +(5,'Aryaduta','Medan','MDN001','Available','2.0 Star'); + +/*Table structure for table `room_availability` */ + +DROP TABLE IF EXISTS `room_availability`; + +CREATE TABLE `room_availability` ( + `ID` int(3) NOT NULL AUTO_INCREMENT, + `hotel_id` varchar(8) DEFAULT NULL, + `suite_room` bigint(11) DEFAULT NULL, + `deluxe_room` bigint(11) DEFAULT NULL, + `standard_room` bigint(11) DEFAULT NULL, + `room_date` datetime DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; + +/*Data for the table `room_availability` */ + +insert into `room_availability`(`ID`,`hotel_id`,`suite_room`,`deluxe_room`,`standard_room`,`room_date`) values +(1,'JKT001',9,15,25,'2021-07-12 00:31:33'), +(2,'JKT002',0,0,0,'2021-06-16 00:00:00'), +(3,'BDG001',3,10,15,'2021-06-28 00:00:00'), +(4,'BDG002',7,17,20,'2021-06-30 00:00:00'), +(5,'MDN001',5,15,23,'2021-07-12 00:00:00'); + +/*Table structure for table `room_price` */ + +DROP TABLE IF EXISTS `room_price`; + +CREATE TABLE `room_price` ( + `ID` int(3) NOT NULL AUTO_INCREMENT, + `hotel_id` varchar(8) DEFAULT NULL, + `suite_price` bigint(100) DEFAULT NULL, + `deluxe_price` bigint(100) DEFAULT NULL, + `standard_price` bigint(100) DEFAULT NULL, + `price_date` date DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; + +/*Data for the table `room_price` */ + +insert into `room_price`(`ID`,`hotel_id`,`suite_price`,`deluxe_price`,`standard_price`,`price_date`) values +(1,'JKT001',2450000,1950000,1450000,'2021-07-06'), +(2,'JKT002',2350000,1850000,1350000,'2021-07-06'), +(3,'BDG001',2500000,2050000,1250000,'2021-07-06'), +(4,'BDG002',3200000,2550000,1550000,'2021-07-06'), +(5,'MDN001',2150000,1750000,750000,'2021-07-06'); + +/* Trigger structure for table `list_hotel` */ + +DELIMITER $$ + +/*!50003 DROP TRIGGER*//*!50032 IF EXISTS */ /*!50003 `trigger_hotel` */$$ + +/*!50003 CREATE */ /*!50017 DEFINER = 'root'@'localhost' */ /*!50003 TRIGGER `trigger_hotel` BEFORE INSERT ON `list_hotel` FOR EACH ROW +BEGIN + IF (NEW.hotel_id IS NULL) THEN + -- Find max existed label for specified sensor type + SELECT + MAX(hotel_id) INTO @max_hotel_id + FROM + list_hotel + WHERE + LOCATION = NEW.location; + + IF (@max_hotel_id IS NULL) THEN + SET @hotel_id = + CASE NEW.location + WHEN 'Jakarta' THEN 'JKT' + WHEN 'Bandung' THEN 'BDG' + WHEN 'MEDAN' THEN 'MDN' + ELSE 'UNKNOWN' + END; + + -- Set first sensor label + SET NEW.hotel_id = CONCAT(@hotel_id, '001'); + ELSE + -- Set next sensor label + SET NEW.hotel_id = CONCAT(SUBSTR(@max_hotel_id, 1, 3), LPAD(SUBSTR(@max_hotel_id, 4) + 1, 3, '0')); + END IF; + END IF; +END */$$ + + +DELIMITER ; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/User_travelapps.sql b/User_travelapps.sql new file mode 100644 index 0000000..1dd43a3 --- /dev/null +++ b/User_travelapps.sql @@ -0,0 +1,72 @@ +/* +SQLyog Ultimate v13.1.1 (64 bit) +MySQL - 5.5.62 : Database - user +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/`user` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `user`; + +/*Table structure for table `pemesanan` */ + +DROP TABLE IF EXISTS `pemesanan`; + +CREATE TABLE `pemesanan` ( + `ID` int(3) NOT NULL AUTO_INCREMENT, + `username` varchar(30) DEFAULT NULL, + `nama_pemesan` varchar(30) DEFAULT NULL, + `booking_id` varchar(30) DEFAULT NULL, + `hotel_name` varchar(30) DEFAULT NULL, + `room_type` varchar(30) DEFAULT NULL, + `quantity` int(3) DEFAULT NULL, + `jumlah_malam` int(30) DEFAULT NULL, + `total_payment` int(30) DEFAULT NULL, + `status` varchar(30) DEFAULT NULL, + `tanggal_pemesanan` datetime DEFAULT NULL, + `tanggal_checkin` datetime DEFAULT NULL, + `tanggal_checkout` datetime DEFAULT NULL, + `tanggal_pembayaran` datetime DEFAULT NULL, + `tanggal_pembatalan` datetime DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1; + +/*Data for the table `pemesanan` */ + +insert into `pemesanan`(`ID`,`username`,`nama_pemesan`,`booking_id`,`hotel_name`,`room_type`,`quantity`,`jumlah_malam`,`total_payment`,`status`,`tanggal_pemesanan`,`tanggal_checkin`,`tanggal_checkout`,`tanggal_pembayaran`,`tanggal_pembatalan`) values +(7,'Jansen24@gmail.com','Jansen','SEv9gQrl','JW Marriot','deluxe',10,10,195000000,'Canceled','2021-07-10 11:41:09','2021-07-10 14:00:00','2021-07-20 12:00:00',NULL,'2021-07-10 11:41:30'), +(12,'LordCahyanto@gmail.com','Lord Eko','LUC3Tteb','JW Marriot','suite',5,15,183750000,'Canceled','2021-07-12 00:31:13','2021-07-10 14:00:00','2021-07-25 12:00:00',NULL,'2021-07-12 00:31:33'); + +/*Table structure for table `user_travel` */ + +DROP TABLE IF EXISTS `user_travel`; + +CREATE TABLE `user_travel` ( + `id` bigint(3) NOT NULL AUTO_INCREMENT, + `username` varchar(30) DEFAULT NULL, + `password` varchar(30) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + +/*Data for the table `user_travel` */ + +insert into `user_travel`(`id`,`username`,`password`) values +(1,'jansenstanh24@gmail.com','HesOyam_11'), +(2,'Evitadewi88@gmail.com','E_vita@12'), +(3,'Johannes_55@gmail.com','Jo@han_72'), +(4,'Jansen24@gmail.com','Jo@han_72'), +(5,'Jansen455@gmail.com','J_axaA12'), +(6,'LordCahyanto@gmail.com','Lord90_as'); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;