Skip to content

SudoSOS Back-end API / helpers

helpers ​

This is the module page of the ad.

Enumerations ​

EnumerationDescription
OrderingDirection-

Classes ​

ClassDescription
QueryFilter-
ValidationErrorThe ValidationError combines itself by simply concatenating the string values.

Interfaces ​

InterfaceDescription
FilterMappingDefines the mapping from properties on the parameter object, to the respective identifiers in queries.
FilterParametersDefines the filtering parameters to which can be mapped.
JoinableTo 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-
RequestWithRawBodyExtend the Express Request object with a raw body attribute, which is used by Stripe to validate incoming events

Type Aliases ​

Type AliasDescription
Either-
Fail-
Optional-
Pass-
Specification-
SubSpecification-
ValidationRule-

Variables ​

VariableDescription
PAGINATION_DEFAULT-
PAGINATION_MAX-
PDF_GEN_URL-
PDF_VAT_HIGH-
PDF_VAT_LOW-
PDF_VAT_ZERO-
PERSISTENT_TEST_DATABASES-
UNUSED_NUMBER-
UNUSED_PARAM-

Functions ​

FunctionDescription
asArrayOfDatesConverts the input to a list of dates
asArrayOfNumbersConverts the input to a list of numbers
asArrayOfUserTypesConverts the input to a list of UserTypes
asBooleanConverts the input to a boolean
asDateConverts the input to a Date object.
asDineroConverts the input to a Dinero object.
asEventTypeConverts the input to an EventType
asFromAndTillDateConverts the inputs to a from and till date
asInvoiceStateConverts the input to a InvoiceState
asNumberConverts the input to a number.
asOrderingDirectionConvert the given input to an OrderingDirection object or undefined if correct. Throw error otherwise
asReturnFileTypeConverts the input to a ReturnFileType
asShiftAvailabilityConverts the input to a shift availability
asUserTypeConverts the input to a UserType
asVatDeclarationPeriodConverts the input to an VatDeclarationPeriod
bindUserFunction that takes a valid ADUser response and binds it to a existing User such that the AD user can authenticate as the existing user.
collectByKeyFunction that collects items based on a given getKey function
collectByToIdFunction that collects transaction by user ToId
collectProductsByCategoryFunction that collects transactions by product based on their category id
collectProductsByRevisionFunction that collects transactions by products based on their revision
collectProductsByVatFunction that collects transactions by product based on their Vat group
createArrayRuleTurn a specification for an property into a specification for an array of that property.
dateToUTCChange the timezone of the given date to UTC
defaultPagination-
emptyIdentity-
entryToProductConvert report product entry to product for PDF
extractRawBodyPut the raw, unparsed body also in the request object
formatTitleDateFormat a date to YYYYMMDD string format for use in PDF filenames and titles
getIdsAndRequests-
getLDAPConnectionMakes and bind an LDAP connection.
getLDAPSettingsWrapper for the LDAP environment variables.
getPDFTotalsFromReportGet totals from report
hashJSONReturns the sha256 hash of an object.
isDateReturns whether a given date string is actually a date
isFail-
isNumberReturns whether the given object is a number
isPass-
maxPagination-
parseContainerToBaseResponse-
parseFileToResponse-
parseInvoiceUserToResponse-
parsePOSToBasePOS-
parseProductToBaseResponse-
parseRawUserToResponseParses a raw User Entity to a UserResponse
parseRequestPaginationExtract 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.
parseUserToBaseResponseParses a raw user DB object to BaseUserResponse
parseUserToResponseParses a User DB entity to a UserResponse
parseVatGroupToResponse-
productToPdfProduct-
reduceMapToCategoryEntriesTransforms an array of SubTransactionRows with the same product category into TransactionReportCategoryEntries
reduceMapToReportEntriesTransforms an array of SubTransactionRows of a single product to TransactionReportEntries
reduceMapToVatEntriesTransforms an array of SubTransactionRows with the same VAT group into TransactionReportVatEntries
reportPDFhelper-
splitTypes-
subTransactionRowToProduct-
toFail-
toLocalMySQLStringPrint the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss), but keep it in the local timezone
toMySQLStringPrint the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss)
toPass-
toResponseBuild a paginated response from a [records, count] tuple. Use this in controllers to wrap service results into the standard paginated response format.
toUTCMySQLStringPrint the date to a string in MySQL format (YYYY-MM-DD mm:hh:ss), but convert it to UTC
transactionMapperApplies a function to all SubTransactionRows of the given transactions.
userFromLDAPWrapper for typing the untyped ldap result.
userToIdentityConvert user to identity for PDF
userTokenInOrganChecks if the given ID is part of the Token Organ List.
utcToDateUTC to date
validateRequestPaginationCheck whether the possible take and skip query parameters are valid
validateSpecificationFunction that validates the given param against a specification.
vatPercentageToPDFVatConvert VAT percentage to PDF VAT