Skip to content

๐ŸŒŸ ๊ฒฝํฌ๋Œ€ํ•™๊ต ์ปค๋ฎค๋‹ˆํ‹ฐ ์ฟ ๋ฎค์˜ ์ค‘์‹ฌ์ ์ธ RESTful API ์„œ๋ฒ„

Notifications You must be signed in to change notification settings

khu-dev/khumu-command-center

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

KHUMU

Django REST Framework์„ ๋ฐ”ํƒ•์œผ๋กœํ•œ ์ฟ ๋ฎค์˜ ์ปค๋ฎค๋‹ˆํ‹ฐ ์œ„์ฃผ์˜ RESTful API ์„œ๋ฒ„์ž…๋‹ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์•„ํ‚คํ…์ณ์˜ ์ฟ ๋ฎค์—์„œ ํŠน์ดํ•˜๊ฒŒ ์ปค๋ฎค๋‹ˆํ‹ฐ ๋„๋ฉ”์ธ ์™ธ์˜๋„ ์ธ์ฆ์ด๋‚˜ ํ•™์‚ฌ์ผ์ • ์ œ๊ณต ๋“ฑ ๊ฒฝํฌ๋Œ€ํ•™๊ต ๊ด€๋ จ ๋ช‡ ๊ฐ€์ง€ ๊ธฐ๋Šฅ๋“ค์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

API Documentation

API Documentation - POSTMan์˜ ๋ฌธ์„œํ™” ๊ธฐ๋Šฅ์„ ์ด์šฉํ•ด ์ฟ ๋ฎค์˜ ์ „์ฒด API๋“ค์„ ๋ฌธ์„œํ™”ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

ํŠน์ง• ๋ฐ ๋™์ž‘ ๋ฐฉ์‹

  • ์ปค๋ฎค๋‹ˆํ‹ฐ ๋„๋ฉ”์ธ ์œ„์ฃผ์˜ RESTful API๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

    • ์ผ๋ฐ˜ ๊ฒŒ์‹œํŒ CRUD
    • ์ผ๋ฐ˜ ๊ฒŒ์‹œ๊ธ€ CRUD
    • ์Šคํ„ฐ๋””๋ฅ˜ ๊ฒŒ์‹œํŒ CRUD
    • ์Šคํ„ฐ๋””๋ฅ˜ ๊ฒŒ์‹œ๊ธ€ CRUD
    • ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ
    • ํ•™์‚ฌ์ผ์ • ์กฐํšŒ
  • ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ๊ฐ„์—๋Š” ๋ฉ”์‹œ์ง€ ํ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋น„๋™๊ธฐ์ ์œผ๋กœ ์ž‘์—…ํ•˜๋ฉฐ ๋Š์Šจํ•˜๊ฒŒ ๊ฒฐํ•ฉ(Loosely coupled)ํ•ฉ๋‹ˆ๋‹ค.

    ์˜ˆ๋ฅผ ๋“ค์–ด ๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ์‹œ SNS๋กœ ์ž‘์„ฑ ์ด๋ฒคํŠธ๋ฅผ Publishํ•ฉ๋‹ˆ๋‹ค.

    1. ๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ›„ Article Model instance๋ฅผ JSON์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค. (DRF Serializer๋กœ ์ง๋ ฌํ™”ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๋‹จ์ˆœ ์ง๋ ฌํ™”)
    2. JSON ๋ฐ์ดํ„ฐ๋ฅผ SNS์— Publish ํ•ฉ๋‹ˆ๋‹ค.
    3. SNS์—์„œ ๊ตฌ๋… ์กฐ๊ฑด๊ณผ ์ •๋ณด๋ฅผ ์ด์šฉํ•ด ์˜ฌ๋ฐ”๋ฅธ SQS์—๊ฒŒ ์ด๋ฒคํŠธ๋ฅผ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค.
    4. ์˜ฌ๋ฐ”๋ฅธ SQS ๊ตฌ๋…์ž(consumer)๊ฐ€ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›์•„ ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
      • ์˜ˆ๋ฅผ ๋“ค์–ด ์ฟ ๋ฎค์˜ ์•Œ๋ฆผ ์„œ๋น„์Šค์ธ alimi๋Š” ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์•„ Author๊ฐ€ ๊ฒŒ์‹œ๊ธ€์— ๋Œ€ํ•œ ๋Œ“๊ธ€ ์ƒ์„ฑ๊ณผ ๊ฐ™์€ ์ถ”๊ฐ€์ ์ธ ์•Œ๋ฆผ๋“ค์„ ๋ฐ›์•„๋ณผ ์ˆ˜ ์žˆ๋„๋ก ํ•ด๋‹น ๊ฒŒ์‹œ๊ธ€์„ ๊ตฌ๋…์‹œํ‚ต๋‹ˆ๋‹ค.

