Skip to content

Commit

Permalink
WFPREV-259 Update projects and projectFiscals endpoints for new db ch…
Browse files Browse the repository at this point in the history
…anges (#424)
  • Loading branch information
ssylver93 authored Jan 16, 2025
1 parent 5517750 commit fcb3287
Show file tree
Hide file tree
Showing 22 changed files with 584 additions and 172 deletions.
80 changes: 55 additions & 25 deletions postman/Prevention.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"projectTypeCode\": {\n \"projectTypeCode\": \"FUEL_MGMT\"\n },\n \"siteUnitName\": \"Vancouver Forest Unit\",\n \"forestAreaCode\": {\n \"forestAreaCode\": \"WEST\"\n },\n \"generalScopeCode\": {\n \"generalScopeCode\": \"SL_ACT\"\n },\n \"project_status_code\": \"ACTIVE\",\n \"programAreaGuid\": \"27602cd9-4b6e-9be0-e063-690a0a0afb50\",\n \"projectName\": \"Sample Forest Management Project\",\n \"projectLead\": \"Jane Smith\",\n \"projectLeadEmailAddress\": \"[email protected]\",\n \"projectDescription\": \"This is a comprehensive forest management project focusing on sustainable practices\",\n \"closestCommunityName\": \"Vancouver\",\n \"totalFundingRequestAmount\": 100000.00,\n \"totalAllocatedAmount\": 95000.00,\n \"totalPlannedProjectSizeHa\": 500.00,\n \"totalPlannedCostPerHectare\": 200.00,\n \"totalActualAmount\": 0.00,\n \"isMultiFiscalYearProj\": false,\n \"forestRegionOrgUnitId\": 1001,\n \"forestDistrictOrgUnitId\": 2001,\n \"fireCentreOrgUnitId\": 3001,\n \"bcParksRegionOrgUnitId\": 4001,\n \"bcParksSectionOrgUnitId\": 5001\n,\n \"primaryObjectiveTypeCode\": \"WRR\",\n \"secondaryObjectiveTypeCode\": \"CRIT_INFRA\",\n \"tertiaryObjectiveTypeCode\": \"ECO_REST\"}",
"raw": "{\n \"projectTypeCode\": {\n \"projectTypeCode\": \"FUEL_MGMT\"\n },\n \"siteUnitName\": \"Vancouver Forest Unit\",\n \"forestAreaCode\": {\n \"forestAreaCode\": \"WEST\"\n },\n \"generalScopeCode\": {\n \"generalScopeCode\": \"SL_ACT\"\n },\n \"project_status_code\": \"ACTIVE\",\n \"programAreaGuid\": \"27602cd9-4b6e-9be0-e063-690a0a0afb50\",\n \"projectName\": \"Sample Forest Management Project\",\n \"projectLead\": \"Jane Smith\",\n \"projectLeadEmailAddress\": \"[email protected]\",\n \"projectDescription\": \"This is a comprehensive forest management project focusing on sustainable practices\",\n \"closestCommunityName\": \"Vancouver\",\n \"totalEstimatedCostAmount\": 100000.00,\n \"totalForecastAmount\": 95000.00,\n \"totalPlannedProjectSizeHa\": 500.00,\n \"totalPlannedCostPerHectare\": 200.00,\n \"totalActualAmount\": 0.00,\n \"isMultiFiscalYearProj\": false,\n \"forestRegionOrgUnitId\": 1001,\n \"forestDistrictOrgUnitId\": 2001,\n \"fireCentreOrgUnitId\": 3001,\n \"bcParksRegionOrgUnitId\": 4001,\n \"bcParksSectionOrgUnitId\": 5001,\n \"primaryObjectiveTypeCode\": \"WRR\",\n \"secondaryObjectiveTypeCode\": \"CRIT_INFRA\",\n \"tertiaryObjectiveTypeCode\": \"ECO_REST\"}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -209,7 +209,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"projectGuid\": \"{{projectGuid}}\",\n \"activityCategoryCode\": \"TACT_PLAN\",\n \"fiscalYear\": 2023,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"PLANNED\",\n \"projectFiscalName\": \"Fiscal Project 1\",\n \"projectFiscalDescription\": \"This is a test project fiscal description.\",\n \"businessAreaComment\": \"Test comment\",\n \"estimatedClwrrAllocAmount\": 1000.00,\n \"totalCostEstimateAmount\": 2000.00,\n \"fiscalFundingRequestAmount\": 1500.00,\n \"fiscalAllocatedAmount\": 1200.00,\n \"fiscalAncillaryFundAmount\": 300.00,\n \"fiscalPlannedProjectSizeHa\": 10.5,\n \"fiscalPlannedCostPerHaAmt\": 500.00,\n \"fiscalReportedSpendAmount\": 0.00,\n \"fiscalActualAmount\": 0.00,\n \"fiscalCompletedSizeHa\": 0.0,\n \"fiscalActualCostPerHaAmt\": 0.0,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"firstNationsPartner\": \"Test Partner\",\n \"resultsNumber\": \"RN123456\",\n \"resultsOpeningId\": \"RO12345\",\n \"resultsContactEmail\": \"[email protected]\",\n \"submittedByName\": \"Test User\",\n \"submittedByUserGuid\": \"123e4567-e89\",\n \"submittedByUserUserid\": \"testuser\",\n \"submissionTimestamp\": \"2024-01-01T12:00:00Z\",\n \"isApprovedInd\": true,\n \"isDelayedInd\": false\n}",
"raw": "{\n \"projectGuid\": \"{{projectGuid}}\",\n \"activityCategoryCode\": \"TACT_PLAN\",\n \"fiscalYear\": 2023,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"DRAFT\",\n \"projectFiscalName\": \"Fiscal Project 1\",\n \"projectFiscalDescription\": \"This is a test project fiscal description.\",\n \"businessAreaComment\": \"Test comment\",\n \"estimatedClwrrAllocAmount\": 1000.00,\n \"fiscalAncillaryFundAmount\": 300.00,\n \"fiscalPlannedProjectSizeHa\": 10.5,\n \"fiscalPlannedCostPerHaAmt\": 500.00,\n \"fiscalReportedSpendAmount\": 0.00,\n \"fiscalActualAmount\": 0.00,\n \"fiscalCompletedSizeHa\": 0.0,\n \"fiscalActualCostPerHaAmt\": 0.0,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"firstNationsPartner\": \"Test Partner\",\n \"resultsNumber\": \"RN123456\",\n \"resultsOpeningId\": \"RO12345\",\n \"resultsContactEmail\": \"[email protected]\",\n \"submittedByName\": \"Test User\",\n \"submittedByUserGuid\": \"123e4567-e89\",\n \"submittedByUserUserid\": \"testuser\",\n \"submissionTimestamp\": \"2024-01-01T12:00:00Z\",\n \"isApprovedInd\": true,\n \"isDelayedInd\": false,\n \"fiscalForecastAmount\": 1800.00}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -271,7 +271,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"projectPlanFiscalGuid\": \"{{projectPlanFiscalGuid}}\",\n \"projectGuid\": \"{{projectGuid}}\",\n \"activityCategoryCode\": \"RX_DEV\",\n \"fiscalYear\": 2024,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"PLANNED\",\n \"projectFiscalName\": \"Fiscal Project 1\",\n \"projectFiscalDescription\": \"This is a test project fiscal description.\",\n \"businessAreaComment\": \"Test comment\",\n \"estimatedClwrrAllocAmount\": 1000.00,\n \"totalCostEstimateAmount\": 2000.00,\n \"fiscalFundingRequestAmount\": 1500.00,\n \"fiscalAllocatedAmount\": 1200.00,\n \"fiscalAncillaryFundAmount\": 300.00,\n \"fiscalPlannedProjectSizeHa\": 10.5,\n \"fiscalPlannedCostPerHaAmt\": 500.00,\n \"fiscalReportedSpendAmount\": 0.00,\n \"fiscalActualAmount\": 0.00,\n \"fiscalCompletedSizeHa\": 0.0,\n \"fiscalActualCostPerHaAmt\": 0.0,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"firstNationsPartner\": \"Test Partner\",\n \"resultsNumber\": \"RN123456\",\n \"resultsOpeningId\": \"RO12345\",\n \"resultsContactEmail\": \"[email protected]\",\n \"submittedByName\": \"Test User\",\n \"submittedByUserGuid\": \"123e4567-e89\",\n \"submittedByUserUserid\": \"testuser\",\n \"submissionTimestamp\": \"2024-01-01T12:00:00Z\",\n \"isApprovedInd\": true,\n \"isDelayedInd\": false\n}",
"raw": "{\n \"projectPlanFiscalGuid\": \"{{projectPlanFiscalGuid}}\",\n \"projectGuid\": \"{{projectGuid}}\",\n \"activityCategoryCode\": \"RX_DEV\",\n \"fiscalYear\": 2024,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"PROPOSED\",\n \"projectFiscalName\": \"Fiscal Project 1\",\n \"projectFiscalDescription\": \"This is a test project fiscal description.\",\n \"businessAreaComment\": \"Test comment\",\n \"estimatedClwrrAllocAmount\": 1000.00,\n \"fiscalForecastAmount\": 300.00,\n \"fiscalAncillaryFundAmount\": 300.00,\n \"fiscalPlannedProjectSizeHa\": 10.5,\n \"fiscalPlannedCostPerHaAmt\": 500.00,\n \"fiscalReportedSpendAmount\": 0.00,\n \"fiscalActualAmount\": 0.00,\n \"fiscalCompletedSizeHa\": 0.0,\n \"fiscalActualCostPerHaAmt\": 0.0,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"firstNationsPartner\": \"Test Partner\",\n \"resultsNumber\": \"RN123456\",\n \"resultsOpeningId\": \"RO12345\",\n \"resultsContactEmail\": \"[email protected]\",\n \"submittedByName\": \"Test User\",\n \"submittedByUserGuid\": \"123e4567-e89\",\n \"submittedByUserUserid\": \"testuser\",\n \"submissionTimestamp\": \"2024-01-01T12:00:00Z\",\n \"isApprovedInd\": true,\n \"isDelayedInd\": false\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -387,7 +387,7 @@
"response": []
},
{
"name": "Update Project Copy",
"name": "Update Project",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -417,7 +417,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"projectGuid\": \"{{projectGuid}}\",\n \"projectTypeCode\": {\n \"projectTypeCode\": \"FUEL_MGMT\"\n },\n \"siteUnitName\": \"Vancouver Forest Unit\",\n \"forestAreaCode\": {\n \"forestAreaCode\": \"COAST\"\n },\n \"generalScopeCode\": {\n \"generalScopeCode\": \"SL_ACT\"\n },\n \"project_status_code\": \"ACTIVE\",\n \"programAreaGuid\": \"27602cd9-4b6e-9be0-e063-690a0a0afb50\",\n \"projectName\": \"Test 3\",\n \"projectLead\": \"Jane Smith\",\n \"projectLeadEmailAddress\": \"[email protected]\",\n \"projectDescription\": \"This is a comprehensive forest management project focusing on sustainable practices\",\n \"closestCommunityName\": \"Vancouver\",\n \"totalFundingRequestAmount\": 100000.00,\n \"totalAllocatedAmount\": 95000.00,\n \"totalPlannedProjectSizeHa\": 500.00,\n \"totalPlannedCostPerHectare\": 200.00,\n \"totalActualAmount\": 0.00,\n \"isMultiFiscalYearProj\": false,\n \"forestRegionOrgUnitId\": 1001,\n \"forestDistrictOrgUnitId\": 2001,\n \"fireCentreOrgUnitId\": 3001,\n \"bcParksRegionOrgUnitId\": 4001,\n \"bcParksSectionOrgUnitId\": 5001\n,\n \"primaryObjectiveTypeCode\": \"WRR\",\n \"secondaryObjectiveTypeCode\": \"CRIT_INFRA\",\n \"tertiaryObjectiveTypeCode\": \"ECO_REST\"}",
"raw": "{\n \"projectGuid\": \"{{projectGuid}}\",\n \"projectTypeCode\": {\n \"projectTypeCode\": \"FUEL_MGMT\"\n },\n \"siteUnitName\": \"Vancouver Forest Unit\",\n \"forestAreaCode\": {\n \"forestAreaCode\": \"COAST\"\n },\n \"generalScopeCode\": {\n \"generalScopeCode\": \"SL_ACT\"\n },\n \"project_status_code\": \"ACTIVE\",\n \"programAreaGuid\": \"27602cd9-4b6e-9be0-e063-690a0a0afb50\",\n \"projectName\": \"Test 3\",\n \"projectLead\": \"Jane Smith\",\n \"projectLeadEmailAddress\": \"[email protected]\",\n \"projectDescription\": \"This is a comprehensive forest management project focusing on sustainable practices\",\n \"closestCommunityName\": \"Vancouver\",\n \"totalEstimatedCostAmount\": 177000.00,\n \"totalForecastAmount\": 125000.00,\n \"totalPlannedProjectSizeHa\": 500.00,\n \"totalPlannedCostPerHectare\": 200.00,\n \"totalActualAmount\": 0.00,\n \"isMultiFiscalYearProj\": false,\n \"forestRegionOrgUnitId\": 1001,\n \"forestDistrictOrgUnitId\": 2001,\n \"fireCentreOrgUnitId\": 3001,\n \"bcParksRegionOrgUnitId\": 4001,\n \"bcParksSectionOrgUnitId\": 5001,\n \"primaryObjectiveTypeCode\": \"WRR\",\n \"secondaryObjectiveTypeCode\": \"CRIT_INFRA\",\n \"tertiaryObjectiveTypeCode\": \"ECO_REST\"}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -703,15 +703,6 @@
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"projectPlanFiscalGuid\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"projectGuid\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"activityCategoryCode\": \"Tactical Planning\",\n \"fiscalYear\": 2024,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"APPROVED\",\n \"projectFiscalName\": \"Forest Restoration\",\n \"projectFiscalDescription\": \"Restoration project for forest lands\",\n \"estimatedClwrrAllocAmount\": 50000.00,\n \"totalCostEstimateAmount\": 120000.00,\n \"fiscalFundingRequestAmount\": 70000.00,\n \"fiscalAllocatedAmount\": 65000.00,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"isApprovedInd\": true,\n \"isDelayedInd\": false,\n \"submissionTimestamp\": \"2025-01-01T00:00:00Z\",\n \"approverName\": \"John Doe\",\n \"approverUserGuid\": \"abcd1234-5678-9101-1121-314151617181\",\n \"approverUserUserid\": \"jdoe\",\n \"approvedTimestamp\": \"2025-01-01T10:00:00Z\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{LOCAL_API_URL}}/codes/forestRegionCodes",
"host": [
Expand Down Expand Up @@ -763,15 +754,6 @@
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"projectPlanFiscalGuid\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"projectGuid\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"activityCategoryCode\": \"Tactical Planning\",\n \"fiscalYear\": 2024,\n \"projectPlanStatusCode\": \"ACTIVE\",\n \"planFiscalStatusCode\": \"APPROVED\",\n \"projectFiscalName\": \"Forest Restoration\",\n \"projectFiscalDescription\": \"Restoration project for forest lands\",\n \"estimatedClwrrAllocAmount\": 50000.00,\n \"totalCostEstimateAmount\": 120000.00,\n \"fiscalFundingRequestAmount\": 70000.00,\n \"fiscalAllocatedAmount\": 65000.00,\n \"firstNationsDelivPartInd\": true,\n \"firstNationsEngagementInd\": false,\n \"isApprovedInd\": true,\n \"isDelayedInd\": false,\n \"submissionTimestamp\": \"2025-01-01T00:00:00Z\",\n \"approverName\": \"John Doe\",\n \"approverUserGuid\": \"abcd1234-5678-9101-1121-314151617181\",\n \"approverUserUserid\": \"jdoe\",\n \"approvedTimestamp\": \"2025-01-01T10:00:00Z\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{LOCAL_API_URL}}/codes/bcParksRegionCodes",
"host": [
Expand Down Expand Up @@ -833,6 +815,54 @@
},
"response": []
},
{
"name": "GET Project Plan Status Codes",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function() {",
" pm.response.to.have.status(200);",
"})"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{accessToken}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "{{LOCAL_API_URL}}/codes/projectPlanStatusCodes",
"host": [
"{{LOCAL_API_URL}}"
],
"path": [
"codes",
"projectPlanStatusCodes"
]
}
},
"response": []
},
{
"name": "Get ProjectFiscal",
"event": [
Expand Down Expand Up @@ -971,8 +1001,8 @@
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function() {",
" pm.response.to.have.status(200);",
"pm.test(\"Status code is 204\", function() {",
" pm.response.to.have.status(204);",
"})"
],
"type": "text/javascript",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ private CodeTables() {}
public static final String BC_PARKS_REGION_CODE = "bcParksRegionCodes";
public static final String BC_PARKS_SECTION_CODE = "bcParksSectionCodes";
public static final String OBJECTIVE_TYPE_CODE = "objectiveTypeCodes";
public static final String PROJECT_PLAN_STATUS_CODE = "projectPlanStatusCodes";
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public ResponseEntity<CollectionModel<?>> getCodes(@PathVariable("codeTable") St
case CodeTables.BC_PARKS_REGION_CODE -> result = codesService.getAllBCParksRegionCodes();
case CodeTables.BC_PARKS_SECTION_CODE -> result = codesService.getAllBCParksSectionCodes();
case CodeTables.OBJECTIVE_TYPE_CODE -> result = codesService.getAllObjectiveTypeCodes();
case CodeTables.PROJECT_PLAN_STATUS_CODE -> result = codesService.getAllProjectPlanStatusCodes();

default -> {
log.error("Invalid code table: {}", codeTable);
return internalServerError();
Expand Down Expand Up @@ -131,6 +133,7 @@ private CommonModel<?> fetchCodeById(String codeTable, String id) throws Service
case CodeTables.BC_PARKS_REGION_CODE -> codesService.getBCParksRegionCodeById(Integer.parseInt(id));
case CodeTables.BC_PARKS_SECTION_CODE -> codesService.getBCParksSectionCodeById(Integer.parseInt(id));
case CodeTables.OBJECTIVE_TYPE_CODE -> codesService.getObjectiveTypeCodeById(id);
case CodeTables.PROJECT_PLAN_STATUS_CODE -> codesService.getProjectPlanStatusCodeById(id);
default -> null;
};
}
Expand Down
Loading

0 comments on commit fcb3287

Please sign in to comment.