# File Manager

# Update dan Move (Step by Step)

## A. Update File

### Endpoint
- `PATCH /api/v1/file-manager/files/update/:uuid`

### FE kirim request ini

```json
{
  "data": {
    "type": "file_manager_file_update",
    "id": "file-uuid",
    "attributes": {
      "name": "spidey-v2.png",
      "folder_id": "folder-uuid-optional"
    }
  }
}
```

Aturan:
- `data.id` harus sama dengan `:uuid` di path
- minimal isi salah satu: `name` atau `folder_id`
- `folder_id` null/kosong bisa dipakai untuk pindah ke root

## B. Update Folder

### Endpoint
- `PATCH /api/v1/file-manager/folders/update/:uuid`

### FE kirim request ini

```json
{
  "data": {
    "type": "file_manager_folder_update",
    "id": "folder-uuid",
    "attributes": {
      "name": "Manuals Updated",
      "parent_id": "parent-folder-uuid-optional"
    }
  }
}
```

Aturan:
- `data.id` harus sama dengan `:uuid`
- minimal isi salah satu: `name` atau `parent_id`

## C. Move Node (File/Folder) - Bulk

### Endpoint
- `PATCH /api/v1/file-manager/move`

### FE kirim request ini

```json
{
  "data": [
    {
      "uuid": "node-uuid-file-atau-folder",
      "destination_folder_uuid": "folder-uuid-optional"
    }
  ]
}
```

Aturan:
- `destination_folder_uuid` null/kosong = pindah ke root
- `uuid` bisa folder UUID atau file UUID
- bisa kirim banyak item sekaligus (bulk)

## Ringkasan
1. `PATCH /files/update/:uuid` untuk rename/move umum file
2. `PATCH /folders/update/:uuid` untuk rename/move umum folder
3. `PATCH /file-manager/move` untuk move-only file/folder (bulk, boleh 1 item)
