SudoSOS Back-end API / helpers
helpers ​
This is the module page of the ad.
Enumerations ​
| Enumeration | Description |
|---|---|
| OrderingDirection | - |
Classes ​
| Class | Description |
|---|---|
| QueryFilter | - |
| ValidationError | The ValidationError combines itself by simply concatenating the string values. |
Interfaces ​
| Interface | Description |
|---|---|
| FilterMapping | Defines the mapping from properties on the parameter object, to the respective identifiers in queries. |
| FilterParameters | Defines the filtering parameters to which can be mapped. |
| Joinable | To allow for nested errors we need the notation of traversing through errors. The abstraction is that we have a 'Joinable' such that items can be combined. |
| LDAPGroup | - |
| LDAPResponse | - |
| LDAPResult | - |
| LDAPUser | - |
| PaginationParameters | - |
| PaginationResult | - |
| RawUser | - |
| RequestWithRawBody | Extend the Express Request object with a raw body attribute, which is used by Stripe to validate incoming events |
Type Aliases ​
| Type Alias | Description |
|---|---|
| Either | - |
| Fail | - |
| Optional | - |
| Pass | - |
| Specification | - |
| SubSpecification | - |
| ValidationRule | - |
Variables ​
| Variable | Description |
|---|---|
| PAGINATION_DEFAULT | - |
| PAGINATION_MAX | - |
| PDF_GEN_URL | - |
| PDF_VAT_HIGH | - |
| PDF_VAT_LOW | - |
| PDF_VAT_ZERO | - |
| PERSISTENT_TEST_DATABASES | - |
| UNUSED_NUMBER | - |
| UNUSED_PARAM | - |
Functions ​
| Function | Description |
|---|---|
| asArrayOfDates | Converts the input to a list of dates |
| asArrayOfNumbers | Converts the input to a list of numbers |
| asArrayOfUserTypes | Converts the input to a list of UserTypes |
| asBoolean | Converts the input to a boolean |
| asDate | Converts the input to a Date object. |
| asDinero | Converts the input to a Dinero object. |
| asEventType | Converts the input to an EventType |
| asFromAndTillDate | Converts the inputs to a from and till date |
| asInvoiceState | Converts the input to a InvoiceState |
| asNumber | Converts the input to a number. |
| asOrderingDirection | Convert the given input to an OrderingDirection object or undefined if correct. Throw error otherwise |
| asReturnFileType | Converts the input to a ReturnFileType |
| asShiftAvailability | Converts the input to a shift availability |
| asUserType | Converts the input to a UserType |
| asVatDeclarationPeriod | Converts the input to an VatDeclarationPeriod |
| bindUser | Function that takes a valid ADUser response and binds it to a existing User such that the AD user can authenticate as the existing user. |
| collectByKey | Function that collects items based on a given getKey function |
| collectByToId | Function that collects transaction by user ToId |
| collectProductsByCategory | Function that collects transactions by product based on their category id |
| collectProductsByRevision | Function that collects transactions by products based on their revision |
| collectProductsByVat | Function that collects transactions by product based on their Vat group |
| createArrayRule | Turn a specification for an property into a specification for an array of that property. |
| dateToUTC | Change the timezone of the given date to UTC |
| defaultPagination | - |
| emptyIdentity | - |
| entryToProduct | Convert report product entry to product for PDF |
| extractRawBody | Put the raw, unparsed body also in the request object |
| formatTitleDate | Format a date to YYYYMMDD string format for use in PDF filenames and titles |
| getIdsAndRequests | - |
| getLDAPConnection | Makes and bind an LDAP connection. |
| getLDAPSettings | Wrapper for the LDAP environment variables. |
| getPDFTotalsFromReport | Get totals from report |
| hashJSON | Returns the sha256 hash of an object. |
| isDate | Returns whether a given date string is actually a date |
| isFail | - |
| isNumber | Returns whether the given object is a number |
| isPass | - |
| maxPagination | - |
| parseContainerToBaseResponse | - |
| parseFileToResponse | - |
| parseInvoiceUserToResponse | - |
| parsePOSToBasePOS | - |
| parseProductToBaseResponse | - |
| parseRawUserToResponse | Parses a raw User Entity to a UserResponse |
| parseRequestPagination | Extract possible pagination parameters from the request and put them in the take and skip variables. If one of them (or all of them) is not defined, default values are set. |
| parseUserToBaseResponse | Parses a raw user DB object to BaseUserResponse |
| parseUserToResponse | Parses a User DB entity to a UserResponse |
| parseVatGroupToResponse | - |
| productToPdfProduct | - |
| reduceMapToCategoryEntries | Transforms an array of SubTransactionRows with the same product category into TransactionReportCategoryEntries |
| reduceMapToReportEntries | Transforms an array of SubTransactionRows of a single product to TransactionReportEntries |
| reduceMapToVatEntries | Transforms an array of SubTransactionRows with the same VAT group into TransactionReportVatEntries |
| reportPDFhelper | - |
| splitTypes | - |
| subTransactionRowToProduct | - |
| toFail | - |
| toLocalMySQLString | Print the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss), but keep it in the local timezone |
| toMySQLString | Print the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss) |
| toPass | - |
| toResponse | Build a paginated response from a [records, count] tuple. Use this in controllers to wrap service results into the standard paginated response format. |
| toUTCMySQLString | Print the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss), but convert it to UTC |
| transactionMapper | Applies a function to all SubTransactionRows of the given transactions. |
| userFromLDAP | Wrapper for typing the untyped ldap result. |
| userToIdentity | Convert user to identity for PDF |
| userTokenInOrgan | Checks if the given ID is part of the Token Organ List. |
| utcToDate | UTC to date |
| validateRequestPagination | Check whether the possible take and skip query parameters are valid |
| validateSpecification | Function that validates the given param against a specification. |
| vatPercentageToPDFVat | Convert VAT percentage to PDF VAT |