Takazudo Modular Docs

Type to search...

to open search from anywhere

Admin Reservation Archive

Admin Reservation Archive

Bulk archive reservations. Archived records retain their original status but are excluded from the main list.

Endpoint

POST /api/admin/reservations/archive

Authentication

Requires Bearer token authentication.

Authorization: Bearer <PREORDER_API_TOKEN>

Request

Headers

HeaderRequiredValue
Content-TypeYesapplication/json
AuthorizationYesBearer <token>

Body

interface AdminBulkArchiveRequest {
  ids: Array<{
    id: string;         // Reservation ID
    productSlug: string; // Product slug for the reservation
  }>;
}

Example Request

curl -X POST https://preview--takazudomodular.netlify.app/api/admin/reservations/archive \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PREORDER_API_TOKEN" \
  -d '{
    "ids": [
      { "id": "res-001", "productSlug": "n32b-slim" },
      { "id": "res-002", "productSlug": "n32b-slim" }
    ]
  }'

Response

Success Response (200)

interface AdminBulkArchiveResponse {
  success: true;
  archivedCount: number;       // Number of successfully archived reservations
  archivedIds: string[];       // IDs that were successfully archived
  errors?: Array<{             // Optional: any errors that occurred
    id: string;
    error: string;
  }>;
}

Example Success Response

{
  "success": true,
  "archivedCount": 2,
  "archivedIds": ["res-001", "res-002"]
}

Partial Success Response

When some items fail to archive:

{
  "success": true,
  "archivedCount": 1,
  "archivedIds": ["res-001"],
  "errors": [
    { "id": "res-999", "error": "Reservation not found" }
  ]
}

Error Responses

Validation Error (400)

{
  "success": false,
  "error": "ids array is required"
}
{
  "success": false,
  "error": "ids array cannot be empty"
}

Authentication Error (401)

{
  "success": false,
  "error": "Unauthorized"
}

Behavior

  1. Validates the request body contains a non-empty ids array
  2. Iterates through each reservation ID
  3. Sets isArchived: true and archivedAt timestamp on each reservation
  4. Preserves the original status (reserved, responded) for historical reference
  5. Returns summary of archived items and any errors

Data Model

After archiving, a reservation looks like:

interface Reservation {
  id: string;
  email: string;
  name: string;
  productSlug: string;
  createdAt: string;
  status: 'reserved' | 'responded';  // Original status preserved
  respondedAt?: string;
  isArchived: true;           // Added on archive
  archivedAt: string;         // ISO timestamp when archived
}