> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Notifications Koleksiyonu

`notifications` bir kullanıcının proje panosunun üstünde gösterilen bildirimleri tutar. Her belge, bir kullanıcıya yönelik bir bildirimdir ve `key` değeriyle tanımlanır. Koleksiyona yalnızca `notifications` hizmeti erişir (`services/notifications/app/js/Notifications.js`); `web` ve `third-party-datastore` onun HTTP API'sini çağırır. Mongoose şeması yoktur.

#### Alanlar

| Alan | Tür | Anlamı | Kaynak |
| - | - | - | - |
| `_id` | ObjectId | Bildirim kimliği. `web`, bir bildirimi bu kimlikle okundu olarak işaretler. | `Notifications.js:58-65` |
| `user_id` | ObjectId | Bildirimi gören kullanıcı. | `Notifications.js:26` |
| `key` | String | Bildirimi tanımlar, örneğin `project-invite-<inviteId>`. Upsert, her `user_id` ve `key` için tek belge tutar; benzersiz dizin yoktur. | `Notifications.js:27`, `:51-55` |
| `templateKey` | String | Ön yüzün hangi bildirimi göstereceği. Bildirim okunduğunda veya kapatıldığında kaldırılır; belge kalır. | `Notifications.js:29`, `:63`, `:72`, `:78` |
| `messageOpts` | Object | Bildirim metni için değerler, `templateKey` değerine bağlıdır (proje daveti için: `userName`, `projectName`, `projectId`, `token`). Kullanıcı bildirimi kimliğiyle kapattığında kaldırılır. | `Notifications.js:28`, `:63` |
| `expires` | Date | İsteğe bağlı. TTL dizini belgeyi bu zamandan sonra siler. | `Notifications.js:35-50` |

#### Kim yazar

| Kod | Ne yapar |
| - | - |
| `Notifications.js:20-56` (`addNotification`) | `POST /user/:user_id` (`services/notifications/app.ts:29`). `user_id` + `key` ile upsert yapar. Bu anahtarla bir belge zaten varsa, yalnızca çağıran `forceCreate` gönderdiğinde yeniden yazılır. |
| `Notifications.js:58-65` (`removeNotificationId`) | `DELETE /user/:user_id/notification/:notification_id` (`app.ts:31-34`): `templateKey` ve `messageOpts` alanlarını kaldırır. |
| `Notifications.js:67-80` | `DELETE /user/:user_id` ve `DELETE /key/:key` (`app.ts:35-36`): anahtara göre `templateKey` alanını kaldırır. |
| `Notifications.js:87-100` | `DELETE /key/:key/bulk` (`app.ts:38-41`) bir anahtara sahip okunmamış bildirimleri siler; `deleteNotificationByKeyOnly` anahtara göre tek bir belgeyi siler. |
| `services/web/app/src/Features/Notifications/NotificationsHandler.mjs:33-66` | `addNotification` işleminin `web` tarafı. Çağıran `false` geçmedikçe `forceCreate: true` gönderir. |
| `services/third-party-datastore/app/js/QueueWorker.mjs:46-58` | Dropbox eşitlememiz: bir Dropbox hesabının bağlantısını kaldırdığında `dropbox-unlinked` bildirimini doğrudan gönderir. |

CE'nin ve modüllerimizin oluşturduğu bildirimler:

| `key` | `templateKey` | Oluşturulduğu yer |
| - | - | - |
| `project-invite-<inviteId>` | `notification_project_invite`, davetle birlikte sona erer | `services/web/app/src/Features/Collaborators/CollaboratorsInviteHandler.mjs:40-42`, oluşturulduğu yer: `services/web/app/src/Features/Notifications/NotificationsBuilder.mjs:100-122`. Yalnızca davet edilen e-posta mevcut bir kullanıcıya aitse. |
| `tpdsFileLimit-<userId>` | `notification_tpds_file_limit` | `services/web/app/src/Features/ThirdPartyDataStore/TpdsController.mjs:118-124` (bir Dropbox güncellemesi projeyi dosya sınırının üzerine çıkaracaksa), `NotificationsBuilder.mjs:175-195` |
| `dropboxDuplicateProjectNames-<userId>` | `notification_dropbox_duplicate_project_names` | `services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateHandler.mjs:160-169`, `NotificationsBuilder.mjs:10-30` |
| `dropbox-unlinked` | `dropbox_unlinked_because_access_denied`, `dropbox_unlinked_because_full` veya `dropbox_unlinked_because_suspended` | `services/third-party-datastore/app/js/QueueWorker.mjs:20-25`, `:46-58` (Dropbox eşitlememiz) |

`NotificationsBuilder.mjs`, grup davetleri, kurum bağlantıları, abonelikler ve eski hata ayıklama projeleri için de anahtarlar oluşturur. Bunları çağıran kod abonelik ve kurum kodundadır; eski hata ayıklama projeleri denetimi yalnızca `isSaas` olduğunda çalışır (`services/web/app/src/Features/Project/ProjectListController.mjs:234-236`).

#### Kim okur

| Kod | Ne yapar |
| - | - |
| `Notifications.js:4-10` (`getUserNotifications`) | `GET /user/:user_id` (`app.ts:30`). Yalnızca kullanıcının hâlâ `templateKey` alanı olan belgelerini döndürür. |
| `services/web/app/src/Features/Project/ProjectListController.mjs:367` | Proje panosu için bildirimleri yükler. |
| `services/web/app/src/Features/Notifications/NotificationsController.mjs` | `GET /notifications`, `DELETE /notifications/:notificationId` ve `GET /user/notification/:notificationId` (`services/web/app/src/router.mjs:922-937`). |
| `services/web/modules/dropbox/app/src/DropboxHandler.mjs:128-131` | Dropbox modülümüz: kullanıcı Dropbox'ı yeniden bağladığında `dropbox-unlinked` ve `dropboxDuplicateProjectNames-<userId>` bildirimlerini okundu olarak işaretler. |

#### Dizinler

| Ad | Anahtarlar | Seçenekler | Geçiş |
| - | - | - | - |
| `expires_1` | `{ expires: 1 }` | TTL, `expireAfterSeconds: 10` | `tools/migrations/20190912145014_create_notifications_indexes.mjs` |
| `key_1` | `{ key: 1 }` | | aynı |
| `user_id_1` | `{ user_id: 1 }` | | aynı |

#### Notlar

* Okunan bir bildirim silinmez: yalnızca `templateKey` kalkar. Belge anahtarı hâlâ tuttuğu için, aynı anahtar için daha sonra `forceCreate` olmadan yapılan bir `addNotification` hiçbir şey yapmaz (`Notifications.js:21-24`).
* `/key/:key` rotaları tüm kullanıcılar genelinde yalnızca anahtar üzerinden çalışır (`Notifications.js:76-100`).
* `web` üzerinde `apis.notifications.url` yoksa bildirim ne oluşturur ne de okur (`NotificationsHandler.mjs:17`, `:41`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.