Skip to content

Latest commit

Β 

History

History
549 lines (435 loc) Β· 16.9 KB

File metadata and controls

549 lines (435 loc) Β· 16.9 KB

μ•Œλ¦Ό API

μ•Œλ¦Ό(Notification) 및 μ•Œλ¦Ό μ„€μ •(NotificationSetting) APIμž…λ‹ˆλ‹€. μ•Œλ¦Όμ˜ 생성, 쑰회, 확인(읽음), μ‚­μ œμ™€ μ•Œλ¦Ό μœ ν˜•λ³„ μˆ˜μ‹  섀정을 κ΄€λ¦¬ν•©λ‹ˆλ‹€.

라우트 파일: backend/src/routes/notifications.js 컨트둀러 파일: backend/src/controllers/notifications.js λͺ¨λΈ 파일: backend/src/models/Notification.js, backend/src/models/NotificationSetting.js


μ—”λ“œν¬μΈνŠΈ μš”μ•½

λ©”μ„œλ“œ 경둜 μ„€λͺ… κΆŒν•œ
POST /api/notifications μ•Œλ¦Ό 생성 isLoggedIn (admin|manager λ˜λŠ” ν™œμ„± 등둝이 μžˆλŠ” teacher)
GET /api/notifications μ•Œλ¦Ό λͺ©λ‘ 쑰회 isLoggedIn
GET /api/notifications/:_id μ•Œλ¦Ό 상세 쑰회 isLoggedIn (본인 μ†Œμœ )
PUT /api/notifications/:_id/check μ•Œλ¦Ό 확인 isLoggedIn (본인 μ†Œμœ )
DELETE /api/notifications/:_id μ•Œλ¦Ό μ‚­μ œ isLoggedIn (본인 μ†Œμœ )
PUT /api/notifications/bulk-check μ•Œλ¦Ό 일괄 확인 isLoggedIn
GET /api/notifications/settings μ•Œλ¦Ό μ„€μ • 쑰회 isLoggedIn
PUT /api/notifications/settings μ•Œλ¦Ό μ„€μ • μˆ˜μ • isLoggedIn
GET /api/notifications/push/vapid-public-key Web Push VAPID κ³΅κ°œν‚€ isLoggedIn
POST /api/notifications/push/subscribe Web Push ꡬ독 등둝 isLoggedIn
DELETE /api/notifications/push/subscribe Web Push ꡬ독 ν•΄μ œ isLoggedIn
POST /api/notifications/push/test Web Push ν…ŒμŠ€νŠΈ λ°œμ†‘ isLoggedIn

μ•Œλ¦Ό 생성

μ•Œλ¦Όμ„ μƒμ„±ν•˜μ—¬ μ§€μ •λœ μ‚¬μš©μžλ“€μ—κ²Œ λ°œμ†‘ν•©λ‹ˆλ‹€. μˆ˜μ‹ μžλ³„λ‘œ received νƒ€μž… μ•Œλ¦Όμ΄, λ°œμ‹ μžμ—κ²ŒλŠ” sent νƒ€μž… μ•Œλ¦Όμ΄ μƒμ„±λ©λ‹ˆλ‹€. 생성 ν›„ Socket.ioλ₯Ό 톡해 μˆ˜μ‹ μžμ—κ²Œ μ‹€μ‹œκ°„ μ•Œλ¦Ό 이벀트(listen)κ°€ μ „μ†‘λ©λ‹ˆλ‹€.

POST /api/notifications

κΆŒν•œ: isLoggedIn - admin λ˜λŠ” managerλŠ” 항상 ν—ˆμš©, κ·Έ μ™Έ μ‚¬μš©μžλŠ” ν™œμ„±ν™”λœ teacher 등둝이 μžˆμ–΄μ•Ό 함

μš”μ²­ λ³Έλ¬Έ

