feat: implement environment-aware Planner configuration and UNK job name support
This commit is contained in:
@@ -23,11 +23,17 @@ const CONFIG = {
|
|||||||
TEST: {
|
TEST: {
|
||||||
pbCollection: 'Job_Info_TestEnv',
|
pbCollection: 'Job_Info_TestEnv',
|
||||||
excelTable: 'Test_Table',
|
excelTable: 'Test_Table',
|
||||||
|
plannerGroupId: 'e45f2188-dc65-42d6-b7b0-d0a873e07472',
|
||||||
|
plannerPlanId: '87nMEU5OqUqro1xLjY58-2UAD4uj',
|
||||||
|
plannerBucketId: '9VuH0OQEa0GQsCHtPgUCFmUACHVF',
|
||||||
description: '🧪 TEST ENVIRONMENT'
|
description: '🧪 TEST ENVIRONMENT'
|
||||||
},
|
},
|
||||||
PROD: {
|
PROD: {
|
||||||
pbCollection: process.env.PB_COLLECTION || 'Job_Info_Prod',
|
pbCollection: process.env.PB_COLLECTION || 'Job_Info_Prod',
|
||||||
excelTable: process.env.EXCEL_TABLE_NAME || 'Job_List',
|
excelTable: process.env.EXCEL_TABLE_NAME || 'Job_List',
|
||||||
|
plannerGroupId: process.env.PLANNER_GROUP_ID || 'e45f2188-dc65-42d6-b7b0-d0a873e07472',
|
||||||
|
plannerPlanId: process.env.PLANNER_PLAN_ID || '87nMEU5OqUqro1xLjY58-2UAD4uj',
|
||||||
|
plannerBucketId: process.env.PLANNER_BUCKET_ID || '9VuH0OQEa0GQsCHtPgUCFmUACHVF',
|
||||||
description: '🚀 PRODUCTION ENVIRONMENT'
|
description: '🚀 PRODUCTION ENVIRONMENT'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -37,6 +43,10 @@ console.log('\n' + '*'.repeat(60));
|
|||||||
console.log(' RUNNING IN: ' + activeConfig.description);
|
console.log(' RUNNING IN: ' + activeConfig.description);
|
||||||
console.log(' PocketBase: ' + activeConfig.pbCollection);
|
console.log(' PocketBase: ' + activeConfig.pbCollection);
|
||||||
console.log(' Excel Table: ' + activeConfig.excelTable);
|
console.log(' Excel Table: ' + activeConfig.excelTable);
|
||||||
|
console.log(' Planner Plan: ' + activeConfig.plannerPlanId);
|
||||||
|
console.log(' Planner Bucket: ' + activeConfig.plannerBucketId);
|
||||||
|
console.log(' Planner Plan: ' + activeConfig.plannerPlanId);
|
||||||
|
console.log(' Planner Bucket: ' + activeConfig.plannerBucketId);
|
||||||
console.log('*'.repeat(60) + '\n');
|
console.log('*'.repeat(60) + '\n');
|
||||||
|
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
@@ -437,12 +447,12 @@ async function createPlannerTask({
|
|||||||
const title = `Disposition New Job Folder for ${jobNumber} ${jobFullName}`;
|
const title = `Disposition New Job Folder for ${jobNumber} ${jobFullName}`;
|
||||||
|
|
||||||
// Create the Planner task
|
// Create the Planner task
|
||||||
const groupId = process.env.PLANNER_GROUP_ID;
|
const groupId = activeConfig.plannerGroupId;
|
||||||
const planId = process.env.PLANNER_PLAN_ID;
|
const planId = activeConfig.plannerPlanId;
|
||||||
const bucketId = process.env.PLANNER_BUCKET_ID;
|
const bucketId = activeConfig.plannerBucketId;
|
||||||
|
|
||||||
if (!groupId || !planId || !bucketId) {
|
if (!groupId || !planId || !bucketId) {
|
||||||
throw new Error('Missing Planner configuration: PLANNER_GROUP_ID, PLANNER_PLAN_ID, or PLANNER_BUCKET_ID');
|
throw new Error('Missing Planner configuration in activeConfig');
|
||||||
}
|
}
|
||||||
|
|
||||||
const newTask = await client.api('/planner/tasks').post({
|
const newTask = await client.api('/planner/tasks').post({
|
||||||
@@ -458,6 +468,10 @@ async function createPlannerTask({
|
|||||||
...(dueDateObj ? { dueDateTime: dueDateObj } : {}),
|
...(dueDateObj ? { dueDateTime: dueDateObj } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(`✓ Planner task created in Plan ID: ${planId}`);
|
||||||
|
|
||||||
|
console.log(`✓ Planner task created in Plan ID: ${planId}`);
|
||||||
|
|
||||||
// Set the Notes/Description via task details (match the working test script)
|
// Set the Notes/Description via task details (match the working test script)
|
||||||
const taskDetails = await client.api(`/planner/tasks/${newTask.id}/details`).get();
|
const taskDetails = await client.api(`/planner/tasks/${newTask.id}/details`).get();
|
||||||
const detailsEtag = taskDetails['@odata.etag'];
|
const detailsEtag = taskDetails['@odata.etag'];
|
||||||
|
|||||||
Reference in New Issue
Block a user