From 7b9742754181c4a1c292988cb34a9d588ae6bcd7 Mon Sep 17 00:00:00 2001 From: mononomo Date: Fri, 30 Oct 2020 10:50:44 +0900 Subject: [PATCH 001/118] =?UTF-8?q?feat:=20=EB=B0=B0=ED=8F=AC=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=89=98=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=B0=ED=8F=AC=ED=95=A0=EB=95=8C=20git=20?= =?UTF-8?q?=EA=B3=BC=20build=20=EC=99=80=20pm2=20=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=B4=EC=84=9C=20=EC=84=A4=EC=A0=95=ED=95=B4=20=EC=A3=BC?= =?UTF-8?q?=EB=8A=94=20=EC=89=98=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8?= =?UTF-8?q?=EB=A5=BC=20=EB=A7=8C=EB=93=A4=EC=97=88=EC=8A=B5=EB=8B=88?= =?UTF-8?q?=EB=8B=A4.=20#28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/depoly.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 BE/depoly.sh diff --git a/BE/depoly.sh b/BE/depoly.sh new file mode 100644 index 0000000..60281ca --- /dev/null +++ b/BE/depoly.sh @@ -0,0 +1,7 @@ +git stash +git checkout master +git pull +npm run build +pm2 stop npm +pm2 delete npm +pm2 start npm -- start \ No newline at end of file From 737554e25457d0893121893d045b380cf2078f0a Mon Sep 17 00:00:00 2001 From: ji Date: Fri, 30 Oct 2020 16:18:32 +0900 Subject: [PATCH 002/118] =?UTF-8?q?chore:=20module-alias=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20import=EC=8B=9C=20=EC=A0=88=EB=8C=80=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EA=B8=B0?= =?UTF-8?q?=EC=9C=84=ED=95=B4=20module-alias=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #28 --- BE/package-lock.json | 6 ++++++ BE/package.json | 9 +++++++++ BE/tsconfig.json | 11 +++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/BE/package-lock.json b/BE/package-lock.json index 3cfa8b9..d8e544d 100644 --- a/BE/package-lock.json +++ b/BE/package-lock.json @@ -2615,6 +2615,12 @@ "minimist": "^1.2.5" } }, + "module-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", + "dev": true + }, "morgan": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", diff --git a/BE/package.json b/BE/package.json index 8ee83bd..3bd58e6 100644 --- a/BE/package.json +++ b/BE/package.json @@ -37,6 +37,7 @@ "express-session": "^1.17.1", "helmet": "^4.1.1", "jsonwebtoken": "^8.5.1", + "module-alias": "^2.2.2", "morgan": "^1.10.0", "multer": "^1.4.2", "mysql2": "^2.2.5", @@ -45,5 +46,13 @@ "passport-github": "^1.1.0", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0" + }, + "_moduleAliases": { + "@root": "build", + "@controllers": "build/controllers", + "@interfaces": "build/interfaces", + "@models": "build/models", + "@providers": "build/providers", + "@routes": "build/routes" } } diff --git a/BE/tsconfig.json b/BE/tsconfig.json index 26d0555..febbc03 100644 --- a/BE/tsconfig.json +++ b/BE/tsconfig.json @@ -42,8 +42,15 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + "baseUrl": "./src", /* Base directory to resolve non-absolute module names. */ + "paths": { + "@root/*":["/*"], + "@controllers/*":["controllers/*"], + "@interfaces/*":["interfaces/*"], + "@models/*":["models/*"], + "@providers/*":["providers/*"], + "@routes/*":["routes/*"], + }, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ From d0dcb2e6a2119261d8d6b7c8d1e1cadc7c3dd326 Mon Sep 17 00:00:00 2001 From: ji Date: Fri, 30 Oct 2020 16:22:13 +0900 Subject: [PATCH 003/118] =?UTF-8?q?chore:=20import=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20module-alias=20=EC=B6=94=EA=B0=80=EB=A1=9C?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=EB=B3=84=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/app.ts | 16 ++++++++-------- BE/src/index.ts | 1 + BE/src/models/model.ts | 2 +- BE/src/models/user.ts | 2 +- BE/src/routes/auth.ts | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/BE/src/app.ts b/BE/src/app.ts index da9bdd0..27bd5e9 100644 --- a/BE/src/app.ts +++ b/BE/src/app.ts @@ -4,14 +4,14 @@ import session from "express-session"; import bodyParser from "body-parser"; import helmet from "helmet"; -import index from "./routes/index"; -import auth from "./routes/auth"; -import milestone from "./routes/milestone"; -import label from "./routes/label"; -import issue from "./routes/issue"; -import event from "./routes/event"; - -import Passport from "./providers/passport"; +import index from "@routes/index"; +import auth from "@routes/auth"; +import milestone from "@routes/milestone"; +import label from "@routes/label"; +import issue from "@routes/issue"; +import event from "@routes/event"; + +import Passport from "@providers/passport"; class App { private app: Application; diff --git a/BE/src/index.ts b/BE/src/index.ts index 8bbb014..8c7755d 100644 --- a/BE/src/index.ts +++ b/BE/src/index.ts @@ -1,3 +1,4 @@ +import "module-alias/register"; import App from "./app"; (async function main() { diff --git a/BE/src/models/model.ts b/BE/src/models/model.ts index 50b0e42..6b4392e 100644 --- a/BE/src/models/model.ts +++ b/BE/src/models/model.ts @@ -1,4 +1,4 @@ -import db from "../providers/database"; +import db from "@providers/database"; export default class Model { static async insert(pData: T, pTableName: string): Promise { diff --git a/BE/src/models/user.ts b/BE/src/models/user.ts index e783468..c8a0ffd 100644 --- a/BE/src/models/user.ts +++ b/BE/src/models/user.ts @@ -1,4 +1,4 @@ -import Model from "./model"; +import Model from "@models/model"; class UserModel extends Model { static async read(): Promise { diff --git a/BE/src/routes/auth.ts b/BE/src/routes/auth.ts index faff3d3..3270dcb 100644 --- a/BE/src/routes/auth.ts +++ b/BE/src/routes/auth.ts @@ -1,7 +1,7 @@ import express, { Request, Response, NextFunction } from "express"; -import authController from "../controllers/auth"; -import UserModel from "../models/user"; -import { User } from "../interfaces/user"; +import authController from "@controllers/auth"; +import UserModel from "@models/user"; +import { User } from "@interfaces/user"; const router = express.Router(); From 0b73db29b28c61684b02b65c163538220bf70450 Mon Sep 17 00:00:00 2001 From: ji Date: Fri, 30 Oct 2020 16:23:21 +0900 Subject: [PATCH 004/118] =?UTF-8?q?chore:=20lint=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20module-alias=20=EC=84=A4=EC=A0=95=EC=8B=9C?= =?UTF-8?q?=20alias=EB=90=9C=20=EA=B2=BD=EB=A1=9C=EB=A5=BC=20=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EB=AA=BB=ED=95=98=EB=8A=94=20lint=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EA=B0=80=20=EB=B0=9C=EC=83=9D=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/.eslintrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BE/.eslintrc.json b/BE/.eslintrc.json index b8081ef..d06ca2d 100644 --- a/BE/.eslintrc.json +++ b/BE/.eslintrc.json @@ -21,7 +21,8 @@ "ts": "never", "tsx": "never" } - ] + ], + "import/no-unresolved": "off" }, "settings": { "import/resolver": { From 281f4f8b6a19fbcd57f69b41d602826eb122ede1 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sat, 31 Oct 2020 21:51:22 +0900 Subject: [PATCH 005/118] =?UTF-8?q?feat=20:=20user=20=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EC=9D=BD=EC=96=B4=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit user 모델 읽어오기(read) 기능 완성 #44 --- BE/src/models/user.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/BE/src/models/user.ts b/BE/src/models/user.ts index e783468..3150e84 100644 --- a/BE/src/models/user.ts +++ b/BE/src/models/user.ts @@ -1,14 +1,12 @@ +import db from "../providers/database"; import Model from "./model"; +import { User } from "../interfaces/user"; class UserModel extends Model { - static async read(): Promise { - return new Promise((resolve, reject) => { - try { - resolve(1); - } catch (err) { - reject(err); - } - }); + static async read(pLoginID: string, pTableName: string): Promise { + const data = await db.query(`SELECT * FROM ${pTableName} WHERE login_id = ?`, pLoginID); + const userData: User = data[0][0]; + return userData; } } From c5b9f2010dd1431aacd3ffcdf006272bc3b46c51 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sat, 31 Oct 2020 21:58:50 +0900 Subject: [PATCH 006/118] =?UTF-8?q?fix=20:=20model=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20update,=20delete=20=EB=B0=98=ED=99=98=EA=B0=92=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit model 클래서 update, delete 반환 값 affectedRows로 수정 #49 --- BE/src/models/model.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BE/src/models/model.ts b/BE/src/models/model.ts index 50b0e42..699c1ba 100644 --- a/BE/src/models/model.ts +++ b/BE/src/models/model.ts @@ -10,13 +10,13 @@ export default class Model { static async update(pData: T, pTableName: string): Promise { const id = Object.entries(pData)[0][1]; const result = await db.query>(`UPDATE ${pTableName} SET ? WHERE id = ?`, [pData, id]); - const { affectedRow } = result[0]; - return affectedRow; + const { affectedRows } = result[0]; + return affectedRows; } static async delete(id: number, pTableName: string): Promise { const result = await db.query(`DELETE FROM ${pTableName} WHERE id = ?`, id); - const { affectedRow } = result[0]; - return affectedRow; + const { affectedRows } = result[0]; + return affectedRows; } } From b42a954d644ac13636034be4a917ead2d5613dc5 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sat, 31 Oct 2020 22:45:30 +0900 Subject: [PATCH 007/118] =?UTF-8?q?fix=20:=20db=EC=A0=91=EA=B7=BC=20?= =?UTF-8?q?=EB=B9=84=EB=8F=99=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit db 접근확인용 코드 async, await 사용하여 비동기 처리 #44 --- BE/src/routes/auth.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/BE/src/routes/auth.ts b/BE/src/routes/auth.ts index faff3d3..0a9b4a0 100644 --- a/BE/src/routes/auth.ts +++ b/BE/src/routes/auth.ts @@ -12,7 +12,7 @@ router.get("/github/callback", authController.githubLogin); router.get("/github/loginFail", authController.githubLoginFail); router.get("/logout", authController.logout); -router.post("/register", (req: Request, res: Response, next: NextFunction) => { +router.post("/register", async (req: Request, res: Response, next: NextFunction) => { const user: User = { id: null, login_id: req.body.userID, @@ -20,10 +20,11 @@ router.post("/register", (req: Request, res: Response, next: NextFunction) => { img: "img1", created_at: new Date(), }; - UserModel.insert(user, "USER"); + const result = await UserModel.insert(user, "USER"); + res.json(result); }); -router.patch("/register", (req: Request, res: Response, next: NextFunction) => { +router.patch("/register", async (req: Request, res: Response, next: NextFunction) => { const user: User = { id: req.body.id, login_id: req.body.userID, @@ -31,17 +32,21 @@ router.patch("/register", (req: Request, res: Response, next: NextFunction) => { img: "img2", created_at: new Date(), }; - UserModel.update(user, "USER"); + const result = await UserModel.update(user, "USER"); + res.json(result); }); -router.delete("/register", (req: Request, res: Response, next: NextFunction) => { +router.delete("/register", async (req: Request, res: Response, next: NextFunction) => { const { id } = req.body; const nid = Number(id); - UserModel.delete(nid, "USER"); + const result = await UserModel.delete(nid, "USER"); + res.json(result); }); -router.get("/users", (req: Request, res: Response, next: NextFunction) => { - res.send("users"); +router.get("/users/:loginID", async (req: Request, res: Response, next: NextFunction) => { + const { loginID } = req.params; + const result = await UserModel.read(loginID, "USER"); + res.json(result); }); export = router; From 2d59abc32143e54e619c9012a6461176bc0cabb5 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:11:17 +0900 Subject: [PATCH 008/118] =?UTF-8?q?chore=20:=20User=20Model=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=ED=99=95=EC=9D=B8=EC=9A=A9=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User 모델 기능 확인용 코드 삭제 #44 --- BE/src/routes/auth.ts | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/BE/src/routes/auth.ts b/BE/src/routes/auth.ts index 0a9b4a0..e88f549 100644 --- a/BE/src/routes/auth.ts +++ b/BE/src/routes/auth.ts @@ -24,29 +24,4 @@ router.post("/register", async (req: Request, res: Response, next: NextFunction) res.json(result); }); -router.patch("/register", async (req: Request, res: Response, next: NextFunction) => { - const user: User = { - id: req.body.id, - login_id: req.body.userID, - password: req.body.password, - img: "img2", - created_at: new Date(), - }; - const result = await UserModel.update(user, "USER"); - res.json(result); -}); - -router.delete("/register", async (req: Request, res: Response, next: NextFunction) => { - const { id } = req.body; - const nid = Number(id); - const result = await UserModel.delete(nid, "USER"); - res.json(result); -}); - -router.get("/users/:loginID", async (req: Request, res: Response, next: NextFunction) => { - const { loginID } = req.params; - const result = await UserModel.read(loginID, "USER"); - res.json(result); -}); - export = router; From 5135ac96200820eb8848145068d68b10d9959df7 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:57:38 +0900 Subject: [PATCH 009/118] =?UTF-8?q?refactor=20:=20user=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20export=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit user 모델 export 방식 변경 #44 --- BE/src/models/user.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BE/src/models/user.ts b/BE/src/models/user.ts index 3150e84..94eb671 100644 --- a/BE/src/models/user.ts +++ b/BE/src/models/user.ts @@ -2,12 +2,10 @@ import db from "../providers/database"; import Model from "./model"; import { User } from "../interfaces/user"; -class UserModel extends Model { +export default class UserModel extends Model { static async read(pLoginID: string, pTableName: string): Promise { const data = await db.query(`SELECT * FROM ${pTableName} WHERE login_id = ?`, pLoginID); const userData: User = data[0][0]; return userData; } } - -export default UserModel; From ee04a00a85d83b3f2f807f7c7b4c0f7c37685ca2 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:57:52 +0900 Subject: [PATCH 010/118] =?UTF-8?q?feat=20:=20milestone=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 마일스톤 모델 추가 #46 --- BE/src/models/milestone.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 BE/src/models/milestone.ts diff --git a/BE/src/models/milestone.ts b/BE/src/models/milestone.ts new file mode 100644 index 0000000..044f11e --- /dev/null +++ b/BE/src/models/milestone.ts @@ -0,0 +1,11 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Milestone } from "../interfaces/milestone"; + +export default class MilestoneModel extends Model { + static async read(pMilestoneName: string, pTableName: string): promise { + const data = await db.query(`SELECT * FROM ${pTableName} WHERE name = ?`, pMilestoneName); + const milestoneData: Milestone = data[0][0]; + return milestoneData; + } +} From 67cdeba1de55354411ef4eb5d1e112825a5818bb Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:58:05 +0900 Subject: [PATCH 011/118] =?UTF-8?q?feat=20:=20labellist=20.=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 라벨리스트 모델 추가 #48 --- BE/src/models/labellist.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 BE/src/models/labellist.ts diff --git a/BE/src/models/labellist.ts b/BE/src/models/labellist.ts new file mode 100644 index 0000000..784965f --- /dev/null +++ b/BE/src/models/labellist.ts @@ -0,0 +1,11 @@ +import db from "../providers/database"; +import Model from "./model"; +import { LabelList } from "../interfaces/labellist"; + +export default class LabelListModel extends Model { + static async read(pLabelListName: string, pTableName: string): promise { + const data = await db.query(`SELECT * FROM ${pTableName} WHERE name = ?`, pLabelListName); + const LabelListData: LabelList = data[0][0]; + return LabelListData; + } +} From 54f3158889e3e34c2707b68377b613012b95388c Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:59:10 +0900 Subject: [PATCH 012/118] =?UTF-8?q?feat=20:=20label=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 라벨 모델 추가 #50 --- BE/src/models/label.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 BE/src/models/label.ts diff --git a/BE/src/models/label.ts b/BE/src/models/label.ts new file mode 100644 index 0000000..2cac3f4 --- /dev/null +++ b/BE/src/models/label.ts @@ -0,0 +1,5 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Label } from "../interfaces/label"; + +export default class LabelModel extends Model {} From 612b47dda9a35bdb0d0be6229c64452b6ec4983e Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:59:22 +0900 Subject: [PATCH 013/118] =?UTF-8?q?feat=20:=20issue=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이슈 모델 추가 #47 --- BE/src/models/issue.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 BE/src/models/issue.ts diff --git a/BE/src/models/issue.ts b/BE/src/models/issue.ts new file mode 100644 index 0000000..476dbf4 --- /dev/null +++ b/BE/src/models/issue.ts @@ -0,0 +1,5 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Issue } from "../interfaces/issue"; + +export default class IssueModel extends Model {} From 5119358f0b73f1a49ccca363c402ac191bf482fa Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:59:35 +0900 Subject: [PATCH 014/118] =?UTF-8?q?feat=20:=20event=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이벤트 모델 추가 #52 --- BE/src/models/event.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 BE/src/models/event.ts diff --git a/BE/src/models/event.ts b/BE/src/models/event.ts new file mode 100644 index 0000000..d1d034c --- /dev/null +++ b/BE/src/models/event.ts @@ -0,0 +1,5 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Event } from "../interfaces/event"; + +export default class EventModel extends Model {} From c1d0cec03683e0c2004ff51daf0d47a4ef8bdd73 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 16:59:46 +0900 Subject: [PATCH 015/118] =?UTF-8?q?feat=20:=20comment=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 코멘트 모델 추가 #45 --- BE/src/models/comment.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 BE/src/models/comment.ts diff --git a/BE/src/models/comment.ts b/BE/src/models/comment.ts new file mode 100644 index 0000000..69f36bf --- /dev/null +++ b/BE/src/models/comment.ts @@ -0,0 +1,5 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Comment } from "../interfaces/comment"; + +export default class CommentModel extends Model {} From 8817921920729c0c4f7fb973049f7a7b22825d96 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:00:00 +0900 Subject: [PATCH 016/118] =?UTF-8?q?feat=20:=20assignee=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit assignee 모델 추가 #51 --- BE/src/models/assignee.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 BE/src/models/assignee.ts diff --git a/BE/src/models/assignee.ts b/BE/src/models/assignee.ts new file mode 100644 index 0000000..f948f16 --- /dev/null +++ b/BE/src/models/assignee.ts @@ -0,0 +1,5 @@ +import db from "../providers/database"; +import Model from "./model"; +import { Assignee } from "../interfaces/assignee"; + +export default class AssigneeModel extends Model {} From f5ca09b57cfc3e0f877ed9611dcedae7d2d1a0c9 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:01:19 +0900 Subject: [PATCH 017/118] =?UTF-8?q?style=20:=20milestone=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit milestone 인터페이스 milestone 테이블에 맞게 변경 #46 --- BE/src/interfaces/milestone.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BE/src/interfaces/milestone.ts b/BE/src/interfaces/milestone.ts index 7586528..da28b49 100644 --- a/BE/src/interfaces/milestone.ts +++ b/BE/src/interfaces/milestone.ts @@ -1,7 +1,8 @@ +/* eslint-disable camelcase */ export interface Milestone { id: number; name: string; description: string; - dueDate: Date; - createdAt: Date; + due_date: Date; + created_at: Date; } From aeaa4993ca5b150c4dde02ee871f6e98c63efcd5 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:06:30 +0900 Subject: [PATCH 018/118] =?UTF-8?q?sylte=20:=20labellist=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit labellist 인터페이스 db table에 맞게 변경 #48 --- BE/src/interfaces/labellist.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BE/src/interfaces/labellist.ts b/BE/src/interfaces/labellist.ts index c030396..c7e4c07 100644 --- a/BE/src/interfaces/labellist.ts +++ b/BE/src/interfaces/labellist.ts @@ -1,7 +1,8 @@ +/* eslint-disable camelcase */ export interface LabelList { id: number; name: string; description: string; color: string; - createAt: Date; + create_at: Date; } From fc21bfc17ad5451e34e6878d8c0aa34480488330 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:06:55 +0900 Subject: [PATCH 019/118] =?UTF-8?q?style=20:=20label=20=EC=9D=B8=ED=84=B0?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lable 인터페이스 db table에 맞게 수정 #50 --- BE/src/interfaces/label.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BE/src/interfaces/label.ts b/BE/src/interfaces/label.ts index f08e70d..fe93671 100644 --- a/BE/src/interfaces/label.ts +++ b/BE/src/interfaces/label.ts @@ -1,5 +1,6 @@ +/* eslint-disable camelcase */ export interface Label { id: number; - issueID: number; - iabelID: number; + issue_id: number; + iabel_id: number; } From 23e3ec0ca25181ac1091bbda4b469c2425d3db1d Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:07:10 +0900 Subject: [PATCH 020/118] =?UTF-8?q?style=20:=20issue=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issue 인터페이스 db table에 맞게 변경 #47 --- BE/src/interfaces/issue.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BE/src/interfaces/issue.ts b/BE/src/interfaces/issue.ts index 6b3e52e..cd67c16 100644 --- a/BE/src/interfaces/issue.ts +++ b/BE/src/interfaces/issue.ts @@ -1,10 +1,11 @@ +/* eslint-disable camelcase */ export interface Issue { id: number; title: string; body: string; - userID: number; + user_id: number; state: boolean; - milestoneID: number; - createdAt: Date; - closedAt: Date; + milestone_id: number; + created_at: Date; + closed_at: Date; } From 0556ca0c84c8eca3cd956497fb730ee603eac33a Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:07:38 +0900 Subject: [PATCH 021/118] =?UTF-8?q?sylte=20:=20event=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit event 인터페이스 db table에 맞게 변경 #52 --- BE/src/interfaces/event.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BE/src/interfaces/event.ts b/BE/src/interfaces/event.ts index da43238..935f33d 100644 --- a/BE/src/interfaces/event.ts +++ b/BE/src/interfaces/event.ts @@ -1,7 +1,8 @@ +/* eslint-disable camelcase */ export interface Event { id: number; - issueID: number; + issue_id: number; actor: string; log: string; - createdAt: Date; + created_at: Date; } From cc0cc8dd76465fad835551192a779c2de404f78c Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:07:52 +0900 Subject: [PATCH 022/118] =?UTF-8?q?style=20:=20comment=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit comment 인터페이스 db table에 맞게 변경 --- BE/src/interfaces/comment.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BE/src/interfaces/comment.ts b/BE/src/interfaces/comment.ts index 1f76c9e..547b825 100644 --- a/BE/src/interfaces/comment.ts +++ b/BE/src/interfaces/comment.ts @@ -1,8 +1,9 @@ +/* eslint-disable camelcase */ export interface Comment { id: number; - issueID: number; - userID: number; + issue_id: number; + user_id: number; body: string; emoji: string; - createdAt: Date; + created_at: Date; } From 229a4298d73fba4b92bd8690aa02c79c842c92b1 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Sun, 1 Nov 2020 17:08:22 +0900 Subject: [PATCH 023/118] =?UTF-8?q?style=20:=20assignee=20interface=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit assignee 인터페이스 db table에 맞게 변경 #51 --- BE/src/interfaces/assignee.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BE/src/interfaces/assignee.ts b/BE/src/interfaces/assignee.ts index 640b709..e35bf6a 100644 --- a/BE/src/interfaces/assignee.ts +++ b/BE/src/interfaces/assignee.ts @@ -1,5 +1,6 @@ +/* eslint-disable camelcase */ export interface Assignee { id: number; - issueID: number; - userID: number; + issue_id: number; + user_id: number; } From eb204b6f942fac70481f0eb4e6860975aa026fea Mon Sep 17 00:00:00 2001 From: hi0826 Date: Mon, 2 Nov 2020 11:15:08 +0900 Subject: [PATCH 024/118] =?UTF-8?q?refactor=20:=20interface=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit interface 전체 수정 id 속성에 null 같이 쓸 수 있도록 변경 #71 --- BE/src/interfaces/assignee.ts | 2 +- BE/src/interfaces/comment.ts | 2 +- BE/src/interfaces/event.ts | 2 +- BE/src/interfaces/issue.ts | 2 +- BE/src/interfaces/label.ts | 2 +- BE/src/interfaces/labellist.ts | 2 +- BE/src/interfaces/milestone.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BE/src/interfaces/assignee.ts b/BE/src/interfaces/assignee.ts index e35bf6a..f231a74 100644 --- a/BE/src/interfaces/assignee.ts +++ b/BE/src/interfaces/assignee.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Assignee { - id: number; + id: number | null; issue_id: number; user_id: number; } diff --git a/BE/src/interfaces/comment.ts b/BE/src/interfaces/comment.ts index 547b825..cb7b71e 100644 --- a/BE/src/interfaces/comment.ts +++ b/BE/src/interfaces/comment.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Comment { - id: number; + id: number | null; issue_id: number; user_id: number; body: string; diff --git a/BE/src/interfaces/event.ts b/BE/src/interfaces/event.ts index 935f33d..b02b579 100644 --- a/BE/src/interfaces/event.ts +++ b/BE/src/interfaces/event.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Event { - id: number; + id: number | null; issue_id: number; actor: string; log: string; diff --git a/BE/src/interfaces/issue.ts b/BE/src/interfaces/issue.ts index cd67c16..a48f281 100644 --- a/BE/src/interfaces/issue.ts +++ b/BE/src/interfaces/issue.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Issue { - id: number; + id: number | null; title: string; body: string; user_id: number; diff --git a/BE/src/interfaces/label.ts b/BE/src/interfaces/label.ts index fe93671..66f8109 100644 --- a/BE/src/interfaces/label.ts +++ b/BE/src/interfaces/label.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Label { - id: number; + id: number | null; issue_id: number; iabel_id: number; } diff --git a/BE/src/interfaces/labellist.ts b/BE/src/interfaces/labellist.ts index c7e4c07..cdd1306 100644 --- a/BE/src/interfaces/labellist.ts +++ b/BE/src/interfaces/labellist.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface LabelList { - id: number; + id: number | null; name: string; description: string; color: string; diff --git a/BE/src/interfaces/milestone.ts b/BE/src/interfaces/milestone.ts index da28b49..fe7048f 100644 --- a/BE/src/interfaces/milestone.ts +++ b/BE/src/interfaces/milestone.ts @@ -1,6 +1,6 @@ /* eslint-disable camelcase */ export interface Milestone { - id: number; + id: number | null; name: string; description: string; due_date: Date; From 6ea92ab33c4ccea87ecd88bba0cf384de09da82e Mon Sep 17 00:00:00 2001 From: hi0826 Date: Mon, 2 Nov 2020 11:16:34 +0900 Subject: [PATCH 025/118] =?UTF-8?q?refactor=20:=20db=20=EC=BF=BC=EB=A6=AC?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit db 쿼리함수 params 없어도 동작하게 변경 #71 --- BE/src/providers/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/providers/database.ts b/BE/src/providers/database.ts index 48dfe58..b151e00 100644 --- a/BE/src/providers/database.ts +++ b/BE/src/providers/database.ts @@ -18,7 +18,7 @@ class DB { }); } - async query(str: string, params: T): Promise { + async query(str: string, params?: T): Promise { try { const result = await this.pool.query(str, params); return result; From ec1a3dbb03e80837004670ac7ac20901f5790060 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Mon, 2 Nov 2020 11:18:15 +0900 Subject: [PATCH 026/118] =?UTF-8?q?fix=20:=20milestone=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EB=B0=98=ED=99=98=ED=83=80=EC=9E=85=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 반환타입 오타수정 #72 --- BE/src/models/milestone.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/models/milestone.ts b/BE/src/models/milestone.ts index 044f11e..7313040 100644 --- a/BE/src/models/milestone.ts +++ b/BE/src/models/milestone.ts @@ -3,7 +3,7 @@ import Model from "./model"; import { Milestone } from "../interfaces/milestone"; export default class MilestoneModel extends Model { - static async read(pMilestoneName: string, pTableName: string): promise { + static async read(pMilestoneName: string, pTableName: string): Promise { const data = await db.query(`SELECT * FROM ${pTableName} WHERE name = ?`, pMilestoneName); const milestoneData: Milestone = data[0][0]; return milestoneData; From a6419875d328f5ac285231a9b622a96ffb63d0a9 Mon Sep 17 00:00:00 2001 From: ji Date: Mon, 2 Nov 2020 11:38:02 +0900 Subject: [PATCH 027/118] =?UTF-8?q?fix:=20=EB=AA=A8=EB=8D=B8=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit label->tag, labellist->label db테이블명을 적절하게 바꿈으로써 파일명들도 변경 --- BE/src/controllers/tag.ts | 0 BE/src/interfaces/label.ts | 8 +++++--- BE/src/interfaces/labellist.ts | 8 -------- BE/src/interfaces/tag.ts | 6 ++++++ BE/src/models/label.ts | 5 ----- BE/src/models/labellist.ts | 11 ----------- BE/src/models/tag.ts | 0 7 files changed, 11 insertions(+), 27 deletions(-) create mode 100644 BE/src/controllers/tag.ts delete mode 100644 BE/src/interfaces/labellist.ts create mode 100644 BE/src/interfaces/tag.ts delete mode 100644 BE/src/models/labellist.ts create mode 100644 BE/src/models/tag.ts diff --git a/BE/src/controllers/tag.ts b/BE/src/controllers/tag.ts new file mode 100644 index 0000000..e69de29 diff --git a/BE/src/interfaces/label.ts b/BE/src/interfaces/label.ts index 66f8109..cdd1306 100644 --- a/BE/src/interfaces/label.ts +++ b/BE/src/interfaces/label.ts @@ -1,6 +1,8 @@ /* eslint-disable camelcase */ -export interface Label { +export interface LabelList { id: number | null; - issue_id: number; - iabel_id: number; + name: string; + description: string; + color: string; + create_at: Date; } diff --git a/BE/src/interfaces/labellist.ts b/BE/src/interfaces/labellist.ts deleted file mode 100644 index cdd1306..0000000 --- a/BE/src/interfaces/labellist.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable camelcase */ -export interface LabelList { - id: number | null; - name: string; - description: string; - color: string; - create_at: Date; -} diff --git a/BE/src/interfaces/tag.ts b/BE/src/interfaces/tag.ts new file mode 100644 index 0000000..66f8109 --- /dev/null +++ b/BE/src/interfaces/tag.ts @@ -0,0 +1,6 @@ +/* eslint-disable camelcase */ +export interface Label { + id: number | null; + issue_id: number; + iabel_id: number; +} diff --git a/BE/src/models/label.ts b/BE/src/models/label.ts index 2cac3f4..e69de29 100644 --- a/BE/src/models/label.ts +++ b/BE/src/models/label.ts @@ -1,5 +0,0 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Label } from "../interfaces/label"; - -export default class LabelModel extends Model {} diff --git a/BE/src/models/labellist.ts b/BE/src/models/labellist.ts deleted file mode 100644 index 784965f..0000000 --- a/BE/src/models/labellist.ts +++ /dev/null @@ -1,11 +0,0 @@ -import db from "../providers/database"; -import Model from "./model"; -import { LabelList } from "../interfaces/labellist"; - -export default class LabelListModel extends Model { - static async read(pLabelListName: string, pTableName: string): promise { - const data = await db.query(`SELECT * FROM ${pTableName} WHERE name = ?`, pLabelListName); - const LabelListData: LabelList = data[0][0]; - return LabelListData; - } -} diff --git a/BE/src/models/tag.ts b/BE/src/models/tag.ts new file mode 100644 index 0000000..e69de29 From c42753fc977d62c7891185e437dbcb4e7e25e1f2 Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 11:47:34 +0900 Subject: [PATCH 028/118] =?UTF-8?q?:=20local-login=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20jwt=20=ED=86=A0=ED=81=B0=EC=9D=84=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=ED=82=A4=EB=A1=9C=20=EC=A4=8C=20local=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=EB=8F=84=20=EC=9D=B4=EC=A0=9C=20jwt=20token=20?= =?UTF-8?q?=EC=9D=84=20=EB=B0=9C=EA=B8=89=ED=95=A9=EB=8B=88=EB=8B=A4.=20?= =?UTF-8?q?=20#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/package-lock.json | 8 ++++++++ BE/package.json | 1 + BE/src/controllers/auth.ts | 8 +++++++- BE/src/providers/passport.ts | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/BE/package-lock.json b/BE/package-lock.json index 3cfa8b9..86b30fa 100644 --- a/BE/package-lock.json +++ b/BE/package-lock.json @@ -208,6 +208,14 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/jsonwebtoken": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.0.tgz", + "integrity": "sha512-9bVao7LvyorRGZCw0VmH/dr7Og+NdjYSsKAxB43OQoComFbBgsEpoR9JW6+qSq/ogwVBg8GI2MfAlk4SYI4OLg==", + "requires": { + "@types/node": "*" + } + }, "@types/mime": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", diff --git a/BE/package.json b/BE/package.json index 8ee83bd..c98a723 100644 --- a/BE/package.json +++ b/BE/package.json @@ -26,6 +26,7 @@ }, "dependencies": { "@types/express-session": "^1.17.0", + "@types/jsonwebtoken": "^8.5.0", "@types/passport": "^1.0.4", "@types/passport-github": "^1.1.5", "@types/passport-local": "^1.0.33", diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index f1a94b7..3c7ec31 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -1,5 +1,10 @@ import { Request, Response } from "express"; import passport from "passport"; +import jwt from "jsonwebtoken"; +import dotenv from "dotenv"; +import path from "path"; + +dotenv.config({ path: path.join(__dirname, "../../.env") }); function login(req: Request, res: Response): void { passport.authenticate("local", (err, userResult) => { @@ -13,7 +18,8 @@ function login(req: Request, res: Response): void { if (error) { return res.send(error); } - return res.json({ userResult }); + const token = jwt.sign(JSON.parse(JSON.stringify(userResult)), String(process.env.JWT_SECRET), { expiresIn: "10m" }); + return res.json({ userResult, token }); }); })(req, res); } diff --git a/BE/src/providers/passport.ts b/BE/src/providers/passport.ts index 885b3aa..f994e91 100644 --- a/BE/src/providers/passport.ts +++ b/BE/src/providers/passport.ts @@ -31,9 +31,9 @@ class Passport { clientSecret: process.env.GIT_PASSWORD as string, callbackURL: process.env.GIT_CALLBACK as string, }, - async (accessToken, refreshToken, profile, cb) => { + async (accessToken, refreshToken, profile, done) => { const user = profile; - return cb(null, user); + return done(null, user); } ) ); From 7dd09cedc6c05b49396dd338fcd5a61bff0afc29 Mon Sep 17 00:00:00 2001 From: ji Date: Mon, 2 Nov 2020 12:02:05 +0900 Subject: [PATCH 029/118] =?UTF-8?q?fix=20:=20import=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit module-alias 적용으로 모든 파일의 경로 수정 --- BE/package-lock.json | 3 +-- BE/src/models/assignee.ts | 6 +++--- BE/src/models/comment.ts | 6 +++--- BE/src/models/event.ts | 6 +++--- BE/src/models/issue.ts | 6 +++--- BE/src/models/milestone.ts | 6 +++--- BE/src/models/user.ts | 2 ++ BE/src/providers/passport.ts | 2 +- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/BE/package-lock.json b/BE/package-lock.json index d8e544d..0654402 100644 --- a/BE/package-lock.json +++ b/BE/package-lock.json @@ -2618,8 +2618,7 @@ "module-alias": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", - "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", - "dev": true + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" }, "morgan": { "version": "1.10.0", diff --git a/BE/src/models/assignee.ts b/BE/src/models/assignee.ts index f948f16..d2b4fc9 100644 --- a/BE/src/models/assignee.ts +++ b/BE/src/models/assignee.ts @@ -1,5 +1,5 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Assignee } from "../interfaces/assignee"; +import db from "@providers/database"; +import Model from "@models/model"; +import { Assignee } from "@interfaces/assignee"; export default class AssigneeModel extends Model {} diff --git a/BE/src/models/comment.ts b/BE/src/models/comment.ts index 69f36bf..7c91596 100644 --- a/BE/src/models/comment.ts +++ b/BE/src/models/comment.ts @@ -1,5 +1,5 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Comment } from "../interfaces/comment"; +import db from "@providers/database"; +import Model from "@models/model"; +import { Comment } from "@interfaces/comment"; export default class CommentModel extends Model {} diff --git a/BE/src/models/event.ts b/BE/src/models/event.ts index d1d034c..14a074d 100644 --- a/BE/src/models/event.ts +++ b/BE/src/models/event.ts @@ -1,5 +1,5 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Event } from "../interfaces/event"; +import db from "@providers/database"; +import Model from "@models/model"; +import { Event } from "@interfaces/event"; export default class EventModel extends Model {} diff --git a/BE/src/models/issue.ts b/BE/src/models/issue.ts index 476dbf4..38d9bcb 100644 --- a/BE/src/models/issue.ts +++ b/BE/src/models/issue.ts @@ -1,5 +1,5 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Issue } from "../interfaces/issue"; +import db from "@providers/database"; +import Model from "@models/model"; +import { Issue } from "@interfaces/issue"; export default class IssueModel extends Model {} diff --git a/BE/src/models/milestone.ts b/BE/src/models/milestone.ts index 7313040..72f67da 100644 --- a/BE/src/models/milestone.ts +++ b/BE/src/models/milestone.ts @@ -1,6 +1,6 @@ -import db from "../providers/database"; -import Model from "./model"; -import { Milestone } from "../interfaces/milestone"; +import db from "@providers/database"; +import Model from "@models/model"; +import { Milestone } from "@interfaces/milestone"; export default class MilestoneModel extends Model { static async read(pMilestoneName: string, pTableName: string): Promise { diff --git a/BE/src/models/user.ts b/BE/src/models/user.ts index 5e1ebd8..417b319 100644 --- a/BE/src/models/user.ts +++ b/BE/src/models/user.ts @@ -1,4 +1,6 @@ import Model from "@models/model"; +import db from "@providers/database"; +import { User } from "@interfaces/user"; export default class UserModel extends Model { static async read(pLoginID: string, pTableName: string): Promise { diff --git a/BE/src/providers/passport.ts b/BE/src/providers/passport.ts index 885b3aa..88cfc4c 100644 --- a/BE/src/providers/passport.ts +++ b/BE/src/providers/passport.ts @@ -23,7 +23,7 @@ class Passport { } ) ); - //Github Strategy + // Github Strategy passport.use( new GithubStrategy( { From 251dce09998a41163d895e63e33eec4ec21d293b Mon Sep 17 00:00:00 2001 From: hi0826 Date: Mon, 2 Nov 2020 14:18:08 +0900 Subject: [PATCH 030/118] =?UTF-8?q?feat=20:=20model=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EB=B3=80=EA=B2=BD,=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit model 클래스 static 함수 제거, 멤버함수로 변경, select 추상메서드 추가, 예외처리 #49 --- BE/src/models/model.ts | 54 +++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/BE/src/models/model.ts b/BE/src/models/model.ts index 699c1ba..5e70e7f 100644 --- a/BE/src/models/model.ts +++ b/BE/src/models/model.ts @@ -1,22 +1,48 @@ import db from "../providers/database"; -export default class Model { - static async insert(pData: T, pTableName: string): Promise { - const data = await db.query(`INSERT INTO ${pTableName} SET ?`, pData); - const { insertId } = data[0]; - return insertId; +export default abstract class Model { + data: any; + + constructor() { + this.data = 0; + } + + async insert(pData: T, pTableName: string): Promise { + try { + const data = await db.query(`INSERT INTO ${pTableName} SET ?`, pData); + const { insertId } = data[0]; + this.data = insertId; + return this.data; + } catch (err) { + console.error(err); + return err; + } } - static async update(pData: T, pTableName: string): Promise { - const id = Object.entries(pData)[0][1]; - const result = await db.query>(`UPDATE ${pTableName} SET ? WHERE id = ?`, [pData, id]); - const { affectedRows } = result[0]; - return affectedRows; + async update(pData: T, pTableName: string): Promise { + try { + const id = Object.entries(pData)[0][1]; + const result = await db.query>(`UPDATE ${pTableName} SET ? WHERE id = ?`, [pData, id]); + const { affectedRows } = result[0]; + this.data = affectedRows; + return this.data; + } catch (err) { + console.error(err); + return err; + } } - static async delete(id: number, pTableName: string): Promise { - const result = await db.query(`DELETE FROM ${pTableName} WHERE id = ?`, id); - const { affectedRows } = result[0]; - return affectedRows; + async delete(id: number, pTableName: string): Promise { + try { + const result = await db.query(`DELETE FROM ${pTableName} WHERE id = ?`, id); + const { affectedRows } = result[0]; + this.data = affectedRows; + return this.data; + } catch (err) { + console.error(err); + return err; + } } + + abstract async select(pData: T): Promise; } From 09fcdcb7862a5e7c45d90b67acd74d2a01db7e2c Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 14:23:18 +0900 Subject: [PATCH 031/118] =?UTF-8?q?feat=20:=20github=20login=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=20=EA=B9=83=ED=97=88?= =?UTF-8?q?=EB=B8=8C=20=EC=97=90=EC=84=9C=20=EB=B0=9B=EC=95=84=EC=98=A8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EB=A5=BC=20=EB=8B=A4=EC=9D=8C=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=EB=84=98=EA=B8=B0=EB=8A=94=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A5=BC=20=EC=9C=84=ED=95=9C=20commit=20=20?= =?UTF-8?q?=EC=9E=85=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/controllers/auth.ts | 19 ++++++++++++++++++- BE/src/providers/passport.ts | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index 3c7ec31..d60b916 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -33,5 +33,22 @@ function githubLogin(req: Request, res: Response): any { function githubLoginFail(req: Request, res: Response): any { return res.json({ state: "fail" }); } -const github = passport.authenticate("github", { failureRedirect: "/auth/github/loginFail" }); +//const github = passport.authenticate("github", { failureRedirect: "/auth/github/loginFail" }); +function github(req: Request, res: Response): void { + passport.authenticate("local", (err, userResult) => { + if (err || !userResult) { + return res.status(400).json({ + message: "Something is not right", + user: userResult, + }); + } + req.login(userResult, (error) => { + if (error) { + return res.send(error); + } + const token = jwt.sign(JSON.parse(JSON.stringify(userResult)), String(process.env.JWT_SECRET), { expiresIn: "10m" }); + return res.json({ userResult, token }); + }); + })(req, res); +} export default { login, logout, githubLogin, githubLoginFail, github }; diff --git a/BE/src/providers/passport.ts b/BE/src/providers/passport.ts index f994e91..e795b02 100644 --- a/BE/src/providers/passport.ts +++ b/BE/src/providers/passport.ts @@ -33,7 +33,7 @@ class Passport { }, async (accessToken, refreshToken, profile, done) => { const user = profile; - return done(null, user); + return done(null, { user, accessToken }, { message: "Logged In Successfully" }); } ) ); From 70b3d7bf89744fb4635cc5d2a820943396e48f30 Mon Sep 17 00:00:00 2001 From: hi0826 Date: Mon, 2 Nov 2020 14:40:51 +0900 Subject: [PATCH 032/118] =?UTF-8?q?feat=20:=20user=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD,=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit select 추상함수 받아쓰기 상속 받아서 사용하게 변경 --- BE/src/models/user.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/BE/src/models/user.ts b/BE/src/models/user.ts index 94eb671..11300fb 100644 --- a/BE/src/models/user.ts +++ b/BE/src/models/user.ts @@ -2,10 +2,30 @@ import db from "../providers/database"; import Model from "./model"; import { User } from "../interfaces/user"; -export default class UserModel extends Model { - static async read(pLoginID: string, pTableName: string): Promise { - const data = await db.query(`SELECT * FROM ${pTableName} WHERE login_id = ?`, pLoginID); - const userData: User = data[0][0]; - return userData; +class UserModel extends Model { + type: string; + + constructor() { + super(); + this.type = "USERMODEL"; + } + + async select(pData: T): Promise { + try { + const result = await db.query(`SELECT * FROM USER WHERE login_id = ?`, pData); + this.data = [...result[0]]; + return this.data; + } catch (err) { + console.error(err); + return err; + } + } + + async addUser(pData: User): Promise { + this.data = await super.insert(pData, "USER"); + return this.data; } } + +const user = new UserModel(); +export default user; From 8811a4c4b58504436e2a77aa9c0b6a1f0d6ac48c Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 14:49:28 +0900 Subject: [PATCH 033/118] =?UTF-8?q?fix:github=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20github=20staregy=20?= =?UTF-8?q?=EA=B0=80=20local=20=EB=A1=9C=20=EB=93=B1=EB=A1=9D=EB=90=98?= =?UTF-8?q?=EC=96=B4=EC=9E=88=EB=8D=98=EC=A0=90=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/controllers/auth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index d60b916..a699010 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -35,7 +35,7 @@ function githubLoginFail(req: Request, res: Response): any { } //const github = passport.authenticate("github", { failureRedirect: "/auth/github/loginFail" }); function github(req: Request, res: Response): void { - passport.authenticate("local", (err, userResult) => { + passport.authenticate("github", (err, userResult) => { if (err || !userResult) { return res.status(400).json({ message: "Something is not right", From 049aa1fa9e538c5e42933721d6537ed2d51c351c Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 14:52:53 +0900 Subject: [PATCH 034/118] =?UTF-8?q?fix=20:=20github=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EB=8B=A4=EB=A5=B8=20=EB=B0=A9=EB=B2=95?= =?UTF-8?q?=EC=9D=98=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?=ED=95=B4=EB=B4=84=20(=20callback=20=EC=97=90=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98=ED=95=98=EC=A7=80=20=EC=95=8A=EC=95=98=EB=8D=94?= =?UTF-8?q?=EB=8B=88=20=EB=82=B4=EC=9A=A9=EC=9D=B4=20=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=95=8A=EC=9D=8C=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/controllers/auth.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index a699010..83707e8 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -28,6 +28,7 @@ function logout(req: Request, res: Response): any { return res.json({ state: "success" }); } function githubLogin(req: Request, res: Response): any { + console.log(req.body); return res.json({ state: "success" }); } function githubLoginFail(req: Request, res: Response): any { From 8286f0d349169e14099c1baf4b9725d378da29ea Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 14:56:53 +0900 Subject: [PATCH 035/118] =?UTF-8?q?fix:github=202=EC=B0=A8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=202=EC=B0=A8=EC=A0=81=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=96=88=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/controllers/auth.ts | 21 ++------------------- BE/src/providers/passport.ts | 4 ++-- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index 83707e8..275bea0 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -28,28 +28,11 @@ function logout(req: Request, res: Response): any { return res.json({ state: "success" }); } function githubLogin(req: Request, res: Response): any { - console.log(req.body); + console.log(req.user); return res.json({ state: "success" }); } function githubLoginFail(req: Request, res: Response): any { return res.json({ state: "fail" }); } -//const github = passport.authenticate("github", { failureRedirect: "/auth/github/loginFail" }); -function github(req: Request, res: Response): void { - passport.authenticate("github", (err, userResult) => { - if (err || !userResult) { - return res.status(400).json({ - message: "Something is not right", - user: userResult, - }); - } - req.login(userResult, (error) => { - if (error) { - return res.send(error); - } - const token = jwt.sign(JSON.parse(JSON.stringify(userResult)), String(process.env.JWT_SECRET), { expiresIn: "10m" }); - return res.json({ userResult, token }); - }); - })(req, res); -} +const github = passport.authenticate("github", { failureRedirect: "/auth/github/loginFail" }); export default { login, logout, githubLogin, githubLoginFail, github }; diff --git a/BE/src/providers/passport.ts b/BE/src/providers/passport.ts index e795b02..dbb3ad3 100644 --- a/BE/src/providers/passport.ts +++ b/BE/src/providers/passport.ts @@ -32,8 +32,8 @@ class Passport { callbackURL: process.env.GIT_CALLBACK as string, }, async (accessToken, refreshToken, profile, done) => { - const user = profile; - return done(null, { user, accessToken }, { message: "Logged In Successfully" }); + const user = { profile, accessToken }; + return done(null, user, { message: "Logged In Successfully" }); } ) ); From 0c189aa14a83b984cb126af83b4d925536e4beee Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 15:08:02 +0900 Subject: [PATCH 036/118] =?UTF-8?q?fix:github=203=EC=B0=A8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=203=EC=B0=A8=20=EC=8B=9C=EB=8F=84=EC=9E=85=EB=8B=88?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/routes/auth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/routes/auth.ts b/BE/src/routes/auth.ts index faff3d3..ebb4f25 100644 --- a/BE/src/routes/auth.ts +++ b/BE/src/routes/auth.ts @@ -8,7 +8,7 @@ const router = express.Router(); router.post("/login", authController.login); router.get("/github", authController.github); -router.get("/github/callback", authController.githubLogin); +router.get("/github/callback", authController.github, authController.githubLogin); router.get("/github/loginFail", authController.githubLoginFail); router.get("/logout", authController.logout); From 12ac91a3d8416d8a15f05e113d60930adc02767b Mon Sep 17 00:00:00 2001 From: mononomo Date: Mon, 2 Nov 2020 15:20:24 +0900 Subject: [PATCH 037/118] =?UTF-8?q?fix=20:=20github=20token=20=EC=A3=BC?= =?UTF-8?q?=EA=B8=B0=20github=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=9D=84=20?= =?UTF-8?q?=ED=95=98=EB=A9=B4=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4=EC=99=80=20accesstoken=20?= =?UTF-8?q?=EC=9D=84=20=EC=A4=8D=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/controllers/auth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BE/src/controllers/auth.ts b/BE/src/controllers/auth.ts index 275bea0..90ec6ca 100644 --- a/BE/src/controllers/auth.ts +++ b/BE/src/controllers/auth.ts @@ -18,8 +18,8 @@ function login(req: Request, res: Response): void { if (error) { return res.send(error); } - const token = jwt.sign(JSON.parse(JSON.stringify(userResult)), String(process.env.JWT_SECRET), { expiresIn: "10m" }); - return res.json({ userResult, token }); + const accessToken = jwt.sign(JSON.parse(JSON.stringify(userResult)), String(process.env.JWT_SECRET), { expiresIn: "10m" }); + return res.json({ userResult, accessToken }); }); })(req, res); } @@ -28,8 +28,8 @@ function logout(req: Request, res: Response): any { return res.json({ state: "success" }); } function githubLogin(req: Request, res: Response): any { - console.log(req.user); - return res.json({ state: "success" }); + const userResult = req.user; + return res.json({ state: "success", userResult }); } function githubLoginFail(req: Request, res: Response): any { return res.json({ state: "fail" }); From 134e68443b43c105e85a40437055af9a08474306 Mon Sep 17 00:00:00 2001 From: ji Date: Mon, 2 Nov 2020 15:23:33 +0900 Subject: [PATCH 038/118] =?UTF-8?q?feat:=20label=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8A=94=20api=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit label 전체 목록을 불러오는 api 구 #48 --- BE/src/controllers/label.ts | 8 ++++++++ BE/src/models/label.ts | 27 +++++++++++++++++++++++++++ BE/src/routes/label.ts | 16 +++------------- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/BE/src/controllers/label.ts b/BE/src/controllers/label.ts index e69de29..b4459c7 100644 --- a/BE/src/controllers/label.ts +++ b/BE/src/controllers/label.ts @@ -0,0 +1,8 @@ +import { Request, Response } from "express"; +import LabelModel from "@models/label"; +import { Label } from "@interfaces/label"; + +const getLabel = async (req: Request, res: Response): Promise => { + const result = await LabelModel.get(); + return res.json(result); +}; diff --git a/BE/src/models/label.ts b/BE/src/models/label.ts index e69de29..0e03f95 100644 --- a/BE/src/models/label.ts +++ b/BE/src/models/label.ts @@ -0,0 +1,27 @@ +import { Label } from "@interfaces/label"; +import { User } from "@interfaces/user"; +import Model from "@models/model"; +import db from "@providers/database"; + +class LabelModel extends Model { + tableName: string; + + constructor() { + super(); + this.tableName = "LABEL"; + } + + async get(): Promise> { + const res: Array