ν•„λ“œ νƒ€μž… ν•„μˆ˜ μ„€λͺ…
toUserList object[] O μˆ˜μ‹ μž λͺ©λ‘
toUserList[].user string O μˆ˜μ‹ μž ObjectId
toUserList[].userId string O μˆ˜μ‹ μž μ‚¬μš©μž ID
toUserList[].userName string O μˆ˜μ‹ μž 이름
title string O μ•Œλ¦Ό 제λͺ©
description string O μ•Œλ¦Ό λ‚΄μš©
category string X μ•Œλ¦Ό μΉ΄ν…Œκ³ λ¦¬

μš”μ²­ μ˜ˆμ‹œ

{
  "toUserList": [
    {
      "user": "507f1f77bcf86cd799439011",
      "userId": "student01",
      "userName": "홍길동"
    },
    {
      "user": "507f1f77bcf86cd799439012",
      "userId": "student02",
      "userName": "κΉ€μ² μˆ˜"
    }
  ],
  "title": "μˆ˜μ—… μ•ˆλ‚΄",
  "description": "내일 μ˜€ν›„ 3μ‹œμ— 보좩 μˆ˜μ—…μ΄ μžˆμŠ΅λ‹ˆλ‹€.",
  "category": "μˆ˜μ—…"
}

응닡 (200)

{
  "notifications": [
    {
      "_id": "507f1f77bcf86cd799439101",
      "type": "received",
      "user": "507f1f77bcf86cd799439011",
      "userId": "student01",
      "userName": "홍길동",
      "fromUser": "507f1f77bcf86cd799439099",
      "fromUserId": "teacher01",
      "fromUserName": "박선생",
      "checked": false,
      "category": "μˆ˜μ—…",
      "title": "μˆ˜μ—… μ•ˆλ‚΄",
      "description": "내일 μ˜€ν›„ 3μ‹œμ— 보좩 μˆ˜μ—…μ΄ μžˆμŠ΅λ‹ˆλ‹€.",
      "notificationType": "direct",
      "autoDeleteOnCheck": true,
      "date": "2024-03-15T09:00:00.000Z",
      "createdAt": "2024-03-15T09:00:00.000Z",
      "updatedAt": "2024-03-15T09:00:00.000Z"
    },
    {
      "_id": "507f1f77bcf86cd799439102",
      "type": "received",
      "user": "507f1f77bcf86cd799439012",
      "userId": "student02",
      "userName": "κΉ€μ² μˆ˜",
      "fromUser": "507f1f77bcf86cd799439099",
      "fromUserId": "teacher01",
      "fromUserName": "박선생",
      "checked": false,
      "category": "μˆ˜μ—…",
      "title": "μˆ˜μ—… μ•ˆλ‚΄",
      "description": "내일 μ˜€ν›„ 3μ‹œμ— 보좩 μˆ˜μ—…μ΄ μžˆμŠ΅λ‹ˆλ‹€.",
      "notificationType": "direct",
      "autoDeleteOnCheck": true,
      "date": "2024-03-15T09:00:00.000Z",
      "createdAt": "2024-03-15T09:00:00.000Z",
      "updatedAt": "2024-03-15T09:00:00.000Z"
    },
    {
      "_id": "507f1f77bcf86cd799439103",
      "type": "sent",
      "user": "507f1f77bcf86cd799439099",
      "userId": "teacher01",
      "userName": "박선생",
      "toUserList": [
        {
          "user": "507f1f77bcf86cd799439011",
          "userId": "student01",
          "userName": "홍길동"
        },
        {
          "user": "507f1f77bcf86cd799439012",
          "userId": "student02",
          "userName": "κΉ€μ² μˆ˜"
        }
      ],
      "category": "μˆ˜μ—…",
      "title": "μˆ˜μ—… μ•ˆλ‚΄",
      "description": "내일 μ˜€ν›„ 3μ‹œμ— 보좩 μˆ˜μ—…μ΄ μžˆμŠ΅λ‹ˆλ‹€.",
      "notificationType": "direct",
      "autoDeleteOnCheck": true,
      "date": "2024-03-15T09:00:00.000Z",
      "createdAt": "2024-03-15T09:00:00.000Z",
      "updatedAt": "2024-03-15T09:00:00.000Z"
    }
  ]
}