๊ฐœ๋ฐœ ํŒ

  • pip dependency

    $ pip freeze > requirements.txt
    # requirements.txt ์ž‘์„ฑ ํ›„ pkg-resources==0.0.0 line์„ ์ง€์›Œ์ค˜์•ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • mysqlclient dependency - MySQL์„ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ํ•„์š”ํ•œ ubuntu์˜ ํŒจํ‚ค์ง€๋“ค ์ž…๋‹ˆ๋‹ค.

    • sudo apt-get install python3-dev
    • sudo apt-get install libmysqlclient-dev
      • ์ผ๋ฐ˜ ubuntu์—์„œ๋Š” libmysqlclient-dev, python ubuntu container์—์„œ๋Š” default-libmysqlclient-dev(?). ์•„๋งˆ ํ›„์ž๋กœ๋งŒ ํ•ด๋„ ๋  ๊ฒƒ์œผ๋กœ ์ถ”์ธกํ•ฉ๋‹ˆ๋‹ค.
    • pip install mysqlclient
    • pip install wheel
  • ๋‹ค์–‘ํ•œ ํ™˜๊ฒฝ์— ๋”ฐ๋ฅธ config ์ ์šฉํ•˜๊ธฐ

    • KHUMU_ENVIRONMENT ๊ฐ’์„ ํ†ตํ•ด ์ด์šฉํ•  ํ™˜๊ฒฝ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (LOCAL | DEV, default๋Š” LOCAL)
    • KHUMU_ENVIRONMENT ์˜ ๊ฐ’์— ๋”ฐ๋ผconfig/local.yaml ํ˜น์€ config/dev.yaml ๋“ฑ์˜ ์„ค์ • ํŒŒ์ผ์„ ํ†ตํ•ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์„ค์ •์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. settings.py ์—์„œ ๊ฐ์ข… ํ™˜๊ฒฝ์— ๋งž๋Š” ์„ค์ •์„ ๋™์ ์œผ๋กœ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

chrome driver์„ ์„ค์น˜ํ•˜์‹ญ์‹œ์˜ค

โš ๏ธ ์ธํฌ 21 ์ธ์ฆ์„ ๋น„๋กฏํ•œ ์ธํฌ 21๊ณผ ๊ด€๋ จ๋œ ์ž‘์—…์€ Selenium๊ณผ chrome driver๋ฅผ ์‚ฌ์šฉ ํ•ฉ๋‹ˆ๋‹ค. chrome driver๋Š” project root์— ์œ„์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

โ€‹ ์ด๋Š” ์šฐ๋ฆฌ๊ฐ€ ๊ฐœ๋ฐœํ•˜๋Š” "์ฝ”๋“œ"๊ฐ€ ์•„๋‹Œ "์‹คํ–‰ ํŒŒ์ผ"์ด๊ธฐ์— Git์—๋Š” ํฌํ•จํ•˜๊ณ  ์žˆ์ง€ ์•Š์œผ๋‹ˆ ๋กœ์ปฌ ๊ฐœ๋ฐœ ์‹œ์—๋‚˜ ๋ฐฐํฌ ์‹œ์—๋Š” chrome driver์„ project root์— ์œ„์น˜์‹œ์ผœ์•ผ ํ•จ์„ ์ฃผ์˜ํ•ด์ฃผ์„ธ์š”.

curl https://chromedriver.storage.googleapis.com/89.0.4389.23/chromedriver_linux64.zip -o chromedriver.zip && unzip chromedriver.zip

Entities

์ž‘์—… ์˜ˆ์ •...

Article

์ปค๋ฎค๋‹ˆํ‹ฐ ๊ฒŒ์‹œํŒ์˜ ๊ฒŒ์‹œ๋ฌผ

LikeArticle

๊ฒŒ์‹œ๋ฌผ์— ๋Œ€ํ•œ ์ข‹์•„์š”

BookmarkArticle

๊ฒŒ์‹œ๋ฌผ์— ๋Œ€ํ•œ ๋ถ๋งˆํฌ

Board

