์ ์กฐ์ด์ ์ ํ์ด๋ฅผ ์ต์ํ ํํ์ผ๋ก ๋ฒ์ญํด์ฃผ๋ ์๋น์ค. (์ผ ๋๋ ์ผ๋ฏผ์ด ๋ ์ ์์ด!)
๊น๊ฒฝ๋ฆฐ | ์ ์ค์ |
---|---|
kkl4846 | sunseo18 |
๐ API Docs
Route | Func | Role | Done |
---|---|---|---|
TRANSLATOR | ์ผ๋ฏผ์ด ๋ฒ์ญํ๊ธฐ | ์ ์ค์ | โ |
QUIZ | ํด์ฆ ๋ฌธ์ ๋ฐ ์ ๋ต ์ฃผ๊ธฐ | ๊น๊ฒฝ๋ฆฐ | โ |
- [Commit Convention] git commit message convention
ex) Feat: User API ํ์ผ ์ถ๊ฐ
- Chore : ์ฝ๋ ์์ , ๋ด๋ถ ํ์ผ ์์
- Feat : ์๋ก์ด ๊ธฐ๋ฅ ๊ตฌํ
- Add : Feat ์ด์ธ์ ๋ถ์์ ์ธ ์ฝ๋ ์ถ๊ฐ, ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐ, ์๋ก์ด ํ์ผ ์์ฑ ์
- Fix : ๋ฒ๊ทธ, ์ค๋ฅ ํด๊ฒฐ
- Del : ์ธ๋ชจ์๋ ์ฝ๋ ์ญ์
- Docs : README๋ WIKI ๋ฑ์ ๋ฌธ์ ๊ฐ์
- Move : ํ๋ก์ ํธ ๋ด ํ์ผ์ด๋ ์ฝ๋์ ์ด๋
- Rename : ํ์ผ ์ด๋ฆ์ ๋ณ๊ฒฝ
- Merge: ๋ค๋ฅธ๋ธ๋ ์น๋ฅผ mergeํ๋ ๊ฒฝ์ฐ
- Style : ์ฝ๋๊ฐ ์๋ ์คํ์ผ ๋ณ๊ฒฝ์ ํ๋ ๊ฒฝ์ฐ
- Init : Initial commit์ ํ๋ ๊ฒฝ์ฐ
๐ก ๋๋ฃ๋ค๊ณผ ๋งํฌ๋ฅผ ํต์ผํ๊ธฐ ์ํด ์ปจ๋ฒค์ ์ ์ง์ ํฉ๋๋ค. ์คํฉ์ง์กธ์ ์ฝ๋๊ฐ ์๋, ํ ์ฌ๋์ด ์ง ๊ฒ๊ฐ์ ์ฝ๋๋ฅผ ์์ฑํ๋ ๊ฒ์ด ์ถํ ์ ์ง๋ณด์๋ ํ์ ์์ ๋์์ด ๋ฉ๋๋ค. ๋ด๊ฐ ์ฝ๋๋ฅผ ์๊ฐํ๋ฉด์ ์งค ์ ์๋๋ก ํด์ฃผ๋ ๋ฃฐ์ด๋ผ๊ณ ์๊ฐํด๋ ์ข์ต๋๋ค!
๋ช ๋ช ๊ท์น(Naming Conventions)
- ์ด๋ฆ์ผ๋ก๋ถํฐ ์๋๊ฐ ์ฝํ์ง ์ ์๊ฒ ์ด๋ค.
-
ex)
// bad function q() { // ...stuff... } // good function query() { // ..stuff.. }
- ์ค๋ธ์ ํธ, ํจ์, ๊ทธ๋ฆฌ๊ณ ์ธ์คํด์ค์๋
camelCase
๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
// bad const OBJEcttsssss = {}; const this_is_my_object = {}; function c() {} // good const thisIsMyObject = {}; function thisIsMyFunction() {}
- ํด๋์ค๋ constructor์๋
PascalCase
๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
// bad function user(options) { this.name = options.name; } const bad = new user({ name: 'nope', }); // good class User { constructor(options) { this.name = options.name; } } const good = new User({ name: 'yup', });
- ํจ์ ์ด๋ฆ์ ๋์ฌ + ๋ช
์ฌ ํํ๋ก ์์ฑํ๋ค.
ex)
postUserInformation( )
- ์ฝ์ด ์ฌ์ฉ์ ์ต๋ํ ์ง์ํ๋ค.
- ์ด๋ฆ์ ๋ค ๋จ์ด ์ด์์ด ๋ค์ด๊ฐ๋ฉด ํ์๊ณผ ์์๋ฅผ ๊ฑฐ์น ํ ์ฌ์ฉํ๋ค
๋ธ๋ก(Blocks)
- ๋ณต์ํ์ ๋ธ๋ก์๋ ์ค๊ดํธ({})๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
// bad if (test) return false; // good if (test) return false; // good if (test) { return false; } // bad function() { return false; } // good function() { return false; }
- ๋ณต์ํ ๋ธ๋ก์
if
์else
๋ฅผ ์ด์ฉํ๋ ๊ฒฝ์ฐelse
๋if
๋ธ๋ก ๋์ ์ค๊ดํธ( } )์ ๊ฐ์ ํ์ ์์น์ํจ๋ค.
-
ex) ```java // bad if (test) { thing1(); thing2(); } else { thing3(); }
// good if (test) { thing1(); thing2(); } else { thing3(); } ```
์ฝ๋ฉํธ(Comments)
- ๋ณต์ํ์ ์ฝ๋ฉํธ๋
/** ... */
๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
// good /** * @param {String} tag * @return {Element} element */ function make(tag) { // ...stuff... return element; }
- ๋จ์ผ ํ์ ์ฝ๋ฉํธ์๋
//
์ ์ฌ์ฉํ๊ณ ์ฝ๋ฉํธ๋ฅผ ์ถ๊ฐํ๊ณ ์ถ์ ์ฝ๋์ ์๋ถ์ ๋ฐฐ์นํ๋ค. ๊ทธ๋ฆฌ๊ณ ์ฝ๋ฉํธ์ ์์ ๋น ํ์ ๋ฃ๋๋ค.
-
ex) ```jsx // bad const active = true; // is current tab
// good // is current tab const active = true; // good function getType() { console.log('fetching type...'); // set the default type to 'no type' const type = this._type || 'no type'; return type; } ```
๋ฌธ์์ด(Strings)
- ๋ฌธ์์ด์๋ ์ฑํฌ์ฟผํธ
''
๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
// bad const name = 'Capt. Janeway'; // good const name = 'Capt. Janeway';
- ํ๋ก๊ทธ๋จ์์ ๋ฌธ์์ด์ ์์ฑํ๋ ๊ฒฝ์ฐ๋ ๋ฌธ์์ด ์ฐ๊ฒฐ์ด ์๋
template strings
๋ฅผ ์ด์ฉํ๋ค.
-
ex) ```jsx // bad function sayHi(name) { return 'How are you, ' + name + '?'; }
// bad function sayHi(name) { return ['How are you, ', name, '?'].join(); } // good function sayHi(name) { return `How are you, ${name}?`; } ```
ํจ์(Functions)
- ํ์ดํ ํจ์๋ฅผ ์ฌ์ฉํ๋ค.
- ex)
var arr1 = [1, 2, 3]; var pow1 = arr.map(function (x) { // ES5 Not Good return x * x; }); const arr2 = [1, 2, 3]; const pow2 = arr.map((x) => x * x); // ES6 Good
์กฐ๊ฑด์๊ณผ ๋ฑ๊ฐ์(Comparison Operators & Equality)
==
์ด๋!=
๋ณด๋ค===
์!==
์ ์ฌ์ฉํ๋ค.- ๋จ์ถํ์ ์ฌ์ฉํ๋ค.
- ex)
// bad if (name !== '') { // ...stuff... } // good if (name) { // ...stuff... }
- ๋น๋๊ธฐ ํจ์๋ฅผ ์ฌ์ฉํ ๋
Promise
ํจ์์ ์ฌ์ฉ์ ์ง์ํ๊ณasync
,await
๋ฅผ ์ฐ๋๋ก ํ๋ค
๐ฑ git branch ์ ๋ต
main branch
: ๋ฐฐํฌ ๋จ์ branch
develop branch
: ์ฃผ์ ๊ฐ๋ฐ branch, main merge ์ ๊ฑฐ์น๋ branch
feature branch
: ๊ฐ์ ๊ฐ๋ฐ branch
- ํ ์ผ issue ๋ฑ๋ก ํ ๋ณธ์ธ์ ๋๋ค์ branch ์์ฑ ํ ์์
- ex) feature/'๋๋ค์'
- ํด๋น branch ์์
์๋ฃ ํ PR ๋ณด๋ด๊ธฐ
- ํญ์ local์์ ์ถฉ๋ ํด๊ฒฐ ํ โ remote์ ์ฌ๋ฆฌ๊ธฐ
- reviewer์ ์๋ก tagํ code-review
- comment ์ merge ๋ถ๊ฐ!
- main
- develop
- feature
โโโ kkl
โโโ jjs
๐ prisma
- schema.prisma
๐ src
๐ config
- index.ts
๐ controller
- index.ts
- translatorController.ts
- quizController.ts
๐ constants
- index.ts
- response.ts
- responseMessage.ts
- statusCode.ts
๐ route
- index.ts
- translatorRouter.ts
- quizRouter.ts
๐ services
- index.ts
- translatorService.ts
- quizService.ts
- index.ts
{
"name": "soptkathon",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon",
"build": "tsc && node dist",
"db:pull": "npx prisma db pull",
"db:push": "npx prisma db push",
"generate": "npx prisma generate"
},
"devDependencies": {
"@types/express": "^4.17.14",
"@types/node": "^18.11.9",
"nodemon": "^2.0.20",
"prettier": "2.7.1"
},
"dependencies": {
"@prisma/client": "^4.6.1",
"express": "^4.18.2",
"prisma": "^4.6.1"
}
}
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Example {
id Int @id @default(autoincrement())
text String @db.VarChar(50)
quiz_id Int
Quiz_Example_quiz_idToQuiz Quiz @relation("Example_quiz_idToQuiz", fields: [quiz_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "example_quiz_id_fk")
Quiz_ExampleToQuiz_answer_id Quiz[] @relation("ExampleToQuiz_answer_id")
}
model Quiz {
id Int @id @default(autoincrement())
question String @db.VarChar(100)
answer_id Int?
Example_ExampleToQuiz_answer_id Example? @relation("ExampleToQuiz_answer_id", fields: [answer_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "quiz_example_id_fk")
Example_Example_quiz_idToQuiz Example[] @relation("Example_quiz_idToQuiz")
}
model Translator {
input String @id @db.VarChar(50)
result String? @db.VarChar(100)
description String @db.VarChar(500)
example String? @db.VarChar(500)
}