μ—λŸ¬ 응닡

μƒνƒœ μ½”λ“œ λ©”μ‹œμ§€ μ„€λͺ…
400 FIELD_REQUIRED({ν•„λ“œλͺ…}) ν•„μˆ˜ ν•„λ“œ λˆ„λ½ (toUserList, title, description, user, userId, userName)
403 PERMISSION_DENIED admin/managerκ°€ μ•„λ‹ˆκ³  ν™œμ„± teacher 등둝이 μ—†λŠ” 경우

μ•Œλ¦Ό λͺ©λ‘ 쑰회

λ‘œκ·ΈμΈν•œ μ‚¬μš©μžμ˜ μ•Œλ¦Ό λͺ©λ‘μ„ μ‘°νšŒν•©λ‹ˆλ‹€. μ„±λŠ₯을 μœ„ν•΄ description ν•„λ“œλŠ” μ‘λ‹΅μ—μ„œ μ œμ™Έλ©λ‹ˆλ‹€.

GET /api/notifications

κΆŒν•œ: isLoggedIn

쿼리 νŒŒλΌλ―Έν„°

νŒŒλΌλ―Έν„° νƒ€μž… ν•„μˆ˜ μ„€λͺ…
type string O "received" (받은 μ•Œλ¦Ό) λ˜λŠ” "sent" (보낸 μ•Œλ¦Ό)
checked string X "true" λ˜λŠ” "false" - 확인 μ—¬λΆ€λ‘œ 필터링

응닡 (200)

{
  "notifications": [
    {
      "_id": "507f1f77bcf86cd799439101",
      "type": "received",
      "user": "507f1f77bcf86cd799439011",
      "userId": "student01",
      "userName": "홍길동",
      "fromUser": "507f1f77bcf86cd799439099",
      "fromUserId": "teacher01",
      "fromUserName": "박선생",
      "checked": false,
      "category": "μˆ˜μ—…",
      "title": "μˆ˜μ—… μ•ˆλ‚΄",
      "notificationType": "direct",
      "autoDeleteOnCheck": true,
      "date": "2024-03-15T09:00:00.000Z",
      "createdAt": "2024-03-15T09:00:00.000Z",
      "updatedAt": "2024-03-15T09:00:00.000Z"
    }
  ]
}

μ°Έκ³ : description ν•„λ“œλŠ” λͺ©λ‘ 쑰회 μ‹œ μ„±λŠ₯ μ΅œμ ν™”λ₯Ό μœ„ν•΄ μ œμ™Έλ©λ‹ˆλ‹€. 상세 λ‚΄μš©μ΄ ν•„μš”ν•˜λ©΄ κ°œλ³„ μ•Œλ¦Ό 상세 쑰회 APIλ₯Ό μ‚¬μš©ν•˜μ„Έμš”.

μ—λŸ¬ 응닡

μƒνƒœ μ½”λ“œ λ©”μ‹œμ§€ μ„€λͺ…
400 FIELD_REQUIRED(type) type 쿼리 νŒŒλΌλ―Έν„° λˆ„λ½

μ•Œλ¦Ό 상세 쑰회

μ•Œλ¦Όμ˜ 상세 정보λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€. description ν•„λ“œλ₯Ό ν¬ν•¨ν•œ 전체 데이터λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.

GET /api/notifications/:_id

κΆŒν•œ: isLoggedIn (본인 μ†Œμœ  μ•Œλ¦Όλ§Œ 쑰회 κ°€λŠ₯)

경둜 νŒŒλΌλ―Έν„°

νŒŒλΌλ―Έν„° νƒ€μž… μ„€λͺ…
_id string μ•Œλ¦Ό ObjectId

응닡 (200)

{
  "notification": {
    "_id": "507f1f77bcf86cd799439101",
    "type": "received",
    "user": "507f1f77bcf86cd799439011",
    "userId": "student01",
    "userName": "홍길동",
    "fromUser": "507f1f77bcf86cd799439099",
    "fromUserId": "teacher01",
    "fromUserName": "박선생",
    "checked": false,
    "category": "μˆ˜μ—…",
    "title": "μˆ˜μ—… μ•ˆλ‚΄",
    "description": "내일 μ˜€ν›„ 3μ‹œμ— 보좩 μˆ˜μ—…μ΄ μžˆμŠ΅λ‹ˆλ‹€.",
    "notificationType": "direct",
    "relatedEntity": {
      "type": "enrollment",
      "id": "507f1f77bcf86cd799439201"
    },
    "autoDeleteOnCheck": true,
    "date": "2024-03-15T09:00:00.000Z",
    "createdAt": "2024-03-15T09:00:00.000Z",
    "updatedAt": "2024-03-15T09:00:00.000Z"
  }
}

μ—λŸ¬ 응닡

μƒνƒœ μ½”λ“œ λ©”μ‹œμ§€ μ„€λͺ…
403 PERMISSION_DENIED 본인 μ†Œμœ κ°€ μ•„λ‹Œ μ•Œλ¦Ό 쑰회 μ‹œλ„
404 NOTIFICATION_NOT_FOUND μ•Œλ¦Όμ„ 찾을 수 μ—†μŒ

μ•Œλ¦Ό 확인

μ•Œλ¦Όμ„ 확인(읽음) μ²˜λ¦¬ν•©λ‹ˆλ‹€. autoDeleteOnCheckκ°€ true인 νœ˜λ°œμ„± μ•Œλ¦Όμ€ 확인 μ‹œ μžλ™μœΌλ‘œ μ‚­μ œλ˜λ©°, false인 μ•Œλ¦Όμ€ checkedκ°€ true둜 λ³€κ²½λ©λ‹ˆλ‹€.

PUT /api/notifications/:_id/check

κΆŒν•œ: isLoggedIn (본인 μ†Œμœ  μ•Œλ¦Όλ§Œ 확인 κ°€λŠ₯)

경둜 νŒŒλΌλ―Έν„°

νŒŒλΌλ―Έν„° νƒ€μž… μ„€λͺ…
_id string μ•Œλ¦Ό ObjectId

응닡 (200)

{}

μ—λŸ¬ 응닡

μƒνƒœ μ½”λ“œ λ©”μ‹œμ§€ μ„€λͺ…
403 PERMISSION_DENIED 본인 μ†Œμœ κ°€ μ•„λ‹Œ μ•Œλ¦Ό 확인 μ‹œλ„
404 NOTIFICATION_NOT_FOUND μ•Œλ¦Όμ„ 찾을 수 μ—†μŒ

μ•Œλ¦Ό μ‚­μ œ

μ•Œλ¦Όμ„ μ‚­μ œν•©λ‹ˆλ‹€.

DELETE /api/notifications/:_id

κΆŒν•œ: isLoggedIn (본인 μ†Œμœ  μ•Œλ¦Όλ§Œ μ‚­μ œ κ°€λŠ₯)

경둜 νŒŒλΌλ―Έν„°

νŒŒλΌλ―Έν„° νƒ€μž… μ„€λͺ…
_id string μ•Œλ¦Ό ObjectId

응닡 (200)

{}

μ—λŸ¬ 응닡

μƒνƒœ μ½”λ“œ λ©”μ‹œμ§€ μ„€λͺ…
403 PERMISSION_DENIED 본인 μ†Œμœ κ°€ μ•„λ‹Œ μ•Œλ¦Ό μ‚­μ œ μ‹œλ„
404 NOTIFICATION_NOT_FOUND μ•Œλ¦Όμ„ 찾을 수 μ—†μŒ

μ•Œλ¦Ό 일괄 확인

λ‘œκ·ΈμΈν•œ μ‚¬μš©μžμ˜ 미확인 μˆ˜μ‹  μ•Œλ¦Όμ„ 일괄 확인 μ²˜λ¦¬ν•©λ‹ˆλ‹€. autoDeleteOnCheckκ°€ true인 νœ˜λ°œμ„± μ•Œλ¦Όμ€ μ‚­μ œλ˜κ³ , λΉ„νœ˜λ°œμ„± μ•Œλ¦Όμ€ checkedκ°€ true둜 λ³€κ²½λ©λ‹ˆλ‹€.

