detect and save unscheduled and unlocked incidents

This commit is contained in:
Bilal Catic
2019-06-14 08:05:24 +02:00
parent 07061d3d19
commit 596336c41b
19 changed files with 929 additions and 78 deletions

View File

@@ -4,22 +4,64 @@ const DISABLE_PASSAGE_MODE = 'Disable Passage Mode by Group 2';
const VALID_CSV_HEADERS = ['Date', 'Time', 'User No', 'Name', 'Event'];
const doorLockEvents = {
USER_LOCKED: 'locked',
USER_UNLOCKED: 'unlocked',
};
const doorChargeTypes = {
LEFT_UNLOCKED: 'unlocked',
UNSCHEDULED_USE: 'unscheduled'
const unlockedIncidentLevelsPrices = {
UNLOCKED_0: {
id: 0,
title: 'UNLOCKED_0',
price: parseInt(process.env.UNLOCK_0) || 0
},
UNLOCKED_1: {
id: 1,
title: 'UNLOCKED_1',
price: parseInt(process.env.UNLOCK_1) || 10
},
UNLOCKED_2: {
id: 2,
title: 'UNLOCKED_2',
price: parseInt(process.env.UNLOCK_2) || 20
},
UNLOCKED_3: {
id: 3,
title: 'UNLOCKED_3',
price: parseInt(process.env.UNLOCK_3) || 30
},
UNLOCKED_4: {
id: 4,
title: 'UNLOCKED_4',
price: parseInt(process.env.UNLOCK_4) || 40
},
UNLOCKED_5: {
id: 5,
title: 'UNLOCKED_5',
price: parseInt(process.env.UNLOCK_5) || 50
}
};
const csvParserErrors = {
INVALID_HEADERS: 'Invalid headers',
INVALID_ENTRY_EXPECTED_USER: 'Invalid entry type. Expected user entry type',
INVALID_ENTRY_EXPECTED_PASSAGE_MODE: 'Invalid entry type. Expected enable/disable passage mode following user entry',
UNKNOWN_MEMBER: 'Member is not registered in OfficeRnD system',
GENERIC_ERROR: 'There was error while parsing uploaded file(s)',
};
const officeRnDAPIErrors = {
FAILED_TO_FETCH_MEMBERS: 'Failed to fetch members',
FAILED_TO_FETCH_BOOKINGS: 'Failed to fetch booking reservations'
};
const integrationServiceErrors = {
FAILED_TO_SAVE_BOOKINGS: 'Failed to save booking reservations',
FAILED_TO_SAVE_DOOR_LOCK_ENTRIES: 'Failed to save door lock entries',
FAILED_TO_SAVE_DATA_GENERIC: 'Failed to save data',
};
const incidentType = {
NOT_AN_INCIDENT: 1,
UNLOCKED_INCIDENT: 2,
UNSCHEDULED_INCIDENT: 3,
};
module.exports = {
@@ -30,5 +72,7 @@ module.exports = {
csvParserErrors,
officeRnDAPIErrors,
doorLockEvents,
doorChargeTypes,
unlockedIncidentLevelsPrices,
integrationServiceErrors,
incidentType,
};