Skip to content

Data Model: Wizard

David Arias edited this page Nov 1, 2018 · 8 revisions

Data Model

The data for the questionnaire will be in an object. There will be a total of 10 properties that are obtained from the answers that the user inputs.

Data Properties:

  1. branch:
  • data type: String

  • required: true

  1. veteranOrActive:
  • data type: String

  • required: true

  1. separationDate:
  • data type: Date

  • required: true

  1. disabilityStatus:
  • data type: String

  • required: true

  1. disabilityPercent:
  • data type: Number

  • required: Optional/Conditional

  1. employmentStatus:
  • data type: String?

  • required: true

  1. lastEmployed:
  • data type: Date

  • required: Optional/Conditional

  1. maritalStatus:
  • data type: String

  • required: true

  1. militaryRank:
  • data type: String

  • required: true

  1. MOS:
  • data type: string

  • required: true

Data Source

To make the UserData object, the properties are set to the value of the FormControl value which is obtained from the FormGroup. (Discussed in the Wizard Documentation).

The value property gives us the value of the FormControl once the input is valid. After the user clicks the submit button on the last questionnaire, the onSubmit() method is called and sets the object properties value.

The onSubmit method, after it sets the properties value, calls a method in the service that 'puts' data to the database.

onSubmit() {
    let userData: object = {
      branch: this.firstForm.value.branch,
      veteranOrActive: this.firstForm.value.vetOrActive,
      separationDate: this.firstForm.value.separationDate,
      disabilityStatus: this.firstForm.value.disability,
      disabilityPercent: this.firstForm.value.percentQuestion,
      employmentStatus: this.secondForm.value.employment,
      lastEmployed: this.secondForm.value.lastEmployed,
      marriageStatus: this.secondForm.value.marriage,
      militaryRank: this.thirdForm.value.rank,
      MOS: this.thirdForm.value.MOS
    }
   this._user.putData(userData)
      .subscribe(data =>{
         }) 
}

Data Model Flow Diagram

https://docs.google.com/drawings/d/1zgqj4_t2Mqu1Ihe6PovRvpMlnILgDlDgj5yeHb0jIGc/edit?usp=sharing

Clone this wiki locally