community tab์— ์กด์žฌํ•˜๋Š” ๊ฒŒ์‹œํŒ๋“ค.

image-20210516155058970

  • category - ํ•˜๋‹จ์˜ (official | department | lecture | free)

(์˜ˆ์ •) StudyBoard

Board๋ฅผ ์ƒ์†

  • category - (lecture | civil(๊ณต๋ฌด์›) | certificate(์ž๊ฒฉ์ฆ) | career(์ทจ์ค€))

(์˜ˆ์ •) AnnouncementBoard

Board๋ฅผ ์ƒ์†

category - (university | khumu(์ฟ ๋ฎค์˜ ๊ณต์ง€์‚ฌํ•ญ - ํ•„์š”ํ• ๊นŒ? ใ…‹ใ…‹ใ…‹ ๊ทธ๋ƒฅ ์–ด๋”” ๋”ฐ๋กœ ๋„์šฐ๋Š” ๊ฒŒ ๋‚ซ์ง€ ์•Š์œผ๋ ค๋‚˜) | council(ํ•™์ƒํšŒ))

FollowBoard

๊ฒŒ์‹œํŒ์— ๋Œ€ํ•œ Follow

(์˜ˆ์ •) StudyBoard์™€ AnnouncementBoard ์— ๋Œ€ํ•œ Follow๋„ ์ง€์›

Comment

khumu-comment์—์„œ ๊ด€๋ฆฌ

Campus

๊ตญ์ œ์บ ํผ์Šค, ์„œ์šธ์บ ํผ์Šค์— ๋Œ€ํ•œ ์ •๋ณด. MVP์—์„œ๋Š” ๊ตญ์ œ์บ ํผ์Šค๋งŒ ๋‹ค๋ฃจ๊ธฐ ๋•Œ๋ฌธ์— ์„œ์šธ ์บ ํผ์Šค๋Š” ์•„์ง ๋ฏธ์ง€์›

Organization

๊ฒฝํฌ๋Œ€ํ•™๊ต์˜ ๋‹จ๊ณผ๋Œ€(์‚ฌ์‹ค ์™„๋ฒฝํžˆ ๋‹จ๊ณผ๋Œ€๋Š” ์•„๋‹ˆ๊ณ  ์ˆ˜๊ฐ•์‹ ์ฒญํ•  ๋•Œ ์ฃผ๋กœ ์šฐ๋ฆฌ๊ฐ€ ์„ ํƒํ•˜๋Š” ๋‹จ์œ„์ž„)

Department

๊ฒฝํฌ๋Œ€ํ•™๊ต์˜ ํ•™๊ณผ ๋ฐ์ดํ„ฐ

LectureSuite

๊ฒฝํฌ๋Œ€ํ•™๊ต์˜ ๊ฐ•์˜ (e.g. ๋ฏธ์ ๋ถ„ ๊ฐ•์˜)

๋™์ผํ•œ ๊ฐ•์˜๋ฅผ ๋ฌถ์–ด ๊ณตํ†ต์ ์ธ ๋‚ด์šฉ์„ ์œ„์ฃผ๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ฐ•์˜(๊ตฐ)

Lecture

๊ฒฝํฌ๋Œ€ํ•™๊ต์˜ ๊ฐœ๋ณ„ ๊ฐ•์˜ (e.g. ๋ฏธ์ ๋ถ„ ์›” ์ˆ˜ ๊น€OO๊ต์ˆ˜๋‹˜ ๊ฐ•์˜, ๋ฏธ์ ๋ถ„ ์›” ์ˆ˜ ๋ฐ•OO ๊ต์ˆ˜๋‹˜ ๊ฐ•์˜, ๋ฏธ์ ๋ถ„ ํ™”๋ชฉ ์ดOO ๊ต์ˆ˜๋‹˜ ๊ฐ•์˜)

๊ฐœ๋ณ„ ๊ฐ•์˜ ์ž์ฒด์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ

Notification

์•Œ๋ฆผํƒญ์— ๋‚˜์˜ค๋Š” ์•Œ๋ฆผ ๋‚ด์šฉ

  • is_read - ํ˜„์žฌ ์•Œ๋ฆผ์„ ์ฝ์—ˆ๋Š”์ง€. GET API๋ฅผ ์ด์šฉํ•ด ์ฝ์œผ๋ฉด ๋ฐ”๋กœ is_read๋Š” true๊ฐ€ ๋œ๋‹ค.

