/** * Campaign Controller * * NestJS controller demonstrating Core + BackendCampaignDomainService integration. * * @fileoverview Campaign REST API controller providing CRUD operations for campaigns * @module CampaignController */ import { BackendCampaignDomainService } from '../../domain/campaign'; import type { CampaignEntity, CreateCampaignDTO, PatchCampaignDTO } from '@plyaz/types/campaign'; import type { ReturnResponseType } from '@plyaz/types/errors'; /** * Injection token for BackendCampaignDomainService * @constant {string} */ export declare const BACKEND_CAMPAIGN_DOMAIN_SERVICE = "BACKEND_CAMPAIGN_DOMAIN_SERVICE"; /** * Campaign Controller * * Provides REST API endpoints for campaign management operations. * All endpoints return standardized response format using SuccessResponseStandard. * * @class CampaignController * @decorator @Controller('campaign') * * @example * ```typescript * // Usage in app.module.ts * import { CampaignModule } from '@plyaz/core'; * * @Module({ * imports: [CampaignModule], * }) * export class AppModule {} * ``` * * Routes: * - GET /campaign/health - Health check * - GET /campaign/entities/:id - Get campaign by ID * - POST /campaign/entities - Create campaign * - PATCH /campaign/entities/:id - Update campaign * - DELETE /campaign/entities/:id - Delete campaign */ export declare class CampaignController { private readonly campaignService; /** * Creates an instance of CampaignController * * @param {BackendCampaignDomainService} campaignService - Injected campaign domain service */ constructor(campaignService: BackendCampaignDomainService); /** * Health check endpoint * * @method GET * @route /campaign/health * @returns {ReturnResponseType<{service: boolean, timestamp: string}>} Service health status * * @example * ```http * GET /campaign/health * ``` * * @example Response * ```json * { * "success": true, * "message": "Service is healthy", * "data": { * "service": true, * "timestamp": "2024-01-01T00:00:00.000Z" * } * } * ``` */ health(): ReturnResponseType<{ service: boolean; timestamp: string; }>; /** * Get campaign by ID * * @method GET * @route /campaign/entities/:id * @param {string} id - Campaign ID * @returns {Promise>} Campaign entity or null if not found * @throws {ValidationError} When ID format is invalid * @throws {NotFoundError} When campaign doesn't exist * * @example * ```http * GET /campaign/entities/campaign-123 * ``` * * @example Response * ```json * { * "success": true, * "message": "Campaign retrieved successfully", * "data": { * "id": "campaign-123", * "name": "Summer Sale", * "description": "Summer promotional campaign", * "amount": 50000, * "status": "active" * } * } * ``` */ getCampaignById(id: string): Promise>; /** * Create a new campaign * * @method POST * @route /campaign/entities * @param {CreateCampaignDTO} dto - Campaign creation data * @returns {Promise>} Created campaign entity * @throws {ValidationError[]} When validation fails * @throws {ConflictError} When campaign with same name exists * * @example * ```http * POST /campaign/entities * Content-Type: application/json * * { * "name": "Winter Sale", * "description": "Winter promotional campaign", * "amount": 75000, * "is_visible": true * } * ``` * * @example Response * ```json * { * "success": true, * "message": "Campaign created successfully", * "data": { * "id": "campaign-456", * "name": "Winter Sale", * "description": "Winter promotional campaign", * "amount": 75000, * "status": "draft", * "createdAt": "2024-01-01T00:00:00.000Z" * }, * "codeStatus": 201 * } * ``` */ createCampaign(dto: CreateCampaignDTO): Promise>; /** * Update a campaign (partial update) * * @method PATCH * @route /campaign/entities/:id * @param {string} id - Campaign ID to update * @param {PatchCampaignDTO} dto - Partial campaign update data * @returns {Promise>} Updated campaign entity * @throws {ValidationError[]} When validation fails * @throws {NotFoundError} When campaign doesn't exist * * @example * ```http * PATCH /campaign/entities/campaign-123 * Content-Type: application/json * * { * "amount": 60000, * "status": "active" * } * ``` * * @example Response * ```json * { * "success": true, * "message": "Campaign updated successfully", * "data": { * "id": "campaign-123", * "name": "Summer Sale", * "amount": 60000, * "status": "active", * "updatedAt": "2024-01-01T00:00:00.000Z" * } * } * ``` */ updateCampaign(id: string, dto: PatchCampaignDTO): Promise>; /** * Delete a campaign * * @method DELETE * @route /campaign/entities/:id * @param {string} id - Campaign ID to delete * @returns {Promise>} Null on successful deletion * @throws {NotFoundError} When campaign doesn't exist * @throws {ConflictError} When campaign cannot be deleted (e.g., has dependencies) * * @example * ```http * DELETE /campaign/entities/campaign-123 * ``` * * @example Response * ```json * { * "success": true, * "message": "Campaign deleted successfully", * "data": null * } * ``` */ deleteCampaign(id: string): Promise>; } //# sourceMappingURL=campaign.controller.d.ts.map