Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Priyanshu471/ad-management/llms.txt

Use this file to discover all available pages before exploring further.

The Manage panel at /admin/manage is the planned administrative hub for campaign oversight on the Ad Management System. In its current state the route renders a placeholder. The REST API layer that will power this panel — for retrieving all campaigns, updating campaign fields, and deleting campaigns — is fully implemented and ready to consume.

Route

/admin/manage

Current Implementation

The page component currently renders a single placeholder element:
const Manage = () => {
  return <div>Manage</div>;
};
export default Manage;
The Manage UI is planned for a future iteration. All supporting API endpoints are available.

Campaign API Endpoints

The following endpoints are defined in app/api/campaign/route.ts and are available for the Manage UI to consume:

List all campaigns

GET /api/campaign
Returns every campaign document in the database, across all advertisers. No user scoping is applied.
{
  "campaigns": [
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d1",
      "title": "Summer Promo",
      "description": "...",
      "objective": "awareness",
      "status": "Active",
      "budget": "5000",
      "duration": "30",
      "user": "65f1a2b3c4d5e6f7a8b9c0d0",
      "createdAt": "2024-06-01T08:00:00.000Z"
    }
  ]
}

Update a campaign

PATCH /api/campaign
Finds a campaign by its current title (prevTitle) and applies the supplied field updates. All fields are optional except prevTitle, which is used as the lookup key:
{
  "prevTitle": "Summer Promo",
  "title": "Summer Promo 2024",
  "description": "Updated copy",
  "budget": "6000",
  "duration": "45",
  "status": "Live"
}

Delete a campaign

DELETE /api/campaign
Permanently removes the campaign document matching the supplied id:
{
  "id": "65f1a2b3c4d5e6f7a8b9c0d1"
}
Returns { "message": "Campaign deleted permanently" } on success.

Campaign Status Values

Each campaign document carries a status field set to "Active" by default when created. The possible values and their meanings are:
StatusDescription
ActiveDefault state — campaign is running
LiveCampaign is live and being promoted
EndCampaign has concluded
DeletedRemoved from the platform via the DELETE endpoint
Status transitions are applied through the PATCH /api/campaign endpoint by passing the desired value in the status field.
The PATCH endpoint locates campaigns by title (via prevTitle), not by _id. If two campaigns share the same title, findOneAndUpdate will match only the first document found. A future iteration of the Manage UI should switch the lookup key to _id to avoid ambiguity.

Build docs developers (and LLMs) love