# Banner Photos API

## List All Banner Photos

`GET /api/banner-photos`

Get all banner photos with optional filtering by page.

### Headers

| Header | Value |
|--------|-------|
| Content-Type | application/json |

### Query Parameters

| Param | Type | Required | Description |
|-------|------|----------|-------------|
| page | string | No | Filter by page. Must be one of: "Home", "About Us", "Our Services", "Promos", "Testimonials", "Activities", "Blog", "Contacts" |

### Response

```json
{
  "success": true,
  "data": [
    {
      "_id": "...",
      "imgUrl": "https://cherryk.s3.ap-southeast-1.amazonaws.com/banners/1712345678900-banner.jpg",
      "fileName": "banner.jpg",
      "image": "...",
      "type": "banner",
      "page": "Home",
      "isDeleted": false,
      "createdDate": "..."
    }
  ]
}
```

### Errors

- `500` — Server error

---

## Upload Banner Photos

`POST /api/banner-photos`

Upload up to 5 banner photos for a specific website page.

### Headers

| Header | Value |
|--------|-------|
| Content-Type | multipart/form-data |

### Body (multipart/form-data)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| banners | file[] | Yes | Array of image files (max 5). Allowed: png, jpg, jpeg, gif, webp, avif. Max 10MB each |
| page | string | Yes | Must be one of: "Home", "About Us", "Our Services", "Promos", "Testimonials", "Activities", "Blog", "Contacts" |
| description | string | No | Photo caption or description text |

### Response

```json
{
  "success": true,
  "message": "Upload Banner Photos Successfully"
}
```

### Errors

- `400` — Validation error (page missing/invalid, invalid field format)
- `413` — File too large (exceeds 10MB)
- `500` — Server error

---

## Get Banner Photo By ID

`GET /api/banner-photo/:id`

Get a specific banner photo by its ID.

### Headers

| Header | Value |
|--------|-------|
| Content-Type | application/json |

### Parameters

| Param | Type | Required | Description |
|-------|------|----------|-------------|
| id | string | Yes | Banner photo MongoDB ObjectID |

### Response

```json
{
  "success": true,
  "message": "This is list By Id",
  "data": {
    "_id": "...",
    "imgUrl": "https://cherryk.s3.ap-southeast-1.amazonaws.com/banners/1712345678900-banner.jpg",
    "fileName": "banner.jpg",
    "image": "...",
    "type": "banner",
    "page": "Home",
    "isDeleted": false,
    "createdDate": "..."
  }
}
```

### Errors

- `500` — Server error

---

## Update Banner Photo

`PUT /api/banner-photo/:id`

Update a banner photo with new image and/or page information.

### Headers

| Header | Value |
|--------|-------|
| Content-Type | multipart/form-data |

### Parameters

| Param | Type | Required | Description |
|-------|------|----------|-------------|
| id | string | Yes | Banner photo MongoDB ObjectID |

### Body (multipart/form-data)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| banners | file | No | Single image file (replaces existing). Allowed: png, jpg, jpeg, gif, webp, avif. Max 10MB |
| page | string | No | New page value. Must be one of: "Home", "About Us", "Our Services", "Promos", "Testimonials", "Activities", "Blog", "Contacts". If not provided, current page remains unchanged |
| description | string | No | New description text |

### Response

```json
{
  "success": true,
  "message": "Edit Banner Photo Successfully",
  "data": {
    "_id": "...",
    "imgUrl": "https://cherryk.s3.ap-southeast-1.amazonaws.com/banners/1712345678901-new-banner.jpg",
    "fileName": "new-banner.jpg",
    "image": "...",
    "type": "banner",
    "page": "About Us",
    "isDeleted": false,
    "createdDate": "...",
    "updatedAt": "..."
  }
}
```

### Errors

- `400` — Validation error (id format, page format)
- `404` — Banner photo not found
- `413` — File too large (exceeds 10MB)
- `500` — Server error

---

## Delete Banner Photo

`DELETE /api/banner-photo/:id`

Soft delete a banner photo (sets `isDeleted` to `true`).

### Headers

| Header | Value |
|--------|-------|
| Content-Type | application/json |

### Parameters

| Param | Type | Required | Description |
|-------|------|----------|-------------|
| id | string | Yes | Banner photo MongoDB ObjectID |

### Response

```json
{
  "success": true,
  "message": "Delete Banner Photo Successfully",
  "data": {
    "_id": "...",
    "imgUrl": "https://cherryk.s3.ap-southeast-1.amazonaws.com/banners/1712345678900-banner.jpg",
    "fileName": "banner.jpg",
    "image": "...",
    "type": "banner",
    "page": "Home",
    "isDeleted": true,
    "createdDate": "...",
    "updatedAt": "..."
  }
}
```

### Errors

- `400` — Invalid ID format
- `404` — Banner photo not found
- `500` — Server error
