Update Campaign API Endpoints
Endpoint
POST /project-type/update
Request Structure
Body Parameters
RequestInfo: Object containing RequestInfo.
CampaignDetails: Object containing the details of the campaign to be updated.
id: Unique identifier of the campaign.
tenantId: Tenant identifier.
hierarchyType: Type of hierarchy.
action: Action type (
create
ordraft
).boundaries: Array of boundaries.
resources: Array of resources.
projectType: Type of the project.
deliveryRules: Array of delivery rules.
Response Structure
Success Response
ResponseInfo: Object containing ResponseInfo.
CampaignDetails: The updated campaign details.
Flow
Receive Request
The ProjectFactoryService receives an updateCampaign request from the Client.
Validate Request Schema
The received request schema is validated to ensure it matches the expected format.
Check Campaign Existence
The system checks if the campaign specified in the request exists in the database.
Conditional template generation call
If boundaries are different from the campaign in the database, call:
Facility template generate
User template generate
Target template generate
If delivery conditions are different, call:
Target template generate
Check Campaign Status
If the campaign exists, the system checks its status in the database.
Handle Drafted Status
If the campaign status is 'drafted':
Validate Boundaries: Validate the request for hierarchyType and boundaries.
Validate Project Type: It validates the request for the project type code from MDMS.
Enrich Campaign Details: Enrich the campaign details and set the status to 'updating'.
Update Campaign Details: Update the campaign details in the database.
Update Resource Data: Update each resource data associated with the campaign through the
/project-factory/v1/data/_update
API.Enrich Boundaries: Enrich the boundaries for the project update.
Update Projects: Update projects associated with each boundary.
Persist Changes: Persist the updated campaign details in the database.
Send to Kafka Topic: Send the updated CampaignDetails object to the Kafka topic for project mappings.
Listen to Kafka: Listen for updates from the Kafka topic to get the updated CampaignDetails object for project mappings.
Handle Campaign Status
If the campaign status is not 'created':
Do project mapping through
/project-factory/v1/project-type/createCampaign
API.Enrich the CampaignDetails and set the status to 'created'.
Update the CampaignDetail in the database.
Handle Project Mapping Error
If the campaign status is 'created':
Throw an error indicating that the project is already mapped for this campaign.
Enrich the CampaignDetails and set the status to 'failed'.
Update the CampaignDetail in the database.
Handle Non-Drafted Status
If the campaign status is not 'drafted', the system throws an error indicating that only drafted campaigns can be updated.
Send Response
The ProjectFactoryService sends a response to the Client based on the outcome of the update operation.
Flow Diagram

Last updated
Was this helpful?