952 days continuous production uptime, 40k+ tp/s single node. Original corpo Bitbucket history not included — clean archive commit.
287 lines
12 KiB
PHP
287 lines
12 KiB
PHP
<?php
|
|
/**
|
|
* cacheMaps.php
|
|
*
|
|
* this file defines the cache map constants for the framework.
|
|
*
|
|
* The general intent is that cached data is directly accessible to clients and, as such, has the potential to
|
|
* expose table schema. So, the purpose of the cache map is to obfuscate the original schema, either through
|
|
* omission or by changing the column name of the field.
|
|
*
|
|
* Fields have the general format of:
|
|
*
|
|
* {name}_{table_ext}
|
|
*
|
|
* The {name} is the "natural" name of the column.
|
|
*
|
|
* The table_ext is an under-bar (_) followed by a three letter, unique to the db, identifier specific to the table.
|
|
* This three letter identifier is also appended to every column name within the table so as to identify field sources
|
|
* in queries where identical names are in play, such as "id" or "token".
|
|
*
|
|
* Cache constants identify themselves as the following:
|
|
*
|
|
* CM_{table ext}_{name}
|
|
*
|
|
* Where CM implies "cache map" and {name} is the (possibly) new name of the field.
|
|
*
|
|
* ex:
|
|
* ---
|
|
* The user table/collection has a field called salt. We want to cache the field but not necessarily broadcast that
|
|
* the name of the field in our user (_usr) collection is "salt". We use the short-string "CM", short for "Cache-Map",
|
|
* as an identifier specific to, and reserved for, this purpose.
|
|
*
|
|
* So, "salt_usr" cache-mapped to "seedKey" making the constant declaration look like:
|
|
*
|
|
* const CM_USR_SALT = 'seedKey'
|
|
*
|
|
* This way, when reading the code, we can identify the constant as a cache-mapped constant, the table in which
|
|
* the filed appears, and the literal name of the column being mapped.
|
|
*
|
|
* Generally, some tables may have both an integer primary key (id) and a string unique index (guid). You should
|
|
* never expose the ID when you have a GUID value... Remember: GUIDs externally, IDs internally.
|
|
*
|
|
* One last note - when mapping a record for caching, if a field is omitted from the cachemap for a class, then when
|
|
* Namaste is building the cache of data for the class, any field not listed in the cachemap will not be cached. This
|
|
* is the windy way of saying that there's not a 1:1 relationship between a class' field list and a cache map structure.
|
|
*
|
|
*
|
|
* @author mike@givingassistant.org
|
|
* @version 1.0
|
|
*
|
|
* HISTORY:
|
|
* ========
|
|
* 06-30-17 mks original coding
|
|
* 02-03-19 mks DB-147: added session and standard constants
|
|
*
|
|
*/
|
|
|
|
// standard fields in every collection
|
|
const CM_DATE_CREATED = 'dateCreated';
|
|
const CM_DATA_CLOSED = 'dateClosed';
|
|
const CM_DATE_ACCESSED = 'dateLastAccessed';
|
|
const CM_EVENT_GUID = 'eventGuid';
|
|
const CM_TOKEN = 'key';
|
|
const CM_STATUS = 'status';
|
|
|
|
// test table cachemap
|
|
const CM_TST_TOKEN = 'key';
|
|
const CM_TST_EVENT_GUID = 'eventGuid';
|
|
const CM_TST_FIELD_TEST_STRING = 'strVal';
|
|
const CM_TST_FIELD_TEST_DOUBLE = 'doubleVal';
|
|
const CM_TST_FIELD_TEST_INT = 'intVal';
|
|
const CM_TST_FIELD_TEST_NIF = 'foobar';
|
|
const CM_TST_FIELD_TEST_BOOL = 'boolVal';
|
|
const CM_TST_FIELD_TEST_OBJ = 'objVal';
|
|
const CM_TST_FIELD_TEST_ARY = 'aryVal';
|
|
const CM_TST_FIELD_TEST_SUBC = 'subCField';
|
|
const CM_TST_FIELD_TEST_CDATE = 'dateCreated';
|
|
const CM_TST_FIELD_TEST_ADATE = 'dateAccessed';
|
|
const CM_TST_FIELD_TEST_STATUS = 'recStatus';
|
|
|
|
// mongo-collection: sessions
|
|
const CM_SESSION_EXPIRES = 'sessionExpires';
|
|
const CM_SESSION_DURATION = 'sessionLength';
|
|
const CM_SESSION_UID = 'sessionUserId';
|
|
const CM_SESSION_LEVEL = 'sessionLevel';
|
|
const CM_SESSION_CUSTOM_KEY = 'sessionKey';
|
|
const CM_SESSION_CUSTOM_VAL = 'sessionValue';
|
|
const CM_SESSION_CW = 'createdWith';
|
|
const CM_SESSION_ACTION = 'action';
|
|
const CM_SESSION_AP = 'authProvider';
|
|
|
|
// mongo-collection: users
|
|
const CM_USER_ACCOUNT = 'accountID';
|
|
const CM_USER_API_DATA = 'apiData';
|
|
const CM_USER_PASS_KEY = 'passwordKey';
|
|
const CM_USER_EMAIL_VALIDATED = 'emailIsValidated';
|
|
const CM_USER_FB_KEY = 'fbKey';
|
|
const CM_USER_HUMAN_VALIDATED = 'humanValidated';
|
|
const CM_USER_MEMBER_PLAN = 'memberPlan';
|
|
const CM_USER_NOTES = 'comments';
|
|
const CM_USER_PASSWORD = 'userPassword';
|
|
const CM_USER_PROMO_ID = 'promoId';
|
|
const CM_USER_TEMPORARY_PWD = 'temporaryPass';
|
|
const CM_USER_TIMEZONE = 'userTZ';
|
|
const CM_USER_LEAP_CONVERTED = 'userLeapConverted';
|
|
const CM_USER_NAME = 'userName';
|
|
const CM_USER_ALT_EMAIL = 'altEmailAddress';
|
|
const CM_USER_WEBHOOK_ATTEMPTS = 'webhookAttempts';
|
|
const CM_USER_TYPE = 'userType';
|
|
const CM_USER_FINANCIALS = 'userFinancials'; // sub-collection heading
|
|
const CM_USER_FINANCIALS_DONATIONS = 'donationsTotal';
|
|
const CM_USER_FINANCIALS_EARNINGS = 'earningsTotal';
|
|
const CM_USER_FINANCIALS_CB_BANK = 'cbBank';
|
|
const CM_USER_FINANCIALS_CB_DONATIONS = 'cbDonations';
|
|
const CM_USER_FINANCIALS_CURR_BAL = 'curBalance';
|
|
const CM_USER_FINANCIALS_EARNING_TIER = 'earningTier';
|
|
const CM_USER_FINANCIALS_PAYMENTS = 'payments'; // sub-collection heading
|
|
const CM_USER_FINANCIALS_PAYMENTS_ADDR1 = 'paymentsAddr1';
|
|
const CM_USER_FINANCIALS_PAYMENTS_ADDR2 = 'paymentAddr2';
|
|
const CM_USER_FINANCIALS_PAYMENTS_CITY = 'paymentCity';
|
|
const CM_USER_FINANCIALS_PAYMENTS_COUNTRY = 'paymentCountry';
|
|
const CM_USER_FINANCIALS_PAYMENTS_FNAME = 'paymentFName';
|
|
const CM_USER_FINANCIALS_PAYMENTS_PLAN = 'paymentPlan';
|
|
const CM_USER_FINANCIALS_PAYMENTS_STATE = 'paymentState';
|
|
const CM_USER_FINANCIALS_PAYMENTS_STATUS = 'paymentStatus';
|
|
const CM_USER_FINANCIALS_PAYMENTS_ZIP = 'paymentsZip';
|
|
const CM_USER_FINANCIALS_PAYMENTS_VALIDATED = 'paymentValidated';
|
|
const CM_USER_FINANCIALS_PAYMENTS_METADATA = 'paymentMetaData';
|
|
const CM_USER_FINANCIALS_PAYMENTS_TYPE = 'paymentType';
|
|
const CM_USER_FINANCIALS_PENDING_BALANCE = 'pendingBalance';
|
|
const CM_USER_FINANCIALS_CUSTOMER_ID = 'customerID';
|
|
const CM_USER_FINANCIALS_STRIPE_VERIFIED = 'stripeVerified';
|
|
const CM_USER_FINANCIALS_TIN_IDENTIFIER = 'tinIdentifier';
|
|
const CM_USER_FINANCIALS_TIN_TYPE = 'tinType';
|
|
const CM_USER_SPORTS = 'userSports'; // sub-collection heading
|
|
const CM_USER_SPORTS_FAVE_ATHLETES = 'faveAthletes';
|
|
const CM_USER_SPORTS_FAVE_TEAMS = 'faveTeams';
|
|
const CM_USER_SPORTS_FAVE_SPORTS = 'faveSports';
|
|
const CM_USER_CHARITIES = 'charities'; // sub-collection heading
|
|
const CM_USER_CHARITIES_SEL_CAMPAIGN = 'selectedCampaign';
|
|
const CM_USER_CHARITIES_SEL_CAMPAIGN_META = 'selectedMetaData';
|
|
const CM_USER_CHARITIES_SEL_CAMPAIGN_TITLE = 'selectedCampaignTitle';
|
|
const CM_USER_REFERRALS = 'referrals'; // sub-collection heading
|
|
const CM_USER_REFERRALS_EARNINGS = 'referralEarnings';
|
|
const CM_USER_REFERRALS_CLICKS = 'referralClicks';
|
|
const CM_USER_REFERRALS_PENDING_EARNINGS = 'pendingEarnings';
|
|
const CM_USER_REFERRALS_SIGNUPS = 'referralSignups';
|
|
const CM_USER_REFERRALS_ID = 'referralsID';
|
|
const CM_USER_PII = 'personalInformation'; // sub-collection heading
|
|
const CM_USER_PII_ADDR = 'userAddress';
|
|
const CM_USER_PII_AGE_RANGE = 'userAgeRange';
|
|
const CM_USER_PII_DOB = 'userBirthday';
|
|
const CM_USER_PII_COUNTRY_CODE = 'userCC';
|
|
const CM_USER_PII_EMAIL = 'userEmail';
|
|
const CM_USER_PII_ALT_EMAIL = 'altUserEmail';
|
|
const CM_USER_PII_FNAME = 'userFName';
|
|
const CM_USER_PII_GENDER = 'userGender';
|
|
const CM_USER_PII_HOMETOWN = 'userHometown';
|
|
const CM_USER_PII_LANGUAGES = 'userLanguages';
|
|
const CM_USER_PII_LNAME = 'userLname';
|
|
const CM_USER_PII_LEGAL_NAME = 'userLegalName';
|
|
const CM_USER_PII_LOCALE = 'userLocale';
|
|
const CM_USER_PII_LOCATION = 'userLocation';
|
|
|
|
// mongo-collection: Consolidated Sanctions List
|
|
const CM_CSL_ADDR = 'addr';
|
|
const CM_CSL_ADDR1 = 'addr1';
|
|
const CM_CSL_ADDR2 = 'addr2';
|
|
const CM_CSL_ADDR3 = 'addr3';
|
|
const CM_CSL_ADDR_LIST = 'addrList';
|
|
const CM_CSL_AKA = 'alsoKnownAs';
|
|
const CM_CSL_AKA_LIST = 'alsoKnownAsList';
|
|
const CM_CSL_CAT = 'cat';
|
|
const CM_CSL_CITIZENSHIP = 'citizenship';
|
|
const CM_CSL_CITIZENSHIP_LIST = 'citizenshipList';
|
|
const CM_CSL_CITY = 'city';
|
|
const CM_CSL_COUNTRY = 'country';
|
|
const CM_CSL_DOB = 'dob';
|
|
const CM_CSL_DOB_LIST = 'dobList';
|
|
const CM_CSL_FIRST_NAME = 'fName';
|
|
const CM_CSL_LAST_NAME = 'lName';
|
|
const CM_CSL_ID = 'id';
|
|
const CM_CSL_ID_COUNTRY = 'idCountry';
|
|
const CM_CSL_ID_LIST = 'idList';
|
|
const CM_CSL_ID_NUM = 'idNum';
|
|
const CM_CSL_ID_TYPE = 'idType';
|
|
const CM_CSL_MAIN_ENTRY = 'mainEntry';
|
|
const CM_CSL_POB = 'pob';
|
|
const CM_CSL_POB_LIST = 'pobList';
|
|
const CM_CSL_POST_CODE = 'postCode';
|
|
const CM_CSL_PRG = 'prg';
|
|
const CM_CSL_PRG_LIST = 'prgList';
|
|
const CM_CSL_REM = 'remarks';
|
|
const CM_CSL_STATE_OR_PROVINCE = 'StateOrProvince';
|
|
const CM_CSL_TYPE = 'type';
|
|
const CM_CSL_UID = 'uid';
|
|
const CM_CSL_SDN_TYPE = 'entityType';
|
|
|
|
// mongo-collection: donors
|
|
const CM_DONORS_TC = 'transactionCount;';
|
|
const CM_DONORS_DTCC = 'donationsToCurrentCause';
|
|
const CM_DONORS_TD = 'totalDonations';
|
|
const CM_DONORS_SDWC = 'shareDataWithCause';
|
|
const CM_DONORS_CID = 'cid';
|
|
const CM_DONORS_CT = 'causeTitle';
|
|
const CM_DONORS_FI = 'foreignId';
|
|
|
|
// mongo-collection: wblist
|
|
const CM_WBL_TYPE = 'listType';
|
|
const CM_WBL_EMAIL = 'listEmail';
|
|
const CM_WBL_ALT_EMAIL = 'listAltEmail';
|
|
const CM_WBL_ADDED_BY = 'listAddedBy';
|
|
const CM_WBL_NOTES = 'listNotes';
|
|
|
|
|
|
// mongo-collection: transactions (these values are determined by Priceline)
|
|
const CM_TRANSACTIONS_CREATED_AT = '_created_at';
|
|
const CM_TRANSACTIONS_UPDATED_AT = '_updated_at';
|
|
const CM_TRANSACTIONS_ORDER_ID = 'orderId';
|
|
const CM_TRANSACTIONS_TYPE = 'type';
|
|
const CM_TRANSACTIONS_DESCRIPTION = 'description';
|
|
const CM_TRANSACTIONS_AMOUNT = 'amount';
|
|
const CM_TRANSACTIONS_EVENT_DATE = 'eventDate';
|
|
const CM_TRANSACTIONS_START_DATE = 'startDate';
|
|
const CM_TRANSACTIONS_END_DATE = 'endDate';
|
|
const CM_TRANSACTIONS_META_DATA = 'metadata';
|
|
const CM_TRANSACTIONS_MD_TRAVEL_END_DATE = 'travelEndDate';
|
|
const CM_TRANSACTIONS_MD_PARTNER = 'partner';
|
|
const CM_TRANSACTIONS_MD_PRODUCT_ID = 'productId';
|
|
const CM_TRANSACTIONS_MD_TRAVEL_START_DATE = 'travelStartDate';
|
|
const CM_TRANSACTIONS_MD_CUSTOMER_ID = 'custId';
|
|
const CM_TRANSACTIONS_MD_OFFER_NUM = 'offerNum';
|
|
const CM_TRANSACTIONS_MD_ENV = 'env';
|
|
const CM_TRANSACTIONS_DEST_CITY_NAME = 'destCityName';
|
|
const CM_TRANSACTIONS_DEST_STATE_CODE = 'destStateCode';
|
|
const CM_TRANSACTIONS_DEST_COUNTRY_CODE = 'destCountryCode';
|
|
const CM_TRANSACTIONS_DONOR_ID = '_donor_id';
|
|
const CM_TRANSACTIONS_CID = 'cid';
|
|
const CM_TRANSACTIONS_CAUSE_TITLE = 'causeTitle';
|
|
|
|
// mongo-collection: SMAXAPI
|
|
const CM_SMAX_COMPANY_NAME = 'name_of_company';
|
|
const CM_SMAX_COMPANY_CONTACT_INFO = 'contact_info';
|
|
const CM_SMAX_COMPANY_ADDR1 = 'address_line_1';
|
|
const CM_SMAX_COMPANY_ADDR2 = 'address_line_2';
|
|
const CM_SMAX_COMPANY_CITY = 'city';
|
|
const CM_SMAX_COMPANY_STATE = 'state';
|
|
const CM_SMAX_COMPANY_ZIP = 'zip';
|
|
const CM_SMAX_COMPANY_VOICE = 'company_voice_phone_number';
|
|
const CM_SMAX_COMPANY_FAX = 'company_fax_phone_number';
|
|
const CM_SMAX_CONTACTS = 'company_contacts';
|
|
const CM_SMAX_CONTACT_NAME = 'employee_name';
|
|
const CM_SMAX_CONTACT_EMAIL = 'employee_email';
|
|
const CM_SMAX_CONTACT_PHONES = 'employee_phones';
|
|
const CM_SMAX_CONTACT_VOICE = 'employee_voice_phone_number';
|
|
const CM_SMAX_CONTACT_FAX = 'employee_fax_phone_number';
|
|
const CM_SMAX_AUTH_BY = 'givva_employee_name';
|
|
const CM_SMAX_NOTES = 'internal_notes';
|
|
const CM_SMAX_ACCOUNT_TYPE = 'account_type';
|
|
const CM_SMAX_TLTI = 'tlti';
|
|
|
|
// mongo-collection: product-registrations
|
|
const CM_PRG_TYPE = 'type';
|
|
const CM_PRG_IID = 'installID';
|
|
const CM_PRG_EAV = 'extensionAddonVersion';
|
|
const CM_PRG_PLATFORM = 'platform';
|
|
const CM_PRG_BROWSER = 'browser';
|
|
const CM_PRG_MAJ_VER = 'majorVersion';
|
|
const CM_PRG_MIN_VER = 'minorVersion';
|
|
const CM_PRG_IS_MOBILE = 'isMobile';
|
|
const CM_PRG_IS_TABLET = 'isTablet';
|
|
const CM_PRG_FIRST_SEEN = 'firstSeen';
|
|
const CM_PRG_LAST_SEEN = 'lastSeen';
|
|
|
|
// mongo collection: product-sessions
|
|
const CM_PSE_IID = 'installID';
|
|
const CM_PSE_SID = 'sessionID';
|
|
const CM_PSE_IP = 'sessionIP';
|
|
const CM_PSE_FIRST_SEEN = 'firstSeen';
|
|
const CM_PSE_LAST_SEEN = 'lastSeen';
|
|
|
|
// mongo collection: product-session-users
|
|
const CM_PSU_UID = 'userID';
|
|
const CM_PSU_SID = 'sessionID';
|
|
const CM_PSU_FIRST_SEEN = 'firstSeen';
|
|
const CM_PSU_LAST_SEEN = 'lastSeen';
|