pre cutover push

This commit is contained in:
Infineon\StieberD
2024-09-04 20:33:41 -07:00
parent 6ea6969f4b
commit 7762b129af
2072 changed files with 130000 additions and 95295 deletions

View File

@ -42,8 +42,17 @@ $insert APP_INSERTS
$insert API_SETUP
$insert HTTP_INSERTS
Declare Function Report_Services, Oi_Wizard_Services
Declare subroutine Report_Services
Declare Function Report_Services, Oi_Wizard_Services, Logging_Services, Environment_Services
Declare subroutine Report_Services, Logging_Services
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\API\Reports'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Performance Reports.csv'
Headers = 'Logging DTM' : @FM : 'ReportId' : @FM : 'From IP Address' : @FM : 'RequestURL' : @FM : 'Status Code' : @FM : 'Message'
objReportLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
RequesterIPAddr = HTTP_Services('GetHTTPRemoteAddr')
GoToAPI else
// The specific resource endpoint doesn't have a API handler yet.
@ -104,15 +113,26 @@ end api
CreateHALItem:
ReportID = EndpointSegment
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ReportID
LogData<3> = RequesterIPAddr
LogData<4> = FullEndpointURL
LogData<5> = ''
LogData<6> = 'Request Received'
Logging_Services('AppendLog', objReportLog, LogData, @RM, @FM)
Begin Case
Case ReportID = 'makeupinventory'
RepJSON = Report_Services('GetMakeupInventoryReportJSON')
Case ReportID = 'materialtrack'
RepJSON = Report_Services('GetMaterialTrackJSONNew')
RepJSON = Report_Services('GetMaterialTrackJSON')
Case ReportID = 'dailyperformance'
ReportDate = Http_Services('GetQueryField', 'reportDate')
RepJSON = Report_Services('GetDailyPerformanceDataJSON', ReportDate)
Case ReportID = 'DailyReactorUptime'
ReportStartDtm = Http_Services('GetQueryField', 'StartDate')
ReportEndDtm = Http_Services('GetQueryField', 'EndDate')
RepJSON = Report_Services('GetDailyReactorUptimeDataJSON', ReportStartDtm, ReportEndDtm)
Case Otherwise$
Error_Services('Add', 'Unsupported report')
End Case
@ -122,12 +142,36 @@ CreateHALItem:
HTTP_Services('SetResponseBody', RepJSON, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', StatusCode, Message)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ReportID
LogData<3> = RequesterIPAddr
LogData<4> = FullEndpointURL
LogData<5> = StatusCode
LogData<6> = Message
Logging_Services('AppendLog', objReportLog, LogData, @RM, @FM)
end else
HTTP_Services('SetResponseStatus', StatusCode)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ReportID
LogData<3> = RequesterIPAddr
LogData<4> = FullEndpointURL
LogData<5> = StatusCode
LogData<6> = 'Success'
Logging_Services('AppendLog', objReportLog, LogData, @RM, @FM)
end
end else
Message = Error_Services('GetMessage')
HTTP_Services('SetResponseStatus', 500, 'Error in the ' : CurrentAPI : ' API. Message: ': Message)
Message = Error_Services('GetMessage')
HTTP_Services('SetResponseStatus', 500, 'Error in the ' : CurrentAPI : ' API Running ':ReportID:'. Message: ': Message)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ReportID
LogData<3> = RequesterIPAddr
LogData<4> = FullEndpointURL
LogData<5> = 500
LogData<6> = Message
Logging_Services('AppendLog', objReportLog, LogData, @RM, @FM)
end
return
@ -139,7 +183,6 @@ return
// Updates a HAL+JSON object based on the OpenInsight data row representation of the data.
//----------------------------------------------------------------------------------------------------------------------
UpdateHALItem:
ReportID = EndpointSegment
Begin Case
@ -174,5 +217,11 @@ UpdateHALItem:
return
API reports.HEAD
API reports.GET
HTTP_Resource_Services('LoremIpsum')
end api