batter error handling, better logging.

This commit is contained in:
Erik Eckert 2023-12-21 10:37:44 -07:00
parent a7129a964b
commit d3b5df2b53
2 changed files with 123 additions and 765 deletions

View File

@ -1,721 +1,47 @@
[ {
{ "data": [
"eventId": "94adcf35-6d15-49fe-bef6-80bcf9d9f535", {
"domain": "mpe", "eventId": "2dd0be51-da5c-4c61-a31b-6db9867ef3ef",
"timestamp": 1702568374871, "domain": "mpe",
"user": { "timestamp": 1703115861131,
"id": 416, "user": {
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325", "id": 467,
"displayName": "Erik Eckert", "clientIdHash": "62f2fc5d-5266-45fe-91a6-80778686a5ec",
"username": "eeckert@mpe", "displayName": "Jay Paras",
"email": "eeckert@mpe.ca", "username": "jparas@mpe",
"impersonatedBy": null "email": "jparas@mpe.ca",
}, "impersonatedBy": "mpeitadmin@mpe"
"actionSource": "EGD_SYNC", },
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248", "actionSource": "SCACHE",
"eventType": "fs:add_folder", "webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"data": { "eventType": "fs:add_folder",
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Design Calculations" "data": {
"targetPath": "/Shared/N-Data/54/43 Vegreville - Town/124 SE 17 Industrial Area/03 On Site Revisions/Autodesk/_Deliverables/00 Working/_Material Report/New folder"
}
} }
} ]
] }
[
{
"eventId": "fb9f9a81-d562-40ba-8382-1e09ade9b65c",
"domain": "mpe",
"timestamp": 1702568376925,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Tender Results"
}
}
]
[
{
"eventId": "4a4c0649-63e6-4a95-906d-bc1669f1b6bf",
"domain": "mpe",
"timestamp": 1702568376316,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Reports/Final Reports"
}
}
]
[
{
"eventId": "d5239467-befd-4b6b-85ed-aaebcb04e910",
"domain": "mpe",
"timestamp": 1702568375058,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Design Calculations/Final"
}
}
]
[
{
"eventId": "6d916860-14ec-49ec-9365-9e18c8ac79ff",
"domain": "mpe",
"timestamp": 1702568376401,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Reports/Preliminary Reports"
}
}
]
[
{
"eventId": "e7ce155c-82d8-4094-9b58-b9c2b2294fc4",
"domain": "mpe",
"timestamp": 1702568375363,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Minutes of Meeting"
}
}
]
[
{
"eventId": "1ee4144a-0a5d-473a-b1ac-72c2c1fb5499",
"domain": "mpe",
"timestamp": 1702568376105,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Quality Assurance/Soil"
}
}
]
[
{
"eventId": "9fab636b-e6f6-4657-af43-f4509afd2fca",
"domain": "mpe",
"timestamp": 1702568375574,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Progress Certificates"
}
}
]
[
{
"eventId": "79651735-424f-44d1-8d98-cbb8f0abb8ae",
"domain": "mpe",
"timestamp": 1702568376506,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Safety"
}
}
]
[
{
"eventId": "55e2d06d-d2ab-4783-b084-aeb84c0f6386",
"domain": "mpe",
"timestamp": 1702568375256,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/ExternalShare"
}
}
]
[
{
"eventId": "b7bc199e-666b-4dc3-b672-81cc64230cb1",
"domain": "mpe",
"timestamp": 1702568376767,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Surveys/Survey Forms"
}
}
]
[
{
"eventId": "0b7d16c7-b1d6-4a2f-8546-a3d4c0f3ef8d",
"domain": "mpe",
"timestamp": 1702568376680,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Surveys"
}
}
]
[
{
"eventId": "d73b7ac1-23ec-4253-974f-d791f775a86a",
"domain": "mpe",
"timestamp": 1702568376598,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Specifications"
}
}
]
[
{
"eventId": "d67f6a1f-baaf-4af3-ac2d-596bfd9e7158",
"domain": "mpe",
"timestamp": 1702568376208,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Reports"
}
}
]
[
{
"eventId": "bd18347f-090d-4338-9cac-92fdb7937246",
"domain": "mpe",
"timestamp": 1702568376847,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Surveys/Uploads"
}
}
]
[
{
"eventId": "c3782d6b-e290-4d97-b0bd-c71cd8d3ed16",
"domain": "mpe",
"timestamp": 1702568375152,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Design Calculations/Preliminary"
}
}
]
[
{
"eventId": "60a75929-4393-4b5e-a650-de29d06026c6",
"domain": "mpe",
"timestamp": 1702568375467,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Photos"
}
}
]
[
{
"eventId": "75fedb64-3877-40c1-b9e5-2b1bedb266b2",
"domain": "mpe",
"timestamp": 1702568375756,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Quality Assurance"
}
}
]
[
{
"eventId": "64927c69-f319-48ba-9842-1d1590a151da",
"domain": "mpe",
"timestamp": 1702568375655,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Proposal"
}
}
]
[
{
"eventId": "a0e4016f-7a50-4b2e-b80d-4c0034939d7a",
"domain": "mpe",
"timestamp": 1702568376000,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Quality Assurance/Concrete"
}
}
]
[
{
"eventId": "117b68eb-645d-43ad-9ade-13aa58b24a2d",
"domain": "mpe",
"timestamp": 1702568375842,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Quality Assurance/Aggregate"
}
}
]
[
{
"eventId": "5aab43bd-e7b0-4068-a905-08dd16e8a5cf",
"domain": "mpe",
"timestamp": 1702568375924,
"user": {
"id": 416,
"clientIdHash": "D988AC0B-7E6F-4831-A1F8-D0CCF3B39325",
"displayName": "Erik Eckert",
"username": "eeckert@mpe",
"email": "eeckert@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD_SYNC",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/MPE_Dev_Testing/Project Setup - Copy - Copy/Quality Assurance/Asphalt"
}
}
]
[ {
{ "data": [
"eventId": "cab5ec4b-4dbb-4c78-a71c-f48e16e157e2", {
"domain": "mpe", "eventId": "2dd0be51-da5c-4c61-a31b-6db9867ef3ef",
"timestamp": 1702576261783, "domain": "mpe",
"user": { "timestamp": 1703115861131,
"id": 172, "user": {
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca", "id": 467,
"displayName": "Barry Anderson", "clientIdHash": "62f2fc5d-5266-45fe-91a6-80778686a5ec",
"username": "banderson@mpe", "displayName": "Jay Paras",
"email": "banderson@mpe.ca", "username": "jparas@mpe",
"impersonatedBy": "mpeitadmin@mpe" "email": "jparas@mpe.ca",
}, "impersonatedBy": "mpeitadmin@mpe"
"actionSource": "SCACHE", },
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248", "actionSource": "SCACHE",
"eventType": "fs:add_folder", "webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"data": { "eventType": "fs:add_folder",
"targetPath": "/Shared/N-Data/43/50 Rocky Mountain House/005-Town_of_Rocky_Mountain_House/03 - Airport Terminal Final design & Construction/Design Calculations/Structural/New folder" "data": {
"sourcePath": "/Shared/N-Data/54/43 Vegreville - Town/124 SE 17 Industrial Area/03 On Site Revisions/Autodesk/_Deliverables/00 Working/_Material Report/New folder1""targetPath": "/Shared/N-Data/54/43 Vegreville - Town/124 SE 17 Industrial Area/03 On Site Revisions/Autodesk/_Deliverables/00 Working/_Material Report/New folder"
}
} }
} ]
] }
[
{
"eventId": "5c7a47a3-59b6-4ce9-a7d9-26a3cd62c3f0",
"domain": "mpe",
"timestamp": 1702576263010,
"user": {
"id": 172,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Barry Anderson",
"username": "banderson@mpe",
"email": "banderson@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/N-Data/43/50 Rocky Mountain House/005-Town_of_Rocky_Mountain_House/03 - Airport Terminal Final design & Construction/Design Calculations/Structural/New folder",
"targetPath": "/Shared/N-Data/43/50 Rocky Mountain House/005-Town_of_Rocky_Mountain_House/03 - Airport Terminal Final design & Construction/Design Calculations/Structural/Markups"
}
}
]
[
{
"eventId": "88f7e822-da67-41e2-b9bc-a1ccff1b2e78",
"domain": "mpe",
"timestamp": 1702576307552,
"user": {
"id": 138,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Kyle Lohrenz",
"username": "klohrenz@mpe",
"email": "klohrenz@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/N-Data/17/14 Alberta Parks/032 Cypress Hills PP - Water Treatment Plant & Lift Stations Upgrade/Reports/Final Reports/WWLS/Cover"
}
}
]
[
{
"eventId": "e118685b-6d75-4318-9e6c-47083cf24665",
"domain": "mpe",
"timestamp": 1702576320849,
"user": {
"id": 150,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Ife Oyedotun",
"username": "ioyedotun@mpe",
"email": "ioyedotun@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/N-Data/73/81 Public Works and Government Services Canada/001 Fire Safety Willow Cree/Specifications/For Tender Update/New folder"
}
}
]
[
{
"eventId": "19e562be-ce66-4739-b434-615af8ce38e7",
"domain": "mpe",
"timestamp": 1702576323830,
"user": {
"id": 150,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Ife Oyedotun",
"username": "ioyedotun@mpe",
"email": "ioyedotun@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/N-Data/73/81 Public Works and Government Services Canada/001 Fire Safety Willow Cree/Specifications/For Tender Update/New folder",
"targetPath": "/Shared/N-Data/73/81 Public Works and Government Services Canada/001 Fire Safety Willow Cree/Specifications/For Tender Update/Archive"
}
}
]
[
{
"eventId": "a12bec08-b9e5-4a85-a9d9-253f20abd3c3",
"domain": "mpe",
"timestamp": 1702576328423,
"user": {
"id": 150,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Ife Oyedotun",
"username": "ioyedotun@mpe",
"email": "ioyedotun@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/N-Data/73/81 Public Works and Government Services Canada/001 Fire Safety Willow Cree/Specifications/For Tender Update/Division 23",
"targetPath": "/Shared/N-Data/73/81 Public Works and Government Services Canada/001 Fire Safety Willow Cree/Specifications/For Tender Update/Archive/Division 23"
}
}
]
[
{
"eventId": "48ff30ac-f647-4ba2-b0c0-c781867f9c4b",
"domain": "mpe",
"timestamp": 1702576925172,
"user": {
"id": 462,
"clientIdHash": "62f2fc5d-5266-45fe-91a6-80778686a5ec",
"displayName": "Sandra Copeland",
"username": "scopeland@mpe",
"email": "scopeland@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/H-Human Resources/Edmonton/Current Employees/LAWRIE_2021_Ken Lawrie_EE#0370/Safety/Driver's Info/New folder"
}
}
]
[
{
"eventId": "db5ffa9d-a4fa-4bdd-b8fb-066c820f5f49",
"domain": "mpe",
"timestamp": 1702576935471,
"user": {
"id": 462,
"clientIdHash": "62f2fc5d-5266-45fe-91a6-80778686a5ec",
"displayName": "Sandra Copeland",
"username": "scopeland@mpe",
"email": "scopeland@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/H-Human Resources/Edmonton/Current Employees/LAWRIE_2021_Ken Lawrie_EE#0370/Safety/Driver's Info/New folder",
"targetPath": "/Shared/H-Human Resources/Edmonton/Current Employees/LAWRIE_2021_Ken Lawrie_EE#0370/Safety/Driver's Info/Expired"
}
}
]
[
{
"eventId": "dff5d5e2-2a6a-4a19-a37f-10336002bc47",
"domain": "mpe",
"timestamp": 1702577087392,
"user": {
"id": 138,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Kyle Lohrenz",
"username": "klohrenz@mpe",
"email": "klohrenz@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/N-Data/17/14 Alberta Parks/032 Cypress Hills PP - Water Treatment Plant & Lift Stations Upgrade/Reports/Final Reports/WWLS/New folder"
}
}
]
[
{
"eventId": "9badf089-1db9-4b5c-becc-e79fe0138b35",
"domain": "mpe",
"timestamp": 1702577088385,
"user": {
"id": 138,
"clientIdHash": "2373989a-c8ee-4876-842e-cf55b94151ca",
"displayName": "Kyle Lohrenz",
"username": "klohrenz@mpe",
"email": "klohrenz@mpe.ca",
"impersonatedBy": "mpeitadmin@mpe"
},
"actionSource": "SCACHE",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/N-Data/17/14 Alberta Parks/032 Cypress Hills PP - Water Treatment Plant & Lift Stations Upgrade/Reports/Final Reports/WWLS/New folder",
"targetPath": "/Shared/N-Data/17/14 Alberta Parks/032 Cypress Hills PP - Water Treatment Plant & Lift Stations Upgrade/Reports/Final Reports/WWLS/Appendix A"
}
}
]
[
{
"eventId": "cb1105a6-3d6f-417c-be4a-b5339fff57ab",
"domain": "mpe",
"timestamp": 1702577232541,
"user": {
"id": 622,
"clientIdHash": "8E265BB8-F490-4601-B994-9C1E0D0993D1",
"displayName": "Ben Ong",
"username": "bong@mpe",
"email": "bong@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:add_folder",
"data": {
"targetPath": "/Shared/N-Data/22/25 Mountain View County/002 Twp Rd 292 and 2023 Long Patching/Progress Certificates/New folder"
}
}
]
[
{
"eventId": "0b51d81b-c4f9-40ed-bfe3-70e680c06d5b",
"domain": "mpe",
"timestamp": 1702577242307,
"user": {
"id": 622,
"clientIdHash": "8E265BB8-F490-4601-B994-9C1E0D0993D1",
"displayName": "Ben Ong",
"username": "bong@mpe",
"email": "bong@mpe.ca",
"impersonatedBy": null
},
"actionSource": "EGD",
"webhookId": "b2944d04-5b9d-4b76-9639-904d772c5248",
"eventType": "fs:move_folder",
"data": {
"sourcePath": "/Shared/N-Data/22/25 Mountain View County/002 Twp Rd 292 and 2023 Long Patching/Progress Certificates/New folder",
"targetPath": "/Shared/N-Data/22/25 Mountain View County/002 Twp Rd 292 and 2023 Long Patching/Progress Certificates/PC4(HB)"
}
}
]

View File

@ -14,20 +14,20 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
func MPE_IsProject(input map[string]json.RawMessage) (projectnumber string, project_name string) { func MPE_IsProject(input *Payload) (projectnumber string, project_name string) {
// this will attempt to extract a project number from the "targetpath" element. If it's able to determine a folder contains a project number, we'll return it. // this will attempt to extract a project number from the "targetpath" element. If it's able to determine a folder contains a project number, we'll return it.
var path_data map[string]json.RawMessage // var path_data map[string]json.RawMessage
project_regex, _ := regexp.Compile(`(^[0-9]{1,3})`) // regex to match against project_regex, _ := regexp.Compile(`(^[0-9]{1,3})`) // regex to match against
err := json.Unmarshal((input["data"]), &path_data) // err := json.Unmarshal((input.Data), &path_data)
if err != nil { // if err != nil {
log.Fatal(err) // log.Fatal(err)
fmt.Println("oops") // fmt.Println("oops")
return // return
} // }
path := string(path_data["targetPath"]) path := string(input.Data[0].PathData.TargetPath)
split_path, _ := filepath.Split(path) split_path, _ := filepath.Split(path)
split_path = filepath.Clean(split_path) split_path = filepath.Clean(split_path)
@ -93,21 +93,21 @@ func MPE_IsProject(input map[string]json.RawMessage) (projectnumber string, proj
return return
} }
func MPE_ValidateForward(in map[string]json.RawMessage) bool { func MPE_ValidateForward(in *Payload) bool {
// decode targetPath data. Will return TRUE if the last section of the path contains "External Share" or "ExternalShare". This would indicate that we SHOULD forward this request onward. // decode targetPath data. Will return TRUE if the last section of the path contains "External Share" or "ExternalShare". This would indicate that we SHOULD forward this request onward.
var path_data map[string]json.RawMessage // var path_data map[string]json.RawMessage
err := json.Unmarshal((in["data"]), &path_data) // err := json.Unmarshal((in.Data), &path_data)
if err != nil { // if err != nil {
log.Fatal(err) // log.Fatal(err)
fmt.Println("oops") // fmt.Println("oops")
return false // return false
} // }
path := string(path_data["targetPath"]) path := string(in.Data[0].PathData.TargetPath)
split_path, last := filepath.Split(path) split_path, last := filepath.Split(path)
split_path = filepath.Clean(split_path) split_path = filepath.Clean(split_path)
matched, err := regexp.MatchString(`ExternalShare|External Share`, last) matched, _ := regexp.MatchString(`ExternalShare|External Share`, last)
return matched return matched
} }
@ -115,21 +115,38 @@ func MPE_ValidateForward(in map[string]json.RawMessage) bool {
func readDataStream(resp http.ResponseWriter, request *http.Request) { func readDataStream(resp http.ResponseWriter, request *http.Request) {
// reqBody, _ := io.ReadAll(request.Body) // reqBody, _ := io.ReadAll(request.Body)
body_string, _ := io.ReadAll(request.Body) body_string, _ := io.ReadAll(request.Body)
fmt.Println(string(body_string)) // debug code to show JASON data coming in // fmt.Println(string(body_string)) // debug code to show JASON data coming in
var request_body map[string]json.RawMessage var request_body Payload
err := json.Unmarshal(body_string, &request_body) err := json.Unmarshal(body_string, &request_body)
if err != nil { if err != nil {
log.Fatal(err) var error_sb strings.Builder
fmt.Println("oops") error_sb.WriteString("ERROR in JSON\n")
error_sb.WriteString(string(body_string))
error_sb.WriteString("\n--Error from Unmarshal: ")
error_sb.WriteString(err.Error())
fmt.Print(error_sb.String())
resp.WriteHeader(http.StatusBadRequest)
resp.Write([]byte(error_sb.String()))
return return
} }
var MPE_ShouldFoward = MPE_ValidateForward(request_body) var MPE_ShouldFoward = MPE_ValidateForward(&request_body)
var MPE_ProjectNumber, MPE_ProjectName = MPE_IsProject(request_body) var MPE_ProjectNumber, MPE_ProjectName = MPE_IsProject(&request_body)
// Collect EventID, JSON Content, and return values into data object to be logged to screen. Validate data visually for a bit against "live" webhook data.
var log_values log_data
log_values.EventID = request_body.Data[0].EventID
log_values.EventType = request_body.Data[0].EventType
log_values.User = request_body.Data[0].User.DisplayName
log_values.TargetPath = request_body.Data[0].PathData.TargetPath
log_values.ExternalShare = MPE_ShouldFoward
log_values.MPE_ProjectName = MPE_ProjectName
log_values.MPE_ProjectNumber = MPE_ProjectNumber
fmt.Printf("%+v\n", log_values) // output log values to stdout
// TODO: Fix - json: cannot unmarshal array into Go value of type map[string]json.RawMessage error.
// TODO: Collect EventID, JSON Content, and return values into data object to be logged to screen. Validate data visually for a bit against "live" webhook data.
fmt.Println(MPE_ShouldFoward, MPE_ProjectNumber, MPE_ProjectName)
// TODO: Once Data validation / Struct is built, pass data off to next Webhook URL for processing. // TODO: Once Data validation / Struct is built, pass data off to next Webhook URL for processing.
} }
@ -170,23 +187,38 @@ func main() {
handleRequests() handleRequests()
} }
type send_data struct { type Payload struct {
EventID string `json:"eventId"` Data []EG_Data `json:"data"`
Domain string `json:"domain"` }
Timestamp int64 `json:"timestamp"` type User struct {
User struct { ID int `json:"id"`
ID int `json:"id"` ClientIDHash string `json:"clientIdHash"`
ClientIDHash string `json:"clientIdHash"` DisplayName string `json:"displayName"`
DisplayName string `json:"displayName"` Username string `json:"username"`
Username string `json:"username"` Email string `json:"email"`
Email string `json:"email"` ImpersonatedBy string `json:"impersonatedBy"`
ImpersonatedBy interface{} `json:"impersonatedBy"` }
} `json:"user"` type PathData struct {
ActionSource string `json:"actionSource"` SourcePath string `json:"sourcePath"`
WebhookID string `json:"webhookId"` TargetPath string `json:"targetPath"`
EventType string `json:"eventType"` }
Data struct { type EG_Data struct {
SourcePath string `json:"sourcePath"` EventID string `json:"eventId"`
TargetPath string `json:"targetPath"` Domain string `json:"domain"`
} `json:"data"` Timestamp int64 `json:"timestamp"`
User User `json:"user"`
ActionSource string `json:"actionSource"`
WebhookID string `json:"webhookId"`
EventType string `json:"eventType"`
PathData PathData `json:"data"`
}
type log_data struct {
EventID string
User string
EventType string
TargetPath string
ExternalShare bool
MPE_ProjectNumber string
MPE_ProjectName string
} }