Skip to content

Employee wiki web application developed during Yanolja boot camp's toy1

Notifications You must be signed in to change notification settings

YFE-toy1-highfive/toy1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 

Repository files navigation

๐Ÿ“… ์ง์›๋“ค์„ ์œ„ํ•œ ์œ„ํ‚ค ์‚ฌ์ดํŠธ

์ง์› ๋“ค์„ ์œ„ํ•œ ์œ„ํ‚ค ์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค์–ด๋ณด์„ธ์š”! ์œ„ํ‚ค ์‚ฌ์ดํŠธ์—๋Š” ์œ„ํ‚ค ๋ฟ ์•„๋‹ˆ๋ผ ์—ฌ๋Ÿฌ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค!

[๊ณผ์ œ ์ˆ˜ํ–‰ ๋ฐ ์ œ์ถœ ๋ฐฉ๋ฒ•]

  1. ํ˜„์žฌ ์ €์žฅ์†Œ๋ฅผ ๋กœ์ปฌ์— ํด๋ก (Clone)ํ•ฉ๋‹ˆ๋‹ค.
  2. ์ž์‹ ์˜ ํŒ€๋ช…์œผ๋กœ ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.(๊ตฌ๋ถ„ ๊ฐ€๋Šฅํ•˜๋„๋ก ํŒ€๋ช…์„ ๊ผญ ํŒŒ์Šค์นผ์ผ€์ด์Šค๋กœ ํ‘œ์‹œํ•˜์„ธ์š”, git branch Y_FE_Toy1_Team13)
  3. ์ž์‹ ์˜ ํŒ€๋ช… ๋ธŒ๋žœ์น˜์—์„œ ๊ณผ์ œ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
  4. ๊ณผ์ œ ์ˆ˜ํ–‰์ด ์™„๋ฃŒ๋˜๋ฉด, ์ž์‹ ์˜ ํŒ€๋ช… ๋ธŒ๋žœ์น˜๋ฅผ ์›๊ฒฉ ์ €์žฅ์†Œ์— ํ‘ธ์‹œ(Push)ํ•ฉ๋‹ˆ๋‹ค.(main ๋ธŒ๋žœ์น˜์— ํ‘ธ์‹œํ•˜์ง€ ์•Š๋„๋ก ๊ผญ ์ฃผ์˜ํ•˜์„ธ์š”, git push origin Y_FE_Toy1_Team13)
  5. ์ €์žฅ์†Œ์—์„œ main ๋ธŒ๋žœ์น˜๋ฅผ ๋Œ€์ƒ์œผ๋กœ Pull Request ์ƒ์„ฑํ•˜๋ฉด, ๊ณผ์ œ ์ œ์ถœ์ด ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค!(E.g, main <== Y_FE_Toy1_Team13)
  6. Pull Request ๋งํฌ๋ฅผ LMS๋กœ๋„ ์ œ์ถœํ•ด ์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  7. main ํ˜น์€ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์˜ ๋ธŒ๋žœ์น˜๋กœ ์ ˆ๋Œ€ ๋ณ‘ํ•ฉํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•˜์„ธ์š”!
  8. Pull Request์—์„œ ๋ณด์ด๋Š” ์„ค๋ช…์„ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋„๋ก ๊ผผ๊ผผํ•˜๊ฒŒ ์ž‘์„ฑํ•˜์„ธ์š”!
  9. Pull Request์—์„œ ๊ณผ์ œ ์ œ์ถœ ํ›„ ์ ˆ๋Œ€ ๋ณ‘ํ•ฉ(Merge)ํ•˜์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•˜์„ธ์š”!
  10. ๊ณผ์ œ ์ˆ˜ํ–‰ ๋ฐ ์ œ์ถœ ๊ณผ์ •์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ, ๋ฐ”๋กœ ๋‹ด๋‹น ๋ฉ˜ํ† ๋‚˜ ๊ฐ•์‚ฌ๋‹˜๊ป˜ ์–˜๊ธฐํ•˜์„ธ์š”!

