Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hlm 6407 template #1154

Open
wants to merge 26 commits into
base: test-campaign-changes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4001a02
some changes related to generate boundary template (#1133)
nitish-egov Jul 24, 2024
e13a224
Merge branch 'campaign' into HLM-6407-template
Priyanka-eGov Jul 24, 2024
e01bec6
updated logic for target columns acc to delivery conditions only for …
nitish-egov Jul 24, 2024
ef95f25
updated version and boundary fix (#1141)
Bhavya-egov Jul 24, 2024
96ff68a
updated readmeconfig for sheet (#1142)
nitish-egov Jul 24, 2024
33d980c
HCMPRE-140: Action column fixes, date editable logic change (#1143)
nabeelmd-eGov Jul 24, 2024
0bb7cf7
Update constants.ts (#1145)
ashish-egov Jul 24, 2024
617e57e
Update Listener.ts (#1147)
ashish-egov Jul 25, 2024
bdaa5ac
HCMPRE 140 (#1149)
nabeelmd-eGov Jul 25, 2024
3ff3f61
updated core version (#1150)
Bhavya-egov Jul 25, 2024
9224289
HLM-6407 using same mdms schema for microplan
Priyanka-eGov Jul 25, 2024
232f6b2
Merge remote-tracking branch 'origin/HLM-6407-template' into HLM-6407…
Priyanka-eGov Jul 25, 2024
150f0e8
Ashish patch2 (#1152)
ashish-egov Jul 25, 2024
54a22ff
Redis cache for generating target when delivery conditions change (#1…
nitish-egov Jul 25, 2024
4acfd01
Ashish egov patch 2 (#1166)
ashish-egov Jul 29, 2024
8c12062
HCMPRE-154: Update Dates bug fixes, Toast added for error. (#1158)
nabeelmd-eGov Jul 29, 2024
7208f33
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 16, 2024
1e39e04
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 22, 2024
ca30738
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 22, 2024
228037b
HLM-6407 codde review comment
Priyanka-eGov Jul 23, 2024
f47b952
HCMPRE-91 code review comments
Priyanka-eGov Jul 24, 2024
ffd91a4
HLM-6407 using same mdms schema for microplan
Priyanka-eGov Jul 25, 2024
7555191
Merge branch 'campaign' into HLM-6407-template
Priyanka-eGov Jul 29, 2024
5f75bf4
HLM-6407 code review comments
Priyanka-eGov Jul 29, 2024
6514fa2
Merge remote-tracking branch 'origin/HLM-6407-template' into HLM-6407…
Priyanka-eGov Jul 29, 2024
bc55bf3
HLM-6407 code review comments
Priyanka-eGov Jul 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utilities/project-factory/src/server/api/campaignApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ async function processCreate(request: any, localizationMap?: any) {
schema = mdmsResponse
}
else if(type == "facilityMicroplan") {
const mdmsResponse = await callMdmsTypeSchema(request, tenantId, "facility", "microplan", "HCM-ADMIN-CONSOLE.adminSchemaMicroplan");
const mdmsResponse = await callMdmsTypeSchema(request, tenantId, "facility", "microplan");
schema = mdmsResponse
logger.info("Appending project type to capacity for microplan " + campaignType);
schema = await appendProjectTypeToCapacity(schema, campaignType);
Expand Down
3 changes: 2 additions & 1 deletion utilities/project-factory/src/server/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getDBSchemaName = (dbSchema = "") => {
}
// Configuration object containing various environment variables
const config = {
isCallGenerateWhenDeliveryConditionsDiffer:true,
isCallGenerateWhenDeliveryConditionsDiffer: true,
enableDynamicTargetTemplate: true,
prefixForMicroplanCampaigns: "MP",
excludeHierarchyTypeFromBoundaryCodes: false,
Expand Down Expand Up @@ -62,6 +62,7 @@ const config = {
KAFKA_CREATE_GENERATED_RESOURCE_DETAILS_TOPIC: process.env.KAFKA_CREATE_GENERATED_RESOURCE_DETAILS_TOPIC || "create-generated-resource-details",
KAFKA_SAVE_PROCESS_TRACK_TOPIC: process.env.KAFKA_SAVE_PROCESS_TRACK_TOPIC || "save-process-track",
KAFKA_UPDATE_PROCESS_TRACK_TOPIC: process.env.KAFKA_UPDATE_PROCESS_TRACK_TOPIC || "update-process-track",
KAFKA_TEST_TOPIC: "test-topic-project-factory",
},

// Database configuration
Expand Down
3 changes: 2 additions & 1 deletion utilities/project-factory/src/server/kafka/Listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const kafkaConfig: ConsumerGroupOptions = {
// Topic Names
const topicNames = [
config.kafka.KAFKA_START_CAMPAIGN_MAPPING_TOPIC,
config.kafka.KAFKA_PROCESS_CAMPAIGN_MAPPING_TOPIC
config.kafka.KAFKA_PROCESS_CAMPAIGN_MAPPING_TOPIC,
config.kafka.KAFKA_TEST_TOPIC
];

// Consumer Group Initialization
Expand Down
24 changes: 24 additions & 0 deletions utilities/project-factory/src/server/kafka/Producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,33 @@ const kafkaClient = new KafkaClient({
// Creating a new Kafka producer instance using the Kafka client
const producer = new Producer(kafkaClient, { partitionerType: 2 }); // Using partitioner type 2

// Function to send a test message to check broker availability
const checkBrokerAvailability = () => {
const payloads = [
{
topic: config.kafka.KAFKA_TEST_TOPIC,
messages: JSON.stringify({ message: 'Test message to check broker availability' }),
},
];

producer.send(payloads, (err, data) => {
if (err) {
if (err.message && err.message.toLowerCase().includes('broker not available')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use optional chaining for error message check.

To prevent potential undefined errors, use optional chaining when accessing the error message.

- if (err.message && err.message.toLowerCase().includes('broker not available')) {
+ if (err.message?.toLowerCase().includes('broker not available')) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (err.message && err.message.toLowerCase().includes('broker not available')) {
if (err.message?.toLowerCase().includes('broker not available')) {
Tools
Biome

[error] 26-26: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

logger.error('Broker not available. Shutting down the service.');
shutdownGracefully();
} else {
logger.error('Error sending test message:', err);
}
} else {
logger.info('Test message sent successfully:', data);
}
});
};

// Event listener for 'ready' event, indicating that the producer is ready to send messages
producer.on('ready', () => {
logger.info('Producer is ready'); // Log message indicating producer is ready
checkBrokerAvailability(); // Check broker availability by sending a test message
});

// Event listener for 'error' event, indicating that the producer encountered an error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function extractProperties(obj: any) {
}

function areBoundariesSame(existingBoundaries: any, currentBoundaries: any) {
if (!existingBoundaries || !currentBoundaries) return false;
if (existingBoundaries.length !== currentBoundaries.length) return false;
const existingSetOfBoundaries = new Set(existingBoundaries.map((exboundary: any) => JSON.stringify(extractProperties(exboundary))));
const currentSetOfBoundaries = new Set(currentBoundaries.map((currboundary: any) => JSON.stringify(extractProperties(currboundary))));
Expand Down Expand Up @@ -81,4 +82,4 @@ async function callGenerate(request: any, type: any) {



export { callGenerateIfBoundariesDiffer, callGenerate }
export { callGenerateIfBoundariesDiffer, callGenerate }
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ async function createFacilitySheet(request: any, allFacilities: any[], localizat
const isSourceMicroplan = checkIfSourceIsMicroplan(responseFromCampaignSearch?.CampaignDetails?.[0]?.additionalDetails?.source);
let schema;
if (isSourceMicroplan) {
schema = await callMdmsTypeSchema(request, tenantId, "facility", "microplan", "HCM-ADMIN-CONSOLE.adminSchemaMicroplan");
schema = await callMdmsTypeSchema(request, tenantId, "facility", "microplan");
} else {
schema = await callMdmsTypeSchema(request, tenantId, "facility", "all");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function generateDynamicTargetHeaders(request: any, campaignObject: any, l
}
else {
headerColumnsAfterHierarchy = await getConfigurableColumnHeadersBasedOnCampaignType(request);
headerColumnsAfterHierarchy.shift();
}
return headerColumnsAfterHierarchy;
}
Expand Down
Loading