tidepool-org/blip — pull request #93 by nicolashery (2014-06-26 22:30:38+00:00)
Title: New account creation flow

**WIP: Do not merge yet**

**Depends on**:

- https://github.com/tidepool-org/blip-mock-data/pull/1
- https://github.com/tidepool-org/platform-client/pull/24

## What's it about

Implement a new account creation flow where you can:

- set up a care team for yourself
- OR set up a care team for someone you care for
- OR identify yourself as "just a caregiver"

## Migration

None required. All "legacy" accounts default to "care team is for myself". Can edit to switch to "care team is for someone else".

## Current progress

**Thu, June 26th**: First commit, switched to a new "client-side data model" for users and patients which I hope simplifies things a bit and is closer to what's going on in the backend (see below). At this stage no new functionality (but got all old functionality working with new model).

## Data model

On the client-side we now handle objects that look like this:

**Logged-in user**:

```javascript
var user = {
"userid": "11",
"username": "mary.smith@example.com",
"emails": ["mary.smith@example.com"],
"profile": {
"fullName": "Mary Smith",
"patient": {
"birthday": "1987-03-08",
"diagnosisDate": "1994-02-01",
"about": "I like swimming"
}
}
}
```

**Patient == user**:

```javascript
var patient = {
"userid": "21",
"profile": {
"fullName": "Charles West",
"patient": {
"birthday": "1982-06-07",
"diagnosisDate": "2002-03-01",
"about": "I like carrots"
}
}
}
```

**Patient != user**:

```javascript
var patient = {
"userid": "31",
"profile": {
"fullName": "Sarah Carter",
"patient": {
"isOtherPerson": true,
"fullName": "Jessica Carter",
"birthday": "1999-07-03",
"diagnosisDate": "2009-08-01"
}
}
}
```

**Logged-in user is caregiver only** (hides the "create care team" prompt):

```javascript
var user = {
"userid": "51",
"username": "dr.scott@example.com",
"emails": ["dr.scott@example.com"],
"profile": {
"fullName": "Dr. Scott",
"isOnlyCareGiver": true
}
}
```

**New signup** (shows "create care team" prompt):

```javascript
var user = {
"userid": "51",
"username": "new.guy@example.com",
"emails": ["new.guy@example.com"],
"profile": {
"fullName": "New Guy"
}
}
```