[ํ•„์ˆ˜ ๊ตฌํ˜„์‚ฌํ•ญ]

  • ๋ฌธ์„œํŽธ์ง‘, revision ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜์—ฌ ์—…๋ฌด์ผ์ง€๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ์ง์›๋“ค์„ ์œ„ํ•œ ์œ„ํ‚ค์‚ฌ์ดํŠธ ๊ตฌํ˜„(๋งˆํฌ๋‹ค์šด ํ˜•์‹)
  • firebase database (Firestore) ์ด์šฉ
  • ๋ชจ๋‹ฌ์„ ํ™œ์šฉํ•œ ๊ทผ๋ฌด ์‹œ๊ฐ„์„ ํ‘œ์‹œํ•˜๋Š” ์‹œ๊ณ„ ๋ฐ ํƒ€์ด๋จธ ์ฐฝ ๊ตฌํ˜„
  • ์บ๋Ÿฌ์…€์„ ํ™œ์šฉํ•œ ํšŒ์‚ฌ ๊ณต์ง€ ํŽ˜์ด์ง€
  • ๊ฐค๋Ÿฌ๋ฆฌ ํŽ˜์ด์ง€ / ์—…๋ฌด์ผ์ง€ ํŽ˜์ด์ง€ ๋“ฑ ๋ฉ”๋‰ด๋ฅผ ํ•„ํ„ฐ๋ง ๋˜๋Š” ์นดํ…Œ๊ณ ๋ฆฌํ™” ํ•˜๋Š” ์„ ํƒ๋ฐ” ๊ตฌํ˜„
  • netlify ๋“ฑ์„ ์ด์šฉํ•œ ์ •์  ํŽ˜์ด์ง€ ๋ฐฐํฌ
  • TypeScript ์‚ฌ์šฉ ํ•„์ˆ˜
  • ๊ณผ์ œ์— ๋Œ€ํ•œ ์„ค๋ช…์„ ํฌํ•จํ•œย README.mdย ํŒŒ์ผ ์ž‘์„ฑ
    • ํŒ€์›๋ณ„๋กœ ๊ตฌํ˜„ํ•œ ๋ถ€๋ถ„ ์†Œ๊ฐœ

[์„ ํƒ ๊ตฌํ˜„์‚ฌํ•ญ]

  • React ์‚ฌ์šฉ์€ ์„ ํƒ
  • ๊ธฐํƒ€ ๋™์ž‘์ด ์™„๋ฃŒ๋˜๊ธฐ ์ „์— ๋กœ๋”ฉ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ตฌํ˜„
  • ํŽ˜์ด์ง€๋„ค์ด์…˜
  • ๊ด€๋ จ๋œ ๊ธฐํƒ€ ๊ธฐ๋Šฅ๋„ ๊ณ ๋ ค
  • eslint ์„ค์ •, ์ปค๋ฐ‹์ปจ๋ฒค์…˜, ๋ฌธ์„œํ™” ๋“ฑ ํŒ€ํ”„๋กœ์ ํŠธ์‹œ ํ•„์š”ํ•œ ์ถ”๊ฐ€ ์ž‘์—…๋“ค

๊ฐ€์ด๋“œ

์•„๋ž˜ ์˜ˆ์‹œ๋Š” ๋ชจ๋‘ ํ•˜๋‚˜์˜ ์˜๊ฒฌ์ž…๋‹ˆ๋‹ค!

๋”ฐ๋ผํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ์ž์‹ ๋งŒ์˜ ๊ฒฐ๊ณผ๋ฌผ์„ ๋งŒ๋“ค์–ด๋ณด์„ธ์š”.

๊ณต์ง€์‚ฌํ•ญ

[์˜์ƒ 1]

๋ชจ๋‹ฌ ํƒ€์ด๋จธ

[์˜์ƒ 2]

2.mov

๋งˆํฌ๋‹ค์šด ์œ„ํ‚ค์‚ฌ์ดํŠธ

[์˜์ƒ 3]

3.mov

๊ฐค๋Ÿฌ๋ฆฌ

[์˜์ƒ 4]


[Firestore]

Firestore์— ๋Œ€ํ•œ ๊ฐ€์ด๋“œ์ž…๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€ ๋ฅผ ์ฐพ์•„๋ณด๊ธธ ์ ๊ทน ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค!

App init

import { getFirestore } from "firebase/firestore";

export const db = getFirestore(fireBaseApp);

Firestore ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ํ•˜๊ธฐ

Firestore์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ํฌ๊ฒŒ ๋‘๊ฐ€์ง€์ด๋‹ค.

  1. Firebase console์—์„œ ์†์ˆ˜ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ
  2. ์ฝ”๋“œ๋กœ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ํ•˜๊ธฐ