ArticleNotificationSubscription

  • is_activated - ๊ตฌ๋…์ด ํ™œ์„ฑํ™”๋˜์–ด์žˆ๋Š”์ง€.
    • ๋Œ“๊ธ€์„ ๋‹ฌ๊ฑฐ๋‚˜ ๊ธ€์„ ์ƒ์„ฑํ•˜๋ฉด ๊ตฌ๋…์ด ํ™œ์„ฑํ™”๋œ ArticleNotificationSubscription์ด ๊ฐ€ ์ƒ์„ฑ๋จ.
    • ์ดํ›„ Unsubscribeํ•˜๋ฉด is_activated๋Š” false๊ฐ€ ๋œ๋‹ค. ํ•œ ๋ฒˆ ๊ตฌ๋…์„ ๋น„ํ™œ์„ฑํ™” ์‹œ์ผฐ๋Š”๋ฐ ๋Œ“๊ธ€์„ ๋‹ฌ ๋•Œ๋งˆ๋‹ค ํ™œ์„ฑํ™”๋˜๋Š” ๊ฒฝ์šฐ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•จ.

PushSubscription

KhumuUser์˜ push device token์„ ์ €์žฅํ•จ. ํ•œ KhumuUser๋„ ์—ฌ๋Ÿฌ device token์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Œ.

Jobs

์ธํฌ 21 ๊ด€๋ จ ์ž‘์—… ํ˜น์€ ์ข…์ข… RESTfulํ•œ ์š”์ฒญ์ด ์•„๋‹Œ CLI๋กœ ์ธํ•ด trigger๋˜๋Š” ๋ช‡ ๊ฐ€์ง€ ๋™์ž‘๋“ค์„ **"Job"**์ด๋ผ๋Š” ๊ฐœ๋…์œผ๋กœ ์ •์˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

(์•„์ง ์—๋Ÿฌ ํ•ธ๋“ค๋ง๊ณผ ์ •ํ™•ํ•œ ๋กœ๊ทธ ์ถœ๋ ฅ์ด ๋ฏธํกํ•˜๊ณ , ๊ด€๋ฆฌ๊ฐ€ ํž˜๋“ค์–ด ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค๋กœ ๋บ„ ์ƒ๊ฐ๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ํŠนํžˆ๋‚˜ ์กธ์—…์ƒ, ํœดํ•™์ƒ, ๋ถ€์ „๊ณต, ๋ณต์ˆ˜์ „๊ณต์ƒ๋“ค์— ๋Œ€ํ•œ ์ผ€์ด์Šค๋Š” ๋Œ€๋น„๊ฐ€ ํž˜๋“  ์ƒํ™ฉ์ž…๋‹ˆ๋‹ค... ํ˜น์‹œ๋ผ๋„ ๋„์™€์ฃผ์‹ค ํ•™์šฐ๋ถ„๋“ค ๊ณ„์‹œ๋ฉด ๋ง์”€ํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!!!)

  • KhuAuthJob - ์ธํฌ21์— ์ธ์ฆํ•˜๋Š” ์ž‘์—…
  • KhuLectureCollectorJob - ์ธํฌ21์— ์ธ์ฆ ํ›„ ์กด์žฌํ•˜๋Š” ๊ฐ•์˜ ์ •๋ณด๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ์ž‘์—…
  • KhuLectureSyncJob - ์ธํฌ21์— ์ธ์ฆ ํ›„ ํ•ด๋‹น ๊ณ„์ •์ด ์ˆ˜๊ฐ• ์ค‘์ธ ๊ฐ•์˜์™€ ํ•™๊ณผ์˜ ๊ฒŒ์‹œํŒ์„ Followํ•˜๋Š” ์ž‘์—…
  • StudentQrCodeJob - ์ €์žฅ๋œ ํ•™๋ฒˆ์„ ์ด์šฉํ•ด QrCode๋ฅผ ์–ป์–ด์˜ค๋Š” ์ž‘์—…
  • MigrateHaksaScheduleJob - ํ•™์‚ฌ์ผ์ • csv ํŒŒ์ผ์„ database์— migrateํ•˜๋Š” ์ž‘์—….

About

๐ŸŒŸ ๊ฒฝํฌ๋Œ€ํ•™๊ต ์ปค๋ฎค๋‹ˆํ‹ฐ ์ฟ ๋ฎค์˜ ์ค‘์‹ฌ์ ์ธ RESTful API ์„œ๋ฒ„

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages