Skip to content

Validierung aller Entities (Vom alten Backend kopieren) #2553

Description

@BacLuc

I merged the existing Validations/InputFilters with the ones from the old backend and added the once i thought would be helpful.
(Maybe some parts are not up to date, i finished it at commit 05edfbf).
If you have time, grab an entity, copy the validations to a separate issue, add the validations and the tests for it and we are happy to see your PR.

ColumnLayout.php

  • JSON Schema von Columns
  • Columns müssen zusammen eine breite von 12 haben
  • Keine orphan children

MaterialNode.php

Done (Zusätzliche Property von Contentnode kann nicht gepatched werden)

MultiSelect.php

Done (Zusätzliche Property von Contentnode kann nicht gepatched werden)

MultiSelectOption.php

SingleText.php

  • CleanHtml

Storyboard.php

Done (Zusätzliche Property von Contentnode kann nicht gepatched werden)

StoryboardSection.php

AbstractContentNodeOwner.php

Done

Activity.php

Entity

  • At least one scheduleEntry must remain, or delete the activity when the last scheduleentry is deleted (else it might be difficult to delete the activity) Api entity validations #2903
    Properties
  • When creating an Activity, at least one ScheduleEntry must be present
  • Category must not be null
  • Camp must not be null
  • Title Api entity validations #2903
    • Length >0 and length <= 32
    • no cleanhtml
    • trim
  • Location Api entity validations #2903
    • Length >0 (Default is empty string) and length <= 64
    • no cleanhtml
    • trim

ActivityResponsible.php

Done

BaseEntity.php

#2903

  • Id is not writable (one tests with a random entity
  • createTime is not writable
  • updateTime is not writable

Camp.php

Entity

Properties

  • isPrototype not writable (maybe for people with extended privileges)
  • name
    • Length >0 and length <= 32
    • no cleanhtml
    • trim
  • title
    • Length >0 and length <= 32
    • no cleanhtml
    • trim
  • motto
    • length <= 128
    • no cleanhtml
    • trim
  • addressName
    • length <= 128
    • no cleanhtml
    • trim
  • addressStreet
    • length <= 128
    • no cleanhtml
    • trim
  • addressZipcode
    • length <= 128
    • no cleanhtml
    • trim
  • addressCity
    • length <= 128
    • no cleanhtml
    • trim

CampCollaboration.php

Entity

Category.php

Entity

ContentNode.php

Properties

ContentType.php

  • Create, update and delete is not possible

Day.php

  • Create, update and delete is not possible

DayResponsible.php

** Done **

MaterialItem.php

  • materialList belongs to same camp
  • period
    • belongs to same camp
    • either is null (period and materialNode)
  • materialNode
    • belongs to same camp
    • either is null (period and materialNode)
  • article
    • length >0 && length <= 32
    • trim
  • quantity
    • float
  • unit
    • 0 <= length <= 32
    • trim

MaterialList.php

Period.php

  • camp
  • Description (Api entity validations 2 #2919 )
    • length >0 && length <= 32 (In the old backend it was 128)
    • no cleanhtml
    • trim
  • start
    • less than or equal to end
    • less than or or equal to earliest schedule entry
    • date (without time and without time zone), test is missing
  • end
    • greater than or equal to start
    • greater than or or equal to latest schedule entry
    • date (without time and without time zone), test is missing

Profile.php

  • email
    • trim
    • not blank, not null
    • valid email
    • unique
  • username
    • trim
    • not blank, not null
    • unique
    • pattern: /^[a-z0-9_.@-]+$/
  • firstname
    • length <= 64
    • no cleanhtml
    • trim
  • surname
    • length <= 64
    • no cleanhtml
    • trim
  • nickname
    • length <= 32
    • no cleanhtml
    • trim
  • language
    • valid language
    • trim (Do we need a trim here?)
  • user
    • not null (Assured because profile can only be created with nested post over user, and patch user is not allowed)

ScheduleEntry.php

  • period
    • cannot be null
    • belongs to same camp as activity
  • activity
    • not null
    • belongs to same camp as period
    • cannot be changed
  • startOffset
    • must be inside period (wollen wir diese invariant?)
  • endOffset
    • must be inside period (wollen wir diese invariant?)
  • left
    • 0 <= left < 1 (was für ein minimalwert für die width ist sinnvoll?)
    • left + width = 1
  • width
    • 0 < width <= 1
    • left + width = 1
  • start
    • >= period.start
  • end
    • <= period.end

SortableEntityInterface.php

Validations können hoffentlich in SortableEntityTrait implementiert werden

SortableEntityTrait.php

  • position
    • -1 >= position

User.php

  • activationKeyHash
    • Is not writeable
  • password
    • Is not writeable
  • passwordResetKeyHash
    • Is not writeable
  • profile
    • not null
    • another profile cannot be referenced, a new profile must be created when creating a user
    • you cannot link to another profile
    • embedded patch is not allowed
    • unique (assured by oneToOne)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions