I am going to try and keep this as short as possible so its easy to understand.
I am making an app that allows driving instructors to enter details for a driving lesson for a student
Typical Scenario:
- Student gets in the car, Instructor asks for the students license number, first name, and last name. Based on this an ID is generated in
SessionInterface
and along withStudentInfo
- At the end of the driving lesson the Instructor adds info to the
SessioInfo
array. - At some point in the day the instructor adds
Notes
andFiles
.
Now this is where I’m confused.
If I was using a database and tables I could easily do this. Create a Session table that holds the id, sessionID, and studentInfoID. Create tables for StudentInfo that holds all info for the student, and another table for Session
that holds all the sessionInfo and an id linking to the files, grades, and notes table. Or I could use the NoSQL document approach
I would have to create something like this and store it
session = {
id: 123,
SessionInfo: {
created_at: "",
//.......
files: {
name: "",
// .....
},
notes: {
title: "",
// ......
},
grades: {
code: "",
.....
}
}
//......
};
BUT I wouldn’t be able to create this at once. I would first create the SessionInterface
add the id, later on i would add SessionInfo
and at the end SessionInfo
.
export interface SessionInterface {
id: any;
session?: Array<SessionInfo>;
studentInfo?: Array<StudentInfo>;
}
export interface SessionInfo {
created_at?: DateTime;
edited_at?: DateTime;
sessEndTime?: Time;
files?: Array<Files>;
grades?: Array<Grades>;
notes?: Array<Notes>;
}
export interface Files {
name: string;
uri: string;
}
export interface Notes {
title: string;
note: string;
}
export interface Grades {
code: string;
grade: number;
}
export interface StudentInfo {
firstName?: string;
lastName?: string;
license?: string;
}