-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data models, mock backend begin, tabs & tutorial.
- Loading branch information
Showing
26 changed files
with
600 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { StoryType } from './enum/story-type'; | ||
import {Category} from "./category"; | ||
|
||
export abstract class AbstractStory { | ||
id: string; | ||
type: StoryType; | ||
source: string; | ||
title: string; | ||
description: string; | ||
dateAdded: Date; | ||
dateHappened: Date; | ||
likes: string[]; // userId's | ||
comments: Comment[]; | ||
categories: Category[]; | ||
|
||
|
||
constructor(json?){ | ||
this.id = json.id; | ||
this.type = json.type; | ||
this.source = json.source; | ||
this.title = json.title; | ||
this.description = json.description; | ||
this.dateAdded = json.dateAdded; | ||
this.dateHappened = json.dateHappened; | ||
this.likes = json.likes; | ||
this.comments = json.comments; | ||
this.categories = json.categories; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export abstract class AbstractUser { | ||
|
||
// personal info | ||
id: string; | ||
firstName: string; | ||
lastName: string; | ||
dateOfBirth: Date; | ||
birthLocation: string; | ||
|
||
// profile picture | ||
profilePicture: string; | ||
|
||
constructor(json?) { | ||
if (json) { | ||
this.firstName = json.firstName; | ||
this.lastName = json.lastName; | ||
this.dateOfBirth = new Date(json.dateOfBirth); | ||
this.birthLocation = json.birthLocation; | ||
this.profilePicture = json.profilePicture; | ||
} | ||
} | ||
|
||
getThumbnail(): string { | ||
return this.profilePicture; // TODO: derive thumbnail link | ||
} | ||
|
||
/** Gets the age of the user */ | ||
getAge(): number { | ||
// this can be derived from the dateOfBirth | ||
return 1; // TODO: with moment.js | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { UserStory } from './user-story'; | ||
|
||
export class Album { | ||
id: string; | ||
title: string; | ||
description: string; | ||
stories: UserStory[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class Category { | ||
id: string; | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export class Comment { | ||
id: string; | ||
storyId: string; | ||
userId: string; | ||
comment: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum StoryType { | ||
TEXT = 0, | ||
AUDIO = 1, | ||
IMAGE = 2, | ||
VIDEO = 3, | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { AbstractStory } from './abstract-story'; | ||
|
||
export class HeritageStory extends AbstractStory { | ||
// TODO: specific heritage properties | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class LifeEvent { | ||
id: string; | ||
userId: string; | ||
withUser: string; | ||
name: string; | ||
date: Date; | ||
storyId: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { AbstractUser } from './abstract-user'; | ||
import { WorkPlace } from './work-place'; | ||
import { LifeEvent } from './life-event'; | ||
import { Relation } from './relation'; | ||
import {Category} from "./category"; | ||
|
||
export class Patient extends AbstractUser { | ||
careHouse: string; | ||
workPlaces: WorkPlace[]; | ||
lifeEvents: LifeEvent[]; | ||
relations: Relation[]; | ||
interests: Category[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** relation suggestions */ | ||
export const relationTypes = { | ||
"father": "father", | ||
"mother": "mother", | ||
"nurse": "nurse", | ||
"son": "son", | ||
"daughter": "daughter", | ||
"grandson": "grandson", | ||
"granddaughter": "granddaughter", | ||
"friend": "friend" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export class Relation { | ||
|
||
id: string; | ||
type: string; | ||
patientId: string; | ||
userId: string; | ||
|
||
constructor(json?) { | ||
if (json) { | ||
this.type = json.type; | ||
|
||
// this.id = json.id; | ||
// this.patientId = json.patientId; | ||
this.userId = json.userId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { AbstractStory } from './abstract-story'; | ||
|
||
export class UserStory extends AbstractStory { | ||
albumId: string; | ||
originId: string; // heritage origin story | ||
|
||
|
||
constructor(json?) { | ||
super(json); | ||
this.albumId = json.albumId; | ||
this.originId = json.originId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { AbstractUser } from './abstract-user'; | ||
import { Relation } from './relation'; | ||
|
||
export class User extends AbstractUser { | ||
|
||
email: string; | ||
password: string; | ||
relations: Relation[]; | ||
|
||
constructor(json?) { | ||
super(json); | ||
if (json) { | ||
this.email = json.email; | ||
this.password = json.password; | ||
this.relations = []; | ||
json.relations.forEach(relation => { | ||
relation.id = relation.id ? relation.id : this.id; | ||
console.log("1"); | ||
this.relations.push(new Relation(relation)); | ||
} | ||
); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export class WorkPlace { | ||
function: string; | ||
location: string; | ||
period: Date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { PrismaService } from "./prisma-api.service"; | ||
import { Observable } from "rxjs/Observable"; | ||
import { User } from "../../dto/user"; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/Rx'; | ||
import {Subscription} from 'rxjs/Subscription'; | ||
import { Injectable } from "@angular/core"; | ||
import {UserStory} from "../../dto/user-story"; | ||
|
||
@Injectable() | ||
export class StoryService extends PrismaService { | ||
|
||
|
||
getUserStories(userId: string): Observable<UserStory[]> { | ||
return this._http.get("/mock-api/stories.json").map(res => { | ||
console.log("look here 2" + JSON.stringify(res.json())); | ||
let userStories:UserStory[] = []; | ||
res.json().forEach(story => | ||
{ | ||
userStories.push(new UserStory(story)); | ||
}) | ||
return userStories; | ||
}) | ||
.catch(error => this.handleError(error)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PrismaService } from "./prisma-api.service"; | ||
import { Observable } from "rxjs/Observable"; | ||
import { User } from "../../dto/user"; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/Rx'; | ||
import {Subscription} from 'rxjs/Subscription'; | ||
import { Injectable } from "@angular/core"; | ||
|
||
@Injectable() | ||
export class UserService extends PrismaService { | ||
|
||
|
||
getUser(id: string): Observable<User> { | ||
return this._http.get("/mock-api/users_id.json").map(res => { | ||
console.log("look here " + JSON.stringify(res.json())); | ||
return new User(res.json()); | ||
}) | ||
.catch(error => this.handleError(error)); | ||
} | ||
} |
Oops, something went wrong.