lib/core/src/items/sessions/session.class.ts
Class representing a single session at a doctor's appointment.
Properties |
|
Methods |
|
Accessors |
constructor(config: SessionConfig)
|
||||||
Parameters :
|
Public questions |
Type : Question[]
|
Public report |
Type : Report
|
Public startDate |
Type : Date
|
Public symptomCheck |
Type : SymptomCheck
|
Private Optional _config |
Type : C
|
Inherited from
Item
|
Defined in
Item:54
|
Public Optional id |
Type : string
|
Inherited from
Item
|
Defined in
Item:50
|
Public Optional update$ |
Type : Observable<string>
|
Inherited from
Item
|
Defined in
Item:52
|
Protected Optional updateSubject |
Type : Subject<string>
|
Inherited from
Item
|
Defined in
Item:51
|
Static acceptsAsConfig | ||||
acceptsAsConfig(config)
|
||||
Inherited from
Item
|
||||
Defined in
Item:33
|
||||
Parameters :
Returns :
SessionConfig
|
Static assertData | ||||
assertData(data)
|
||||
Inherited from
Item
|
||||
Defined in
Item:40
|
||||
Parameters :
Returns :
never
|
Static findConfigs | ||||
findConfigs(data)
|
||||
Inherited from
Item
|
||||
Defined in
Item:32
|
||||
Type parameters :
|
||||
Parameters :
Returns :
U[]
|
Public matches | ||||
matches(query)
|
||||
Inherited from
Item
|
||||
Defined in
Item:80
|
||||
TODO: Is this useful or needed anywhere?
Parameters :
Returns :
boolean
|
Public toJSON |
toJSON()
|
Inherited from
Item
|
Defined in
Item:75
|
Returns :
string
|
config | ||||||
getconfig()
|
||||||
setconfig(config: SessionConfig)
|
||||||
Parameters :
Returns :
void
|
import { Item } from '../item.class'
import {
SymptomCheck,
} from '../symptom-checks'
import {
Report,
} from '../reports'
import {
Question,
} from '../questions'
import {
assertSessionConfig,
isSessionConfig,
SessionConfig,
defaultSessionConfig
} from './sessions.commons'
/**
* Class representing a single session at a doctor's appointment.
*/
export class Session extends Item<SessionConfig> {
public symptomCheck : SymptomCheck
public report : Report
public questions : Question[]
public startDate : Date
public static acceptsAsConfig(config: unknown): config is SessionConfig {
console.log(assertSessionConfig)
console.log(config)
return isSessionConfig(config)
}
constructor(config: SessionConfig = defaultSessionConfig){
super(config)
this.startDate = new Date()
}
set config(config: SessionConfig){
assertSessionConfig(config)
this.symptomCheck = config.symptomCheck
? new SymptomCheck(config.symptomCheck)
: null
this.report = config.report
? new Report(config.report)
: null
this.questions = config.questions.map( questionConfig => new Question(questionConfig) )
}
get config(): SessionConfig {
return {
symptomCheck: this.symptomCheck.config,
report: this.report ? this.report.config : null,
questions: this.questions.map( question => question.config )
}
}
}