> ## 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.

# Dropbox Projects 컬렉션

`dropboxProjects`는 프로젝트를 한 사용자의 Dropbox에 있는 폴더에 연결합니다. 여러 Dropbox 사용자와 공유된 프로젝트는 사용자마다 문서가 하나씩 있습니다. 이 컬렉션은 Dropbox 동기화에 속합니다. third-party-datastore(`services/third-party-datastore/app/js/StateManager.mjs`)가 쓰고, `dropbox` 웹 모듈(`services/web/modules/dropbox/app/src/DropboxHandler.mjs`)이 읽고 비웁니다. Mongoose 스키마는 없습니다.

#### 필드

| 필드 | 타입 | 의미 | 출처 |
| - | - | - | - |
| `_id` | ObjectId | 삽입 시 드라이버가 설정합니다. | `StateManager.mjs:144` |
| `userId` | ObjectId | 폴더가 있는 Dropbox의 Overleaf 사용자입니다. | `StateManager.mjs:145` |
| `projectId` | ObjectId | 폴더로 동기화되는 프로젝트입니다. | `StateManager.mjs:146` |
| `dropboxId` | String | Dropbox 폴더 메타데이터에 있는 폴더의 `id`입니다. | `StateManager.mjs:147`, `JobProcessor.mjs:82-87`, `PullManager.mjs:138` |
| `pathLower` | String | Dropbox에서의 폴더 경로로, 소문자이며 끝에 슬래시가 없습니다. 프로젝트 폴더는 최상위에 프로젝트마다 하나씩 있습니다. 예를 들어 Dropbox가 다른 프로젝트의 `Thesis` 옆에서 번호를 붙였다면 `/thesis (1)`입니다. | `StateManager.mjs:14-16,148`, `PullManager.mjs:112-117` |

#### 쓰는 곳

| 코드 | 하는 일 |
| - | - |
| `services/third-party-datastore/app/js/StateManager.mjs:137-150` (`setProjectFolder`) | 같은 `projectId`, `dropboxId` 또는 `pathLower`를 가진 사용자의 문서를 삭제한 다음 새 연결을 삽입합니다. |
| `services/third-party-datastore/app/js/JobProcessor.mjs:58-91` (`projectFolder`) | web이 새 프로젝트나 사용자가 추가된 프로젝트의 폴더를 요청할 때(`createProject`, `:245-251`), 또는 아직 폴더가 없는 프로젝트의 파일을 보낼 때(`addEntity`, `:113`) Dropbox에 폴더를 만들고 기록합니다. |
| `JobProcessor.mjs:174-203` (`renameProject`) | 프로젝트 이름 변경으로 폴더가 이동한 뒤 새 경로를 기록하거나, 폴더가 없어졌으면 연결을 제거합니다(`:190`). |
| `services/third-party-datastore/app/js/PullManager.mjs:119-140` (`resolveProject`) | pull이 연결되지 않은 폴더를 찾으면 web이 이름으로 찾은 프로젝트를 기록합니다. |
| `PullManager.mjs:188-207` (`applyDeletion`) | Dropbox에서 프로젝트 폴더가 삭제되면 연결을 제거합니다(`StateManager.mjs:152-157`). |
| `StateManager.mjs:186-190` (`removeUserState`), `services/third-party-datastore/app/js/QueueWorker.mjs:43`에서 호출 | third-party-datastore가 더 이상 사용할 수 없는 계정의 연결을 해제할 때 사용자의 문서를 모두 삭제합니다. |
| `DropboxHandler.mjs:142-146` (`removeUserState`) | 연결할 때(`:125`), 연결을 해제할 때(`:183`), 삭제된 사용자가 만료될 때(`services/web/modules/dropbox/index.mjs:62-64`) 사용자의 문서를 모두 삭제합니다. |
| `DropboxHandler.mjs:150-154` (`removeProjectState`) | 삭제된 프로젝트가 만료될 때 프로젝트의 문서를 삭제합니다(`index.mjs:54-56`). |

#### 읽는 곳

| 코드 | 하는 일 |
| - | - |
| `StateManager.mjs:130-135` (`getFolderOfProject`) | 프로젝트의 폴더를 찾습니다: `JobProcessor.mjs:59,98,176` 및 `PullManager.mjs:133`. |
| `StateManager.mjs:123-128` (`getProjectByFolder`) | 폴더의 프로젝트를 찾습니다: `JobProcessor.mjs:65`(이름이 이미 사용 중), `PullManager.mjs:120,197`. |
| `StateManager.mjs:160-175` (`getSyncedPaths`) | 커서를 재설정한 뒤 폴더 경로를 나열하여, 목록에 없는 폴더를 삭제된 것으로 간주하게 합니다(`PullManager.mjs:74-85`). |
| `DropboxHandler.mjs:234-250` (`getProjectFolderName`) | 편집기의 Dropbox 대화 상자에 표시되는 폴더 이름을 제공합니다(`services/web/modules/dropbox/app/src/DropboxController.mjs:130`). |

#### 인덱스

| 이름 | 키 | 옵션 | 마이그레이션 |
| - | - | - | - |
| `_id_` | `_id: 1` | | default |

CE에는 여기에 다른 인덱스가 없습니다. 고유 인덱스 `projectId_userId_1`과 `userId_dropboxId_1`은 `tools/migrations/20220815105500_create_dropboxProjects_index.mjs`와 `20220817120900_create_dropboxProjects_index.mjs`에서 만들어지는데, 이 마이그레이션에는 `saas` 태그만 있어 CE는 이를 실행하지 않습니다.

#### 참고

* 고유성은 `setProjectFolder`에서 삽입할 때마다 먼저 수행하는 삭제로만 유지됩니다(`StateManager.mjs:140-149`). `StateManager.mjs:3-11`의 주석은 고유 인덱스를 언급하지만 CE에는 없습니다.
* 프로젝트의 연결이 제거되어도 폴더는 Dropbox에 남습니다. 그곳에서의 편집은 Dropbox에서 만든 폴더처럼 새 프로젝트로 읽힙니다(`DropboxHandler.mjs:148-149`).
* 삭제된 프로젝트는 아직 복원할 수 있으므로 만료될 때까지 연결을 유지합니다(`index.mjs:52-53`).
* 사용자의 Dropbox `list_folder` 커서는 여기에 없습니다. `users.dropbox.cursor`에 있습니다(`StateManager.mjs:177-184`).


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