newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit 68f92c41b8 - Show all commits

View File

@ -1,6 +1,6 @@
// statusCodes should be a map, not an object
const statusCodes = {
export const statusCodes = {
400: "data not found",
700: "no authentication attempt",
701: "invalid credentials",
@ -14,5 +14,10 @@ const statusCodes = {
951: "unknown server error",
};
export const msgCodes = new Map <string, string>([
["LOC_NOT_FOUND", "Location not found. If you are sure that the location exists, there may be a fault with the data provider."],
["AUTH_ERR", "Authentication Error"],
])
module.exports = statusCodes;
export { statusCodes };
//export { statusCodes };

View File

@ -7,6 +7,7 @@ const san = require("../utils/sanitizer.utils");
const db = require("../services/dbAccess.services");
import { transform as staffStationTransform } from "../utils/translators/ldb/staffStation";
import { msgCodes } from "../configs/errorCodes.configs";
const ldbKey = process.env.OWL_LDB_KEY;
const ldbsvKey = process.env.OWL_LDB_SVKEY;
@ -29,8 +30,8 @@ async function get(id, staff = false) {
} catch (err) {
log.out(`ldbService.get: Error, Unable to find CRS: ${err}`, "info");
return {
ERROR: "NOT_FOUND",
description: "The entered station was not found.",
obStatus: "LOC_NOT_FOUND",
obMsg: msgCodes.get(this.obStatus),
};
}
}