1. Firebase console์—์„œ ์†์ˆ˜ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ

  1. Firebase console์— ์ ‘์†ํ•œ๋‹ค.
  2. ์ž์‹ ์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์„ ํƒํ•œ๋‹ค.
  3. ์™ผ์ชฝ ๋ฉ”๋‰ด์—์„œย Firestore Database๋ฅผ ์„ ํƒํ•œ๋‹ค.
  4. + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ปฌ๋ ‰์…˜ > ๋ฌธ์„œ๋ฅผ ๋งˆ์Œ๋Œ€๋กœ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค.
  5. ํ•„๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ๋ฌธ์„œ์— ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์–ด์ค€๋‹ค.

2. ์ฝ”๋“œ๋กœ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ํ•˜๊ธฐ

Firestore๋Š”ย setDoc,ย addDocย ๋‘ ๊ฐ€์ง€ ํ•จ์ˆ˜๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด์ œ ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด์ž.

1.ย addDoc

addDoc์€ ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•˜์—ฌ ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

import { addDoc, collection } from "firebase/firestore";

const writtenDoc = await addDoc(collection(db, "wiki"), {
  title: "LGH",
  description: "ํ—ˆ๋จผ๋ฐ€๋Ÿฌ...์‚ฌ๊ณ ์‹ถ๋‹ค...",
});

console.log("Document written with ID: ", writtenDoc.id);
// ์ƒˆ๋กœ ์ƒ์„ฑ๋œ Document์˜ ID๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•ด์„  ๋จผ์ € ์›ํ•˜๋Š” collection์„ ์„ ํƒํ•ด์•ผ ํ•œ๋‹ค. ์œ„ ์˜ˆ์ œ์˜ย addDocย ์•ˆ์—์„œ ์‚ฌ์šฉํ•œย collectionย ํ•จ์ˆ˜๋Š” db์ƒ์— ์žˆ๋Š” collection์„ ์„ ํƒํ•˜๊ฑฐ๋‚˜ ์—†์„ ๊ฒฝ์šฐ ์ƒˆ๋กœ์šด collection์„ ์ƒ์„ฑํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

Firebase์˜ Doc๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ID๋ฅผ ๊ฐ€์ ธ์•ผ ํ•˜๋Š”๋ฐ, addDoc์„ ์‚ฌ์šฉํ•˜๋ฉด ID๋ฅผ ์ž๋™์œผ๋กœ ๋งŒ๋“ ๋‹ค. ๋˜ํ•œ, ์ด๋ฏธ ์กด์žฌํ•˜๋Š” Doc์—ย addDoc์„ ์‚ฌ์šฉํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

2.ย setDoc

setDoc์€ ์•„๋ž˜์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•˜์—ฌ ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

import { setDoc, doc } from "firebase/firestore";

await setDoc(doc(db, "wiki", "new-id"), {
  title: "LGH",
  description: "ํ—ˆ๋จผ๋ฐ€๋Ÿฌ...์‚ฌ๊ณ ์‹ถ๋‹ค...",
});

addDoc๊ณผ์˜ ์ฐจ์ด์ ์€

  1. idย ๋ฅผ ์ง€์ •ํ•ด์ค˜์•ผํ•จ
  2. collectionย ๋Œ€์‹ ย doc์„ ์‚ฌ์šฉํ•จ
  3. ์ด๋ฏธ ์กด์žฌํ•˜๋Š” Doc์— ์‚ฌ์šฉ๊ฐ€๋Šฅ

3๊ฐ€์ง€ ์ด๋‹ค.

setDoc์€ย addDoc๊ณผ ๋‹ฌ๋ฆฌ collection์ด ์•„๋‹ˆ๋ผ doc๋ฅผ ์„ ํƒํ•ด์•ผ ํ•œ๋‹ค. ์ด๋Š”ย setDoc์ด ๋ฐ์ดํ„ฐ์˜ ์ถ”๊ฐ€ ๋ฟ ์•„๋‹ˆ๋ผ ๋ฐ์ดํ„ฐ ๋ฎ์–ด์“ฐ๊ธฐ ๊ธฐ๋Šฅ๋„ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๋Ÿฌํ”„ํ•˜๊ฒŒ ์ƒ๊ฐํ•ด๋ณด๋ฉดย setDoc์€ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•  ๋•Œ

  1. doc์„ ์„ ํƒํ•˜๊ฑฐ๋‚˜ ์ƒˆ๋กœ์šด doc์„ ์ƒ์„ฑ
  2. doc์˜ ๋‚ด์šฉ์„ ๋ฎ์–ด์”€

