# Folder model

A folder of images, with its preview, share code, size, and its view, like and comment counts.

## Fields

| Field | Type | Present | Notes |
|---|---|---|---|
| `id` | `integer` |  |  |
| `userId` | `integer` |  |  |
| `createdAt` | `date-time` |  |  |
| `updatedAt` | `date-time` |  |  |
| `contentType` | `"Image"` |  |  |
| `name` | `string` |  |  |
| `description` | `string` |  |  |
| `visibility` | `enum` |  | One of `Unlisted`, `Public`, `Private`, `Shared`. |
| `color` | `string` |  | The folder's colour: `#` and six hex digits, lowercase. Matches ^#[0-9a-f]{6}$. |
| `previewId` | `integer \| null` |  |  |
| `downloads` | `integer` |  |  |
| `privateLockedAt` | `date-time \| null` |  |  |
| `offlineAt` | `date-time \| null` |  |  |
| `preview` | `object \| null` |  | The folder's cover: a collage of its four newest images anyone with its link may see, never one marked NSFW. Null until one is made (`POST /folders/:folderId/preview`), and when nothing in it can be on it. |
| `preview.key` | `string` |  |  |
| `shareId` | `number` |  |  |
| `shareCode` | `string` |  |  |
| `contentCount` | `number` |  | How many images are in the folder: all of them to its owner; to anyone else, those that are Public or Unlisted and don't hide who uploaded them, the ones they see in it. |
| `size` | `number` |  | The bytes of the images counted in `contentCount`, as whoever asks sees them. |
| `contentCountForOthers` | `number` | optional | How many of the folder's images anyone but you sees in it: those that are Public or Unlisted and don't hide who uploaded them. The rest show only to you. Only on your own folders. |
| `sizeForOthers` | `number` | optional | The bytes of the images counted in `contentCountForOthers`. Only on your own folders. |
| `viewCount` | `number` |  |  |
| `likeCount` | `number` |  |  |
| `commentCount` | `number` |  |  |

## Returned by

The endpoints whose `data` holds a Folder as it is, and where.

- [`POST /folders`](https://hematite.gg/docs/developers/reference/folders#post-folders), in `data`
- [`GET /folders/:folderId`](https://hematite.gg/docs/developers/reference/folders#get-folders-folderid), in `data`
- [`PATCH /folders/:folderId`](https://hematite.gg/docs/developers/reference/folders#patch-folders-folderid), in `data`
- [`GET /folders/by-content`](https://hematite.gg/docs/developers/reference/folders#get-folders-by-content), in `data`
- [`GET /shares/by-code`](https://hematite.gg/docs/developers/reference/shares#get-shares-by-code), in `data.reference`
- [`GET /users/:userId/folders`](https://hematite.gg/docs/developers/reference/users#get-users-userid-folders), in `data[]`

## Inside other models

- [`Share`](https://hematite.gg/docs/developers/models/share), as `reference`

## Example

```json
{
  "id": 1,
  "userId": 1,
  "createdAt": "2026-11-10T18:24:00.000Z",
  "updatedAt": "2026-11-10T18:24:00.000Z",
  "contentType": "Image",
  "name": "Ranked",
  "description": "1v4 on the last round",
  "visibility": "Unlisted",
  "color": "#c4d4e0",
  "previewId": 1,
  "downloads": 0,
  "privateLockedAt": "2026-11-10T18:24:00.000Z",
  "offlineAt": "2026-11-10T18:24:00.000Z",
  "preview": {
    "key": "images/a1b2c3d4e5f6.png"
  },
  "shareId": 1,
  "shareCode": "x7Kp2QmA",
  "contentCount": 1,
  "size": 2457600,
  "contentCountForOthers": 0,
  "sizeForOthers": 0,
  "viewCount": 0,
  "likeCount": 0,
  "commentCount": 0
}
```
