HyeonJun Jeon

Complete

......@@ -17,6 +17,7 @@
```sh
npm install
npm -g install nodemon
```
### Run
......
{
"compilerOptions": {
"baseUrl": "src"
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ const [id, pw] = fs
.readFileSync("server/libs/sql.pvdata", "utf8")
.split("\r\n");
const connectOption = {
host: "localhost",
host: "extended-calendar-db.cihyg6ssq3la.ap-northeast-2.rds.amazonaws.com",
user: id,
password: pw,
database: "db",
......@@ -53,11 +53,10 @@ async function jcalToSQL(jcal, userID) {
else console.log("unexpected scheType", sche);
}
let result = await connection.query(dateQueryString, [dateSchedules]);
console.log(`schedules_date | ${result}`);
result = await connection.query(timeQueryString, [timeSchedules]);
console.log(`schedules_time | ${result}`);
let [result] = await connection.query(dateQueryString, [dateSchedules]);
console.log("ICAL schedules_date | " + result.affectedRows);
[result] = await connection.query(timeQueryString, [timeSchedules]);
console.log("ICAL schedules_time | " + result.affectedRows);
connection.end();
}
......
......@@ -6,12 +6,10 @@ const { login } = require("./E_Campus.js");
const parseICal = require("./ICal.js");
async function runrun() {
const { data: ical } = await axios({
url: "https://khcanvas.khu.ac.kr/feeds/calendars/user_YzxoryVh1hAQTeUJRljeaYavgmw1OXEGKIzNVpnI.ics",
method: "GET",
responseType: "blob",
});
const Jcal = parseICal(ical);
console.log(Jcal);
const mdata = await axios.get("http://localhost:3001/db/users", {params:{loginID:"good1588"}}
)
console.log(mdata.data)
}
runrun();
......
const { default: axios } = require("axios");
const express = require("express");
const mysql2 = require("mysql2/promise");
const { connectOption } = require("../libs/MySQL");
const parseICal = require("../libs/ICal");
const { connectOption, jcalToSQL } = require("../libs/MySQL");
const dbRouter = express.Router();
const schedules_dateRouter = require("./schedules_date");
const schedules_dateRouter = require("./Schedules_date");
const schedules_repeatRouter = require("./Schedules_repeat");
const schedules_timeRouter = require("./Schedules_time");
const subjectsRouter = require("./Subjects");
const userSubjectRouter = require("./user-subject");
const userSubjectRouter = require("./User-subject");
const usersRouter = require("./Users");
async function route() {
......@@ -29,6 +31,24 @@ async function route() {
}
});
// (userID, peed)
dbRouter.put("/ical", async (req, res) => {
console.log("put /db/ical");
try {
const { data: ical } = await axios({
url: req.body.peed,
method: "GET",
responseType: "blob",
});
await jcalToSQL(parseICal(ical), req.body.userID);
res.end();
} catch (e) {
console.log(e);
res.end();
}
});
dbRouter.use("/user-subject", userSubjectRouter);
dbRouter.use("/users", usersRouter);
dbRouter.use("/subjects", subjectsRouter);
......
......@@ -14,19 +14,19 @@ router.post("/", async (req, res) => {
try {
const { peed, subjects } = result;
const resUser = await axios.post("http://localhost:3001/db/users", {
const resUser = await axios.post("http://3.34.173.161:3001/db/users", {
loginID: req.body.id,
loginPW: req.body.pw,
ical: peed,
});
const userID = resUser.data.ID;
const { data: subList } = await axios.post(
"http://localhost:3001/db/subjects/s",
"http://3.34.173.161:3001/db/subjects/s",
{
list: subjects,
}
);
await axios.post("http://localhost:3001/db/user-subject/s", {
await axios.post("http://3.34.173.161:3001/db/user-subject/s", {
userID,
subList,
});
......
......@@ -56,6 +56,21 @@ async function route() {
res.end();
}
});
// (ID) => ical
usersRouter.get("/ical", async (req, res) => {
console.log("/db/users/ical");
try {
const queryString = `
SELECT ical FROM users us
WHERE us.ID = '${req.query.ID}'`;
const [results] = await connection.query(queryString);
res.send(results[0]);
} catch (e) {
console.log(e);
res.end();
}
});
}
route();
......
CREATE DATABASE IF NOT EXISTS `db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `db`;
-- MySQL dump 10.13 Distrib 8.0.29, for Win64 (x86_64)
--
-- Host: localhost Database: db
-- ------------------------------------------------------
-- Server version 8.0.29
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 */;
--
-- Table structure for table `schedules_date`
--
DROP TABLE IF EXISTS `schedules_date`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `schedules_date` (
`ID` int NOT NULL AUTO_INCREMENT,
`userID` int NOT NULL,
`uid` int DEFAULT NULL,
`label` varchar(100) DEFAULT NULL,
`subjectID` int NOT NULL,
`type` varchar(50) DEFAULT NULL,
`description` varchar(2000) DEFAULT NULL,
`url` varchar(2000) DEFAULT NULL,
`detail` varchar(4000) DEFAULT NULL,
`status` tinyint DEFAULT '1',
`date` date NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `schedules_date(userID&uid)` (`userID`,`uid`),
KEY `schedules_date-subjects` (`subjectID`),
CONSTRAINT `schedules_date-subjects` FOREIGN KEY (`subjectID`) REFERENCES `subjects` (`ID`),
CONSTRAINT `schedules_date-users` FOREIGN KEY (`userID`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1340 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `schedules_date`
--
LOCK TABLES `schedules_date` WRITE;
/*!40000 ALTER TABLE `schedules_date` DISABLE KEYS */;
INSERT INTO `schedules_date` VALUES (1280,29,898489,'이산구조 QnA 0509',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/898489',NULL,1,'2022-05-09'),(1281,29,897098,'EppDm4_08_05 20강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897098',NULL,1,'2022-05-09'),(1282,29,897103,'EppDm4_09_01 20강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897103',NULL,1,'2022-05-09'),(1283,29,893443,'소웨사10주차',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/893443',NULL,1,'2022-05-11'),(1284,29,899121,'이산구조 QnA 0509 추가 질문',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/899121',NULL,1,'2022-05-11'),(1285,29,897117,'EppDm4_09_02 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897117',NULL,1,'2022-05-11'),(1286,29,897118,'EppDm4_09_03 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897118',NULL,1,'2022-05-11'),(1287,29,897119,'EppDm4_09_04 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897119',NULL,1,'2022-05-11'),(1288,29,909379,'이산구조 QnA 0516',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/909379',NULL,1,'2022-05-16'),(1289,29,896305,'학술에세이 초고안',30038,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30038/assignments/896305','초고안 올려 주세요',1,'2022-05-16'),(1290,29,907956,'EppDm4_09_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907956',NULL,1,'2022-05-16'),(1291,29,907958,'EppDm4_09_07',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907958',NULL,1,'2022-05-16'),(1292,29,903680,'소웨사11주차',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/903680',NULL,1,'2022-05-18'),(1293,29,908383,'이산구조 퀴즈 0518',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/908383','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/3945299/download?\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/3945299\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0518.pdf</span></a></p>',1,'2022-05-18'),(1294,29,905097,'Chapter 4. Multiple RV (20220512)',28985,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28985/assignments/905097',NULL,1,'2022-05-18'),(1295,29,907962,'EppDm4_09_08',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907962',NULL,1,'2022-05-18'),(1296,29,907963,'EppDm4_09_09',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907963',NULL,1,'2022-05-18'),(1297,29,912897,'10주차~11주차 강의 요약 및 문제 풀이',28971,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28971/assignments/912897','<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">10주차부터 업로드 하지 않았던 부분부터 강의 내용 요약 혹은 필기를 업로드 해주세요. 여러분의 강의 수강 여부 및 이해도 측정을 위한 과제입니다.</p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">최소 5줄 이상만 요약을 해주면 됩니다.</p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">시간을 너무 많이 들여서 요약을 할 필요는 없습니다. 자유형식으로 궁금한 것들은 요약 과제 제출시 댓글로 달아주시면\\, </p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">다음시간에 답변해 드리도록 하겠습니다.</p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">실전예제=Practice exercise</p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">실전예제 5.2 5.3\\, 5.4 문제도 함께 풀어서 제출하세요.</p>\\n<p style=\"margin-top: 12px\\; margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">오른쪽 상단에 학번\\, 이름을 적으세요. pdf 혹은 jpg\\, png 파일로 업로드하기 바랍니다.</p>',1,'2022-05-20'),(1298,29,919740,'이산구조 QnA 0523',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/919740',NULL,1,'2022-05-23'),(1299,29,918762,'EppDm4_10_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918762',NULL,1,'2022-05-23'),(1300,29,918763,'EppDm4_10_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918763',NULL,1,'2022-05-23'),(1301,29,914056,'소웨사12주차',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/914056',NULL,1,'2022-05-25'),(1302,29,919309,'학술에세이 초고안-2차',30038,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30038/assignments/919309',NULL,1,'2022-05-25'),(1303,29,918994,'EppDm4_10_03',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918994',NULL,1,'2022-05-25'),(1304,29,918995,'EppDm4_10_04',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918995',NULL,1,'2022-05-25'),(1305,29,918998,'EppDm4_10_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918998',NULL,1,'2022-05-25'),(1306,29,926196,'5월27일 수업: 12주차 연습문제 풀이',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/926196',NULL,1,'2022-05-27'),(1307,29,930128,'이산구조 QnA 0530',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/930128',NULL,1,'2022-05-30'),(1308,29,929107,'EppDm4_10_06',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929107',NULL,1,'2022-05-30'),(1309,29,929108,'EppDm4_10_07',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929108',NULL,1,'2022-05-30'),(1310,29,929109,'EppDm4_11_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929109',NULL,1,'2022-05-30'),(1311,29,924621,'소웨사13주차',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/924621',NULL,1,'2022-06-01'),(1312,29,934368,'이산구조 퀴즈 0601',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/934368','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/4078317/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/4078317\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0601.pdf</span></a></p>',1,'2022-06-01'),(1313,29,935164,'학술에세이',30038,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30038/assignments/935164','ㅂ',1,'2022-06-01'),(1314,29,929110,'EppDm4_11_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929110',NULL,1,'2022-06-01'),(1315,29,929112,'EppDm4_11_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929112',NULL,1,'2022-06-01'),(1316,29,929111,'EppDm4_11_03',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929111',NULL,1,'2022-06-01'),(1317,29,929113,'EppDm4_11_03',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929113',NULL,1,'2022-06-01'),(1318,29,939273,'이산구조 퀴즈 0606',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/939273','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/4112359/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/4112359\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0606.pdf</span></a></p>',1,'2022-06-06'),(1319,29,937556,'EppDm4_11_04',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937556',NULL,1,'2022-06-06'),(1320,29,937558,'EppDm4_11_04',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937558',NULL,1,'2022-06-06'),(1321,29,937557,'EppDm4_11_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937557',NULL,1,'2022-06-06'),(1322,29,937560,'EppDm4_11_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937560',NULL,1,'2022-06-06'),(1323,29,932017,'미적분학-6월1일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/932017',NULL,1,'2022-06-07'),(1324,29,932636,'미적분학-5월30일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/932636',NULL,1,'2022-06-08'),(1325,29,937564,'EppDm4_12_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937564',NULL,1,'2022-06-08'),(1326,29,937565,'EppDm4_12_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937565',NULL,1,'2022-06-08'),(1327,29,932028,'week14',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/932028',NULL,1,'2022-06-08'),(1328,29,935005,'소웨사 14주차',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/935005',NULL,1,'2022-06-09'),(1329,29,921759,'3월2일수업',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/921759',NULL,1,'2022-06-13'),(1330,29,921783,'3월16일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/921783',NULL,1,'2022-06-13'),(1331,29,921787,'3월21일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/921787',NULL,1,'2022-06-13'),(1332,29,921807,'3월23일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/921807',NULL,1,'2022-06-13'),(1333,29,921821,'3월28일-미적분학',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/921821',NULL,1,'2022-06-13'),(1334,29,911413,'발표예제파일',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911413',NULL,1,'2022-06-17'),(1335,29,911416,'실예제파일',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911416',NULL,1,'2022-06-17'),(1336,29,787701,'Orientation',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/787701',NULL,1,'2022-06-17'),(1337,29,911418,'Term Project 발표',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911418','<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\"><span>PPT로 발표자료를 만드시고\\, 음성 녹음 기능을 활용하여 발표자료에 음성 발표를 포함하도록 해주세요.</span><br><span>동영상으로 발표를 대체하는 것이 아니라\\, <span style=\"font-weight: bold\\;\">음성 녹음 기능을 활용하여 온라인 발표를 진행</span>하도록 하겠습니다.</span><br><span>발표 후에 생길 수 있는 질문 등은 온라인으로 직접 답변 하도록 하겠습니다.</span></p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\"> </p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\"><span>모든 사람은 발표자료를 6/9 오후 4시전까지 업로드하셔야 합니다.</span><br><span>공정성을 위하여 해당 시간까지 업로드한 자료를 바탕으로 발표 진행하도록 하겠습니다.</span></p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\"> </p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\"><span>파일명은 학번.pptx 형태로 제출해주세요.<br>예) 20201012345.pptx</span></p>',1,'2022-06-17'),(1338,29,911410,'Term Project 안내',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911410',NULL,1,'2022-06-17'),(1339,29,787536,'url',30517,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/30517/assignments/787536',NULL,1,'2022-06-21');
/*!40000 ALTER TABLE `schedules_date` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `schedules_repeat`
--
DROP TABLE IF EXISTS `schedules_repeat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `schedules_repeat` (
`ID` int NOT NULL AUTO_INCREMENT,
`userID` int NOT NULL,
`uid` int DEFAULT NULL,
`label` varchar(100) DEFAULT NULL,
`subjectID` int NOT NULL,
`type` varchar(50) DEFAULT NULL,
`description` varchar(2000) DEFAULT NULL,
`url` varchar(2000) DEFAULT NULL,
`detail` varchar(4000) DEFAULT NULL,
`status` tinyint DEFAULT '1',
`day` tinyint DEFAULT NULL,
`startTime` time DEFAULT NULL,
`endTime` time DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `schedules_repeat(userID&uid)` (`userID`,`uid`),
KEY `schedules_repeat-subjects` (`subjectID`),
CONSTRAINT `schedules_repeat-subjects` FOREIGN KEY (`subjectID`) REFERENCES `subjects` (`ID`),
CONSTRAINT `schedules_repeat-users` FOREIGN KEY (`userID`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=656 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `schedules_repeat`
--
LOCK TABLES `schedules_repeat` WRITE;
/*!40000 ALTER TABLE `schedules_repeat` DISABLE KEYS */;
/*!40000 ALTER TABLE `schedules_repeat` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `schedules_time`
--
DROP TABLE IF EXISTS `schedules_time`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `schedules_time` (
`ID` int NOT NULL AUTO_INCREMENT,
`userID` int NOT NULL,
`uid` int DEFAULT NULL,
`label` varchar(100) DEFAULT NULL,
`subjectID` int NOT NULL,
`type` varchar(50) DEFAULT NULL,
`description` varchar(2000) DEFAULT NULL,
`url` varchar(2000) DEFAULT NULL,
`detail` varchar(4000) DEFAULT NULL,
`status` tinyint DEFAULT '1',
`date` date NOT NULL,
`startTime` time DEFAULT NULL,
`endTime` time DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `schedules_time(userID&uid)` (`userID`,`uid`),
KEY `schedules_time-subjects` (`subjectID`),
CONSTRAINT `schedules_time-subjects` FOREIGN KEY (`subjectID`) REFERENCES `subjects` (`ID`),
CONSTRAINT `schedules_time-users` FOREIGN KEY (`userID`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1053 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `schedules_time`
--
LOCK TABLES `schedules_time` WRITE;
/*!40000 ALTER TABLE `schedules_time` DISABLE KEYS */;
INSERT INTO `schedules_time` VALUES (1006,29,897094,'EppDm4_08_05 20강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897094',NULL,1,'2022-05-09',NULL,'09:00:00'),(1007,29,897101,'EppDm4_09_01 20강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897101',NULL,1,'2022-05-09',NULL,'09:00:00'),(1008,29,898316,'이산구조 퀴즈 0509',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/898316','<p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">[1] </span><span style=\"\\;\">다음의 관계는 각각 반사적인지 대칭적인지 반대칭적인지 추이적 인지 판별하시오</span><span style=\"\\;\" lang=\"EN-US\">.</span></p><p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">R1={(0\\,0)\\, (0\\,1)\\, (0\\,2)\\, (1\\,2)}</span></p><p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">R2={((0\\,0)\\, (1\\,1)\\, (2\\,2)}</span></p><p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">[2]</span></p><p style=\"\\;\"><span style=\"\\;\">반순서 관계를 완전순서관계로 바꾸는 과정을 무엇이라고 부르는가</span><span style=\"\\;\" lang=\"EN-US\">.</span></p><p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">[3]</span></p><p style=\"\\;\"><span lang=\"EN-US\"> </span><span style=\"\\;\">어떤 실험을 하였을 때 그 실험에서 나타느는 경과는 가능한 모든 결과들 중에서 한가지가 나타나며</span><span style=\"\\;\" lang=\"EN-US\">\\, </span><span style=\"\\;\">어떤 결과가 나올지를 사전에 전혀 예측할 수 없는 실험은 무엇이라고 하나</span><span style=\"\\;\" lang=\"EN-US\">? </span></p><p style=\"\\;\"></p><p style=\"\\;\"><span style=\"\\;\" lang=\"EN-US\">[4]</span></p><p style=\"\\;\"><span style=\"\\;\">피타고라스는 기원전 </span><span style=\"\\;\" lang=\"EN-US\">500</span><span style=\"\\;\">년에 사망했다</span><span style=\"\\;\" lang=\"EN-US\">. </span><span style=\"\\;\">올해인 </span><span style=\"\\;\" lang=\"EN-US\">2022</span><span style=\"\\;\">년은 그의 사망 몇년이 되는 해인가요</span><span style=\"\\;\" lang=\"EN-US\">?</span></p>',1,'2022-05-09',NULL,'09:25:00'),(1009,29,897105,'EppDm4_09_02 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897105',NULL,1,'2022-05-11',NULL,'09:00:00'),(1010,29,897113,'EppDm4_09_03 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897113',NULL,1,'2022-05-11',NULL,'09:00:00'),(1011,29,897114,'EppDm4_09_04 21강',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/897114',NULL,1,'2022-05-11',NULL,'09:00:00'),(1012,29,902657,'이산구조 퀴즈 0511',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/902657','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/3917624/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/3917624\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0511.pdf</span></a></p>',1,'2022-05-11',NULL,'09:25:00'),(1013,29,896110,'Virtualization',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/896110',NULL,1,'2022-05-13',NULL,'09:30:00'),(1014,29,777641,'Virtualization-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/777641',NULL,1,'2022-05-13',NULL,'09:30:00'),(1015,29,777643,'Virtualization-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/777643','<p>도커 파일을 업로드 하세요.</p>\\n<p>예) 학번.Dockerfile</p>\\n<p>202010101010.Dockerfile</p>',1,'2022-05-13',NULL,'09:30:00'),(1016,29,907953,'EppDm4_09_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907953',NULL,1,'2022-05-16',NULL,'09:00:00'),(1017,29,907954,'EppDM4_09_06',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907954',NULL,1,'2022-05-16',NULL,'09:00:00'),(1018,29,907957,'EppDM4_09_06',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907957',NULL,1,'2022-05-16',NULL,'09:00:00'),(1019,29,907955,'EppDm4_09_07',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907955',NULL,1,'2022-05-16',NULL,'09:00:00'),(1020,29,908010,'이산구조 퀴즈 0516',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/908010','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/3941607/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/3941607\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0516.pdf</span></a></p>',1,'2022-05-16',NULL,'09:25:00'),(1021,29,907960,'EppDm4_09_08',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907960',NULL,1,'2022-05-18',NULL,'09:00:00'),(1022,29,907961,'EppDm4_09_09',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/907961',NULL,1,'2022-05-18',NULL,'09:00:00'),(1023,29,777651,'Cloud Computing',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/777651',NULL,1,'2022-05-20',NULL,'09:30:00'),(1024,29,777654,'Cloud Computing-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/777654',NULL,1,'2022-05-20',NULL,'09:30:00'),(1025,29,918760,'EppDm4_10_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918760',NULL,1,'2022-05-23',NULL,'09:00:00'),(1026,29,918761,'EppDm4_10_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918761',NULL,1,'2022-05-23',NULL,'09:00:00'),(1027,29,919701,'이산구조 퀴즈 0523',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/919701','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/4005111/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/4005111\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0523.pdf</span></a></p>',1,'2022-05-23',NULL,'09:30:00'),(1028,29,914629,'미적분학5월18일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/914629',NULL,1,'2022-05-23',NULL,'15:00:00'),(1029,29,918991,'EppDm4_10_04',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918991',NULL,1,'2022-05-24',NULL,'08:59:00'),(1030,29,918993,'EppDm4_10_05',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918993',NULL,1,'2022-05-24',NULL,'08:59:00'),(1031,29,918988,'EppDm4_10_03',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/918988',NULL,1,'2022-05-25',NULL,'09:00:00'),(1032,29,924007,'이산구조 Quiz 0525',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/924007','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/4021843/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/4021843\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 Quiz 0525.pdf</span></a></p>',1,'2022-05-25',NULL,'09:25:00'),(1033,29,911391,'Chatbot01',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911391',NULL,1,'2022-05-27',NULL,'09:30:00'),(1034,29,911397,'Chatbot01-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911397','<p><span style=\"font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">스크린캡쳐한 파일을 제출하세요.</span></p>\\n<p> </p>\\n<p><span style=\"font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">20201010101.jpg or png</span></p>',1,'2022-05-27',NULL,'09:30:00'),(1035,29,911392,'Chatbot01-Expreiment',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911392',NULL,1,'2022-05-27',NULL,'09:30:00'),(1036,29,777660,'Cloud Computing-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/777660','<p>스크린캡쳐한 파일을 압축하여 제출하세요.</p>\\n<p>예) 학번.zip</p>\\n<p>202010101.zip</p>',1,'2022-05-27',NULL,'09:30:00'),(1037,29,929104,'EppDm4_10_06',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929104',NULL,1,'2022-05-29',NULL,'08:59:00'),(1038,29,929105,'EppDm4_10_07',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929105',NULL,1,'2022-05-29',NULL,'08:59:00'),(1039,29,929106,'EppDm4_11_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929106',NULL,1,'2022-05-29',NULL,'08:59:00'),(1040,29,929413,'이산구조 퀴즈 0530',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/929413','<p><a class=\"description_file_attachment\" href=\"https://khcanvas.khu.ac.kr/courses/28193/files/4049727/download?download_frd=1\" data-api-endpoint=\"https://khcanvas.khu.ac.kr/api/v1/courses/28193/files/4049727\" data-api-returntype=\"File\"><span class=\"description_file_name\">이산구조 퀴즈 0530.pdf</span></a></p>',1,'2022-05-30',NULL,'09:30:00'),(1041,29,924884,'미적분학5월25일',27373,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/27373/assignments/924884',NULL,1,'2022-05-30',NULL,'15:00:00'),(1042,29,936337,'2차시험 분반 1',28985,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28985/assignments/936337','',1,'2022-06-02',NULL,'11:35:00'),(1043,29,936340,'2차시험 분반 2',28985,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28985/assignments/936340','',1,'2022-06-02',NULL,'11:35:00'),(1044,29,936343,'2차시험 분반 3',28985,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28985/assignments/936343','',1,'2022-06-02',NULL,'11:35:00'),(1045,29,936346,'2차시험 분반 4',28985,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28985/assignments/936346','',1,'2022-06-02',NULL,'11:35:00'),(1046,29,911400,'Chatbot02',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911400',NULL,1,'2022-06-03',NULL,'09:30:00'),(1047,29,911403,'Chatbot02-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911403','<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">소스 파일을 txt로 변경하여 제출하시오</p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">예) 학번.txt</p>\\n<p style=\"margin-bottom: 10px\\; font-family: LatoWeb\\, Lato\\, \'Helvetica Neue\'\\, Helvetica\\, Arial\\, sans-serif\\; font-size: 14px\\;\">20201010101.txt</p>',1,'2022-06-03',NULL,'09:30:00'),(1048,29,911401,'Chatbot02-Expreiment',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911401',NULL,1,'2022-06-03',NULL,'09:30:00'),(1049,29,937562,'EppDm4_12_01',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937562',NULL,1,'2022-06-07',NULL,'08:59:00'),(1050,29,937563,'EppDm4_12_02',28193,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28193/assignments/937563',NULL,1,'2022-06-07',NULL,'08:59:00'),(1051,29,911405,'LinuxAdministration',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911405',NULL,1,'2022-06-10',NULL,'09:30:00'),(1052,29,911406,'LinuxAdministration-Experiments',28200,'assignment',NULL,'https://khcanvas.khu.ac.kr/courses/28200/assignments/911406',NULL,1,'2022-06-10',NULL,'09:30:00');
/*!40000 ALTER TABLE `schedules_time` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `subjects`
--
DROP TABLE IF EXISTS `subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `subjects` (
`ID` int NOT NULL,
`name` text,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subjects`
--
LOCK TABLES `subjects` WRITE;
/*!40000 ALTER TABLE `subjects` DISABLE KEYS */;
INSERT INTO `subjects` VALUES (27373,' 미분적분학 19분반'),(28193,' 이산구조 01분반'),(28200,' 오픈소스SW개발 00분반'),(28971,' 논리회로 01분반'),(28985,' 확률및랜덤변수 05분반'),(30038,' 주제연구 G29분반'),(30517,' 소프트웨어적사유 G01분반');
/*!40000 ALTER TABLE `subjects` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user-subject`
--
DROP TABLE IF EXISTS `user-subject`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user-subject` (
`userID` int DEFAULT NULL,
`subjectID` int DEFAULT NULL,
`nickname` varchar(255) DEFAULT NULL,
`status` tinyint DEFAULT NULL,
`color` char(6) DEFAULT NULL,
UNIQUE KEY `uk` (`userID`,`subjectID`),
KEY `subjectID` (`subjectID`),
CONSTRAINT `user-subject_ibfk_1` FOREIGN KEY (`userID`) REFERENCES `users` (`ID`),
CONSTRAINT `user-subject_ibfk_2` FOREIGN KEY (`subjectID`) REFERENCES `subjects` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user-subject`
--
LOCK TABLES `user-subject` WRITE;
/*!40000 ALTER TABLE `user-subject` DISABLE KEYS */;
INSERT INTO `user-subject` VALUES (29,28971,NULL,1,'3ADF00'),(29,27373,NULL,1,'0040FF'),(29,30517,NULL,1,'FF0000'),(29,28200,NULL,1,'FFFF00'),(29,28193,NULL,1,'FF00FF'),(29,30038,NULL,1,'FF8000'),(29,28985,NULL,1,'6E6E6E');
/*!40000 ALTER TABLE `user-subject` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`ID` int NOT NULL AUTO_INCREMENT,
`name` varchar(40) DEFAULT NULL,
`loginID` varchar(255) DEFAULT NULL,
`loginPW` varchar(500) DEFAULT NULL,
`ical` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (29,'undefined','good1588','34b3a7cca3df2887b2f84f5a5e677ff2c199f16c601cb7fad251c6e276eeb05f','https://khcanvas.khu.ac.kr/feeds/calendars/user_YzxoryVh1hAQTeUJRljeaYavgmw1OXEGKIzNVpnI.ics');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-06-07 14:19:53
......@@ -4,24 +4,19 @@ const cors = require("cors");
const loginRouter = require("./routers/Login");
const dbRouter = require("./routers/DB");
const path = require("path");
const app = express();
app.use(
cors({
origin: "http://localhost:3000",
origin: "http://3.34.173.161:3000",
credentials: true,
})
);
// app.use(bodyParser.urlencoded({ extended: false }));
// app.use(bodyParser.json());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.post("/", (req, res) => {
console.log("/");
});
app.use("/login", loginRouter);
app.use("/db", dbRouter);
......@@ -43,6 +38,11 @@ app.use("/db", dbRouter);
// } else console.log("Incorrect user ID or password.");
// });
// app.use(express.static(path.join(__dirname, '../build')));
// app.get('*', function (요청, 응답) {
// 응답.sendFile(path.join(__dirname, '../build/index.html'));
// });
app.listen(3001, function () {
console.log("listening on 3001");
});
......
......@@ -30,15 +30,15 @@ const GridItem = ({ targetDate }) => {
day: targetDate.getDay(),
};
const { data: scdate } = await axios.get(
"http://localhost:3001/db/schedules_date",
"http://3.34.173.161:3001/db/schedules_date",
{ params }
);
const { data: sctime } = await axios.get(
"http://localhost:3001/db/schedules_time",
"http://3.34.173.161:3001/db/schedules_time",
{ params }
);
const { data: scrpeat } = await axios.get(
"http://localhost:3001/db/schedules_repeat",
"http://3.34.173.161:3001/db/schedules_repeat",
{ params }
);
const subs = await localforage.getItem("subjects");
......@@ -58,7 +58,7 @@ const GridItem = ({ targetDate }) => {
const finishSchedule = async (table, uid) => {
for (const i in schedules)
if (schedules[i].uid === uid) {
await axios.delete("http://localhost:3001/db/schedule", {
await axios.delete("http://3.34.173.161:3001/db/schedule", {
data: {
table,
uid,
......@@ -81,7 +81,7 @@ const GridItem = ({ targetDate }) => {
const table =
state.startTime || state.endTime ? "schedules_time" : "schedules_date";
const { data: sche } = await axios.post(
"http://localhost:3001/db/" + table,
"http://3.34.173.161:3001/db/" + table,
{
userID: await localforage.getItem("userID"),
...state,
......
......@@ -16,7 +16,7 @@ const render = (subsObj, args) => {
case "CHECKED":
sub = subsObj[args.subjectID];
sub.status = !sub.status;
axios.put("http://localhost:3001/db/user-subject/check", {
axios.put("http://3.34.173.161:3001/db/user-subject/check", {
userID: sub.userID,
subjectID: args.subjectID,
status: +sub.status,
......@@ -26,7 +26,7 @@ const render = (subsObj, args) => {
sub = subsObj[args.subjectID];
sub.nickname = args.nickname;
sub.color = args.color;
axios.put("http://localhost:3001/db/user-subject/modify", {
axios.put("http://3.34.173.161:3001/db/user-subject/modify", {
userID: sub.userID,
subjectID: args.subjectID,
nickname: sub.nickname,
......@@ -41,7 +41,7 @@ const render = (subsObj, args) => {
};
const Calendar = () => {
console.log("visit Calendar");
// console.log("visit Calendar");
const [state, setState] = useState({
scope: "month",
......@@ -56,7 +56,7 @@ const Calendar = () => {
// get user's subjects
const userID = await localforage.getItem("userID");
const { data: subjects } = await axios.get(
"http://localhost:3001/db/user-subject",
"http://3.34.173.161:3001/db/user-subject",
{ params: { userID } }
);
await localforage.setItem("subjects", subjects);
......
......@@ -6,7 +6,7 @@ import { useNavigate } from "react-router-dom";
import "../styles/Debug.css";
const Debug = () => {
console.log("visit Debug");
// console.log("visit Debug");
const [state, setState] = useState({
type: "login",
......@@ -23,25 +23,25 @@ const Debug = () => {
};
const handleSubmit = async (e) => {
let result;
switch (state.type) {
case "login":
//result = login(state.input1, state.input2);
break;
case "server":
setState({ ...state, output: "loading..." });
axios
.post("http://localhost:3001/login/", {
id: state.input1,
pw: state.input2,
})
.then((res) => {
setState({ ...state, output: res.data });
});
return;
default:
}
setState({ ...state, output: result });
// let result;
// switch (state.type) {
// case "login":
// //result = login(state.input1, state.input2);
// break;
// case "server":
// setState({ ...state, output: "loading..." });
// axios
// .post("http://3.34.173.161:3001/login/", {
// id: state.input1,
// pw: state.input2,
// })
// .then((res) => {
// setState({ ...state, output: res.data });
// });
// return;
// default:
// }
// setState({ ...state, output: result });
};
const navigate = useNavigate();
......
......@@ -3,7 +3,7 @@ import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
const Home = () => {
console.log("visit Home");
// console.log("visit Home");
const navigate = useNavigate();
useEffect(() => {
......
......@@ -7,7 +7,7 @@ import axios from "axios";
import cryptoJs from "crypto-js";
const Login = () => {
console.log("visit Login");
// console.log("visit Login");
const [state, setState] = useState({
id: "",
pw: "",
......@@ -25,19 +25,23 @@ const Login = () => {
const login = async () => {
setState({ ...state, btn: "Login..." });
const { data: userDBID } = await axios.get(
"http://localhost:3001/db/users",
{
params: {
loginID: state.id,
},
}
"http://3.34.173.161:3001/db/users",
{ params: { loginID: state.id } }
);
if (userDBID) {
//pass crawling
//pass crawling, just ical
const { data: peed } = await axios.get(
"http://3.34.173.161:3001/db/users/ical",
{ params: { ID: userDBID } }
);
await axios.put("http://3.34.173.161:3001/db/ical", {
userID: userDBID,
peed: peed.ical,
});
const hashpw = cryptoJs.SHA256(state.pw).toString();
const { data: isCorrectPW } = await axios.get(
"http://localhost:3001/db/users/check",
"http://3.34.173.161:3001/db/users/check",
{
params: { loginID: state.id, loginPW: hashpw },
}
......@@ -53,7 +57,7 @@ const Login = () => {
} else {
//crawling
const { data: loginResult } = await axios.post(
"http://localhost:3001/login/",
"http://3.34.173.161:3001/login/",
{
id: state.id,
pw: state.pw,
......
......@@ -4,7 +4,7 @@ import { Navigate, useNavigate } from "react-router-dom";
import "../styles/Settings.css";
const Settings = () => {
console.log("visit Settings");
// console.log("visit Settings");
const session = localforage.getItem("session");
......