Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "lib/validationUtil"

Index

Type aliases

RANGE

RANGE: { max: number; min: number }

Type declaration

  • max: number
  • min: number

Functions

isRANGE

  • isRANGE(toCheck: unknown): toCheck is RANGE
  • Parameters

    • toCheck: unknown

    Returns toCheck is RANGE

validateFieldType

  • validateFieldType(fieldType: FieldType): boolean
  • Validate fieldType:

    • The name has to be a valid mongo key
    • If it is LIST there must be at least 2 options

    Parameters

    Returns boolean

validateForm

  • validateForm(form: Form): boolean
  • Validate form:

    • There must be at least 1 formSpecific
    • There can't be 2 formSpecific with the same name

    Parameters

    Returns boolean

validateFormSpecific

  • Validate formSpecific

    • There can't be 2 fieldtype with the same name
    • If in the markerStyle it is specified the iconFieldType then that FieldType must exist and be "LIST" or "NUMBER"
    • If it is "NUMBER" then iconNumberRanges must be valid

    Parameters

    Returns boolean

validateMail

  • validateMail(mail: string): boolean
  • Validate mail wit regex

    Parameters

    • mail: string

    Returns boolean

validateProject

  • validateProject(project: Project): boolean
  • Validate project:

    • A user can't have assigned a form that is not present in the form list
    • In the project at least a user needs to be admin
    • There can't be 2 user with the same name
    • The name needs to work in s3: /projectName/filename

    Parameters

    Returns boolean

validateRecord

  • Validate record:

    • Latitude, longitude and altitude need to be in range
    • The user must be a project user
    • The form must exist in the project
    • The formSpecific must exist in the form
    • The project name must be correct
    • There can only be allowed media
    • All the form required questions are answered in the record
    • All the answers type are consistent with the FieldType

    Parameters

    Returns boolean

Generated using TypeDoc