Add debug endpoint for employee data
This commit is contained in:
parent
245a37aeab
commit
21dcb19ec4
1 changed files with 40 additions and 0 deletions
40
api/admin/debugEmployees.cfm
Normal file
40
api/admin/debugEmployees.cfm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<cfsetting showdebugoutput="false">
|
||||
<cfsetting enablecfoutputonly="true">
|
||||
<cfcontent type="application/json; charset=utf-8" reset="true">
|
||||
|
||||
<cfscript>
|
||||
data = {};
|
||||
try {
|
||||
requestBody = toString(getHttpRequestData().content);
|
||||
if (len(requestBody)) data = deserializeJSON(requestBody);
|
||||
} catch (any e) {}
|
||||
|
||||
businessId = structKeyExists(data, "BusinessID") ? val(data.BusinessID) : 17;
|
||||
|
||||
q = queryExecute("
|
||||
SELECT EmployeeID, UserID, EmployeeStatusID, EmployeeIsActive,
|
||||
CAST(EmployeeIsActive AS UNSIGNED) AS IsActiveInt
|
||||
FROM lt_Users_Businesses_Employees
|
||||
WHERE BusinessID = ?
|
||||
", [{ value: businessId, cfsqltype: "cf_sql_integer" }], { datasource: "payfrit" });
|
||||
|
||||
rows = [];
|
||||
for (r in q) {
|
||||
arrayAppend(rows, {
|
||||
"EmployeeID": r.EmployeeID,
|
||||
"UserID": r.UserID,
|
||||
"StatusID": r.EmployeeStatusID,
|
||||
"RawIsActive": r.EmployeeIsActive,
|
||||
"CastIsActive": r.IsActiveInt,
|
||||
"ValRaw": val(r.EmployeeIsActive),
|
||||
"ValCast": val(r.IsActiveInt),
|
||||
"EqRaw1": r.EmployeeIsActive == 1,
|
||||
"EqCast1": r.IsActiveInt == 1
|
||||
});
|
||||
}
|
||||
|
||||
writeOutput(serializeJSON({
|
||||
"OK": true,
|
||||
"ROWS": rows
|
||||
}));
|
||||
</cfscript>
|
||||
Loading…
Add table
Reference in a new issue