PUT /api/notifications/bulk-check

κΆŒν•œ: isLoggedIn

응닡 (200)

{
  "checkedCount": 5,
  "deletedCount": 3
}
ν•„λ“œ νƒ€μž… μ„€λͺ…
checkedCount number 확인 처리된 λΉ„νœ˜λ°œμ„± μ•Œλ¦Ό 수
deletedCount number μ‚­μ œλœ νœ˜λ°œμ„± μ•Œλ¦Ό 수

μ•Œλ¦Ό μ„€μ • 쑰회

λ‘œκ·ΈμΈν•œ μ‚¬μš©μžμ˜ μ•Œλ¦Ό μˆ˜μ‹  섀정을 μ‘°νšŒν•©λ‹ˆλ‹€. 섀정이 μ‘΄μž¬ν•˜μ§€ μ•ŠμœΌλ©΄ κΈ°λ³Έκ°’μœΌλ‘œ μžλ™ μƒμ„±λ©λ‹ˆλ‹€.

GET /api/notifications/settings

κΆŒν•œ: isLoggedIn

응닡 (200)

{
  "settings": {
    "classInvitation": true,
    "classCancellation": true,
    "classApproval": true,
    "classApprovalCancel": true,
    "scheduleStart": true,
    "newPost": true,
    "directMessage": true,
    "soundEnabled": true,
    "reminder": true,
    "eventReminderDefault": 15
  }
}

μ•Œλ¦Ό μ„€μ • μˆ˜μ •

μ•Œλ¦Ό μˆ˜μ‹  섀정을 μˆ˜μ •ν•©λ‹ˆλ‹€. μ „λ‹¬λœ ν•„λ“œλ§Œ λ³€κ²½λ˜λ©°, 미전달 ν•„λ“œλŠ” κΈ°μ‘΄ 값이 μœ μ§€λ©λ‹ˆλ‹€.

PUT /api/notifications/settings

κΆŒν•œ: isLoggedIn

μš”μ²­ λ³Έλ¬Έ

ν•„λ“œ νƒ€μž… ν•„μˆ˜ μ„€λͺ…
classInvitation boolean X μˆ˜μ—… μ΄ˆλŒ€ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
classCancellation boolean X μˆ˜μ—… μ΄ˆλŒ€ μ·¨μ†Œ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
classApproval boolean X μˆ˜μ—… 승인 μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
classApprovalCancel boolean X μˆ˜μ—… 승인 μ·¨μ†Œ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
scheduleStart boolean X 일정 μ‹œμž‘ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
newPost boolean X μƒˆ κ²Œμ‹œκΈ€ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€
directMessage boolean X 직접 λ©”μ‹œμ§€ μ•Œλ¦Ό μˆ˜μ‹  μ—¬λΆ€

μš”μ²­ μ˜ˆμ‹œ

{
  "classInvitation": true,
  "classCancellation": false,
  "directMessage": true
}

응닡 (200)

{
  "settings": {
    "classInvitation": true,
    "classCancellation": false,
    "classApproval": true,
    "classApprovalCancel": true,
    "scheduleStart": true,
    "newPost": true,
    "directMessage": true,
    "soundEnabled": true,
    "reminder": true,
    "eventReminderDefault": 15
  }
}

데이터 λͺ¨λΈ

Notification