์˜ ๋ฐฉ์‹์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

Doc์„ ์„ ํƒํ•˜๋Š” ๋ฐฉ๋ฒ•์€ย docย ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด๋‹ค.ย [doc()](https://firebase.google.com/docs/reference/js/firestore_.md?hl=ko#doc)ย ํ•จ์ˆ˜๋Š”ย DocumentReferenceย instance๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์›ํ•˜๋Š” Document๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. ์œ„์—์„œ ๋งŒ๋“ค์–ด๋‘”ย wiki > completedย ๋ฌธ์„œ๋Š” ์•„๋ž˜์ฒ˜๋Ÿผ ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ๋‹ค.

import { doc } from "firebase/firestore";

const docRef = doc(db, "wiki", "completed");

docย ํ•จ์ˆ˜์˜ 3๋ฒˆ์งธ ์ธ์ž๊ฐ€ ๋ฐ”๋กœย idย ์ด๋‹ค. id๋Š” ์ด๋ฏธ ์กด์žฌํ•˜๋Š” Doc์˜ id๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๊ณ , ์ƒˆ๋กœ์šด id๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋‹ค. ์กด์žฌํ•˜๋Š” id๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ํ•ด๋‹น Doc์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฎ์–ด์“ฐ๊ฒŒ ๋œ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ์—” ์ƒˆ๋กœ์šด Doc๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

์–ด์จŒ๊ฑฐ๋‚˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ด๋‹ค.

Firestore ๋ฐ์ดํ„ฐ ์ˆ˜์ •ํ•˜๊ธฐ

Firestore์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ํฌ๊ฒŒ ๋‘๊ฐ€์ง€์ด๋‹ค.

  1. Firebase console์—์„œ ์†์ˆ˜ ๋ฐ์ดํ„ฐ ์ˆ˜์ •ํ•ด์ฃผ๊ธฐ
  2. ์ฝ”๋“œ๋กœ ๋ฐ์ดํ„ฐ ์ˆ˜์ •ํ•˜๊ธฐ

1๋ฒˆ์€ ๋ฐ์ดํ„ฐ ์ƒ์„ฑ๊ณผ ๋น„์Šทํ•˜๊ฒŒ ์ง„ํ–‰ํ•˜๋ฉด ๋œ๋‹ค.

2. ์ฝ”๋“œ๋กœ ๋ฐ์ดํ„ฐ ์ˆ˜์ •ํ•˜๊ธฐ

Firestore๋Š”ย setDoc,ย updateย ๋‘ ๊ฐ€์ง€ ํ•จ์ˆ˜๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

setDoc์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์œ„์— ์ ํ˜€์žˆ๋‹ค.

update

setDoc์€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฎ์–ด์“ด๋‹ค. ๋”ฐ๋ผ์„œ ๊ธฐ์กด์˜ ๋ฌธ์„œ๋ฅผ ์œ ์ง€ํ•œ ์ฑ„ ์ผ๋ถ€๋ถ„์˜ ๋ฐ์ดํ„ฐ๋งŒ ๋ณ€๊ฒฝํ•˜๊ณ  ์‹ถ์–ด๋„ ์ด์ „์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ชจ๋‘ ์ƒˆ๋กœ ์ž…๋ ฅํ•ด์•ผ ํ•œ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ย update๋Š” ๊ธฐ์กด์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์œ ์ง€ํ•œ ์ฑ„ ์ผ๋ถ€๋ถ„์˜ ๋ฐ์ดํ„ฐ๋งŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

import { updateDoc, doc } from "firebase/firestore";

await updateDoc(doc(db, "wiki", "new-id"), {
  description: "ํ—ˆ๋จผ๋ฐ€๋Ÿฌ...200๋งŒ์›...",
});

์œ„์™€ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋ฉดย new-id๋ผ๋Š” id๋ฅผ ๊ฐ€์ง„ ๋ฌธ์„œ์˜ description๋งŒ ๋ณ€๊ฒฝ๋œ๋‹ค.


*์ฐธ๊ณ  ๋งํฌ

About

Employee wiki web application developed during Yanolja boot camp's toy1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published