ν•„λ“œ νƒ€μž… ν•„μˆ˜ κΈ°λ³Έκ°’ μ„€λͺ…
_id ObjectId - μžλ™μƒμ„± 고유 μ‹λ³„μž
type string O - "sent" (λ°œμ‹ ) λ˜λŠ” "received" (μˆ˜μ‹ )
user ObjectId O - μ•Œλ¦Ό μ†Œμœ μž (λ°œμ‹ μž λ˜λŠ” μˆ˜μ‹ μž)
userId string O - μ†Œμœ μž μ‚¬μš©μž ID
userName string O - μ†Œμœ μž 이름
toUserList object[] X - type=sent일 λ•Œ μˆ˜μ‹ μž λͺ©λ‘
fromUser ObjectId X - type=received일 λ•Œ λ°œμ‹ μž ObjectId
fromUserId string X - type=received일 λ•Œ λ°œμ‹ μž μ‚¬μš©μž ID
fromUserName string X - type=received일 λ•Œ λ°œμ‹ μž 이름
checked boolean X false type=received일 λ•Œ 확인 μ—¬λΆ€
category string X - μ•Œλ¦Ό μΉ΄ν…Œκ³ λ¦¬
title string O - μ•Œλ¦Ό 제λͺ©
description string X - μ•Œλ¦Ό λ‚΄μš©
date Date X μžλ™μ„€μ • insertMany μ‹œ UTC μ‹œκ°μœΌλ‘œ μžλ™ μ„€μ •
notificationType string X "direct" μ•Œλ¦Ό μœ ν˜• (μ•„λž˜ μ°Έμ‘°)
relatedEntity object X - κ΄€λ ¨ μ—”ν‹°ν‹° 정보 (type, id)
autoDeleteOnCheck boolean X true 확인 μ‹œ μžλ™ μ‚­μ œ μ—¬λΆ€ (νœ˜λ°œμ„± μ•Œλ¦Ό)
createdAt Date - μžλ™μƒμ„± 생성 μΌμ‹œ
updatedAt Date - μžλ™μƒμ„± μˆ˜μ • μΌμ‹œ

인덱슀

인덱슀 ν•„λ“œ 속성
user_1_createdAt_-1 { user: 1, createdAt: -1 } COMPOUND

notificationType κ°’

κ°’ μ„€λͺ…
direct 직접 λ°œμ†‘ μ•Œλ¦Ό (κΈ°λ³Έκ°’)
classInvitation μˆ˜μ—… μ΄ˆλŒ€ μ•Œλ¦Ό
classCancellation μˆ˜μ—… μ΄ˆλŒ€ μ·¨μ†Œ μ•Œλ¦Ό
classApproval μˆ˜μ—… 승인 μ•Œλ¦Ό
classApprovalCancel μˆ˜μ—… 승인 μ·¨μ†Œ μ•Œλ¦Ό
scheduleStart 일정 μ‹œμž‘ μ•Œλ¦Ό
newPost μƒˆ κ²Œμ‹œκΈ€ μ•Œλ¦Ό
reminder λ¦¬λ§ˆμΈλ” μ•Œλ¦Ό

relatedEntity.type κ°’

κ°’ μ„€λͺ…
enrollment μˆ˜κ°• 등둝
syllabus κ°•μ˜ κ³„νš
calendarEvent μΊ˜λ¦°λ” 이벀트
post κ²Œμ‹œκΈ€
reminder λ¦¬λ§ˆμΈλ”

NotificationSetting

ν•„λ“œ νƒ€μž… ν•„μˆ˜ κΈ°λ³Έκ°’ μ„€λͺ…
_id ObjectId - μžλ™μƒμ„± 고유 μ‹λ³„μž
user ObjectId O - μ‚¬μš©μž ObjectId (UNIQUE)
userId string O - μ‚¬μš©μž ID
userName string O - μ‚¬μš©μž 이름
settings object X κΈ°λ³Έκ°’ 객체 μ•Œλ¦Ό μ„€μ • (μ•„λž˜ μ°Έμ‘°)
createdAt Date - μžλ™μƒμ„± 생성 μΌμ‹œ
updatedAt Date - μžλ™μƒμ„± μˆ˜μ • μΌμ‹œ

settings κΈ°λ³Έκ°’

ν•„λ“œ νƒ€μž… κΈ°λ³Έκ°’ μ„€λͺ…
classInvitation boolean true μˆ˜μ—… μ΄ˆλŒ€ μ•Œλ¦Ό
classCancellation boolean true μˆ˜μ—… μ΄ˆλŒ€ μ·¨μ†Œ μ•Œλ¦Ό
classApproval boolean true μˆ˜μ—… 승인 μ•Œλ¦Ό
classApprovalCancel boolean true μˆ˜μ—… 승인 μ·¨μ†Œ μ•Œλ¦Ό
scheduleStart boolean true 일정 μ‹œμž‘ μ•Œλ¦Ό
newPost boolean true μƒˆ κ²Œμ‹œκΈ€ μ•Œλ¦Ό
directMessage boolean true 직접 λ©”μ‹œμ§€ μ•Œλ¦Ό
soundEnabled boolean true μ•Œλ¦ΌμŒ ν™œμ„±ν™”
reminder boolean true λ¦¬λ§ˆμΈλ” μ•Œλ¦Ό
eventReminderDefault number 15 이벀트 λ¦¬λ§ˆμΈλ” κΈ°λ³Έκ°’ (λΆ„)

μ£Όμš” νŠΉμ„±

νœ˜λ°œμ„± μ•Œλ¦Ό (autoDeleteOnCheck)

autoDeleteOnCheckκ°€ true인 μ•Œλ¦Όμ€ 확인 μ‹œ λ°μ΄ν„°λ² μ΄μŠ€μ—μ„œ μ‚­μ œλ©λ‹ˆλ‹€. 기본값이 trueμ΄λ―€λ‘œ λŒ€λΆ€λΆ„μ˜ μ•Œλ¦Όμ€ 확인 ν›„ μžλ™ μ‚­μ œλ©λ‹ˆλ‹€. 영ꡬ적으둜 보관해야 ν•˜λŠ” μ•Œλ¦Όμ€ 생성 μ‹œ autoDeleteOnCheck: false둜 μ„€μ •ν•©λ‹ˆλ‹€.

WebSocket μ‹€μ‹œκ°„ μ•Œλ¦Ό

μ•Œλ¦Ό 생성 μ‹œ Socket.ioλ₯Ό 톡해 μˆ˜μ‹ μžμ—κ²Œ μ‹€μ‹œκ°„μœΌλ‘œ μ•Œλ¦Ό μ΄λ²€νŠΈκ°€ μ „μ†‘λ©λ‹ˆλ‹€. 각 μ‚¬μš©μžλŠ” {academyId}/{userId} ν˜•μ‹μ˜ 룸에 μ ‘μ†ν•˜λ©°, listen 이벀트둜 "update notifications" λ©”μ‹œμ§€λ₯Ό μˆ˜μ‹ ν•©λ‹ˆλ‹€.

μžλ™ μ•Œλ¦Ό μ„€μ • 필터링

sendAutoNotification μ„œλΉ„μŠ€λ₯Ό 톡해 λ°œμ†‘λ˜λŠ” μžλ™ μ•Œλ¦Όμ€ μˆ˜μ‹ μžμ˜ μ•Œλ¦Ό 섀정을 ν™•μΈν•˜μ—¬, ν•΄λ‹Ή notificationType을 λΉ„ν™œμ„±ν™”ν•œ μ‚¬μš©μžμ—κ²ŒλŠ” μ•Œλ¦Όμ΄ λ°œμ†‘λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.


ν”„λ‘ νŠΈμ—”λ“œ API ν•¨μˆ˜ (useAPIv2)

ν•¨μˆ˜λͺ… λ©”μ„œλ“œ 경둜 μ„€λͺ…
CNotification POST /api/notifications μ•Œλ¦Ό 생성
RNotifications GET /api/notifications μ•Œλ¦Ό λͺ©λ‘ 쑰회
RNotification GET /api/notifications/:_id μ•Œλ¦Ό 상세 쑰회
UCheckNotification PUT /api/notifications/:_id/check μ•Œλ¦Ό 확인
DNotification DELETE /api/notifications/:_id μ•Œλ¦Ό μ‚­μ œ
UBulkCheckNotifications PUT /api/notifications/bulk-check μ•Œλ¦Ό 일괄 확인
RNotificationSettings GET /api/notifications/settings μ•Œλ¦Ό μ„€μ • 쑰회
UNotificationSettings PUT /api/notifications/settings μ•Œλ¦Ό μ„€μ • μˆ˜μ •