diff --git a/Documentation/NotionSetUp.mp4 b/Documentation/NotionSetUp.mp4
new file mode 100644
index 0000000..35ec594
Binary files /dev/null and b/Documentation/NotionSetUp.mp4 differ
diff --git a/package.json b/package.json
index 6448614..c1ac27a 100644
--- a/package.json
+++ b/package.json
@@ -15,16 +15,23 @@
"devDependencies": {
"cordova-android": "^12.0.1",
"cordova-browser": "^7.0.0",
- "cordova-ios": "^7.0.1"
+ "cordova-ios": "^7.0.1",
+ "cordova-plugin-file": "^8.0.1",
+ "cordova-sqlite-storage": "^6.1.0"
},
"cordova": {
"platforms": [
"browser",
"android",
"ios"
- ]
+ ],
+ "plugins": {
+ "cordova-sqlite-storage": {},
+ "cordova-plugin-file": {}
+ }
},
"dependencies": {
+ "sqlite3": "^5.1.7",
"cordova": "^6.5.0"
}
}
diff --git a/www/MainSetUp.html b/www/MainSetUp.html
new file mode 100644
index 0000000..a22a9e6
--- /dev/null
+++ b/www/MainSetUp.html
@@ -0,0 +1,93 @@
+
+
+
+
+
+ Settings
+
+
+
+Settings
+
+
+
+
+
+
+
diff --git a/www/js/index.js b/www/js/index.js
index 6fc66e5..3497ed5 100644
--- a/www/js/index.js
+++ b/www/js/index.js
@@ -23,7 +23,49 @@ document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
+ async function initDatabase() {
+ try {
+ var db = window.sqlitePlugin.openDatabase({name: 'CyncSafe.db', location: "default"});
+ alert (cordova.file.applicationDirectory + 'www/schema.spsql');
+ // Resolve the local file system URL for the schema file
+ window.resolveLocalFileSystemURL('file://' + cordova.file.applicationDirectory + 'www/schema.spsql', function(fileEntry) {
+ fileEntry.file(function(file) {
+ var reader = new FileReader();
+ reader.onloadend = function() {
+ // File contents are in this.result
+ var schema = this.result;
+
+ // Execute the schema in the database
+ db.exec(schema, function() {
+ alert("executed Schema")
+ window.console.log('Schema executed successfully');
+ }, function(error) {
+ alert("Error occured")
+ window.console.error('Error executing schema:', error);
+ });
+ };
+
+ // Read the file as text
+ reader.readAsText(file);
+ }, function(error) {
+ window.console.error('Error reading file:', error);
+ });
+ }, function(error) {
+ window.console.error('Error resolving file URL:', error);
+ });
+ } catch (error) {
+ window.console.error('Error initializing database:', error);
+ }
+ }
+
+ initDatabase();
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
document.getElementById('deviceready').classList.add('ready');
+
+
}
+
+
+
+
\ No newline at end of file
diff --git a/www/schema.spsql b/www/schema.spsql
new file mode 100644
index 0000000..fa53848
--- /dev/null
+++ b/www/schema.spsql
@@ -0,0 +1,83 @@
+
+--Table for Types of Food Restrictions--
+CREATE TABLE Restrictions (
+ RestrictionID INTEGER PRIMARY KEY,
+ RestrctionType INTEGER,
+ Description Text
+);
+
+--Table for the Users Data--
+CREATE TABLE User (
+ UserID INTEGER PRIMARY KEY,
+ UserName Text,
+ Gender TEXT CHECK (Gender IN ('male', 'female', 'non-binary', 'other')),
+ Age Integer,
+ Email Text,
+ Password Text
+);
+
+
+--Table for the types of User Energy
+CREATE TABLE EnergyLevels (
+ EnergyID INTEGER PRIMARY KEY,
+ EnergyLevel Text
+);
+
+INSERT INTO EnergyLevels(EngeryID,EnergyLevel) Values (1,"Low");
+
+
+--Table for FoodReccomendations for Types of Restrctions
+CREATE TABLE FoodRecommendations (
+ RecommendationID INTEGER PRIMARY KEY,
+ FoodItem Text,
+ RestrictionID References Restrctions(RestrictionID)
+);
+
+
+--Table for MenstrualCycle for Females
+CREATE TABLE MenstrualCycle (
+ CycleID INTEGER PRIMARY KEY,
+ StartDate Date,
+ EndDate Date,
+ CycleLength Integer,
+ UserID References User(UserID)
+);
+
+
+--Table for Phases for Mentral Cycle
+CREATE TABLE MenstrualCycle (
+ PhaseID INTEGER PRIMARY KEY,
+ PhaseType Text,
+ CycleID References MenstrualCycle(CycleID)
+);
+
+
+--Table for Sleep Entries
+CREATE TABLE SleepEntries (
+ SleepID INTEGER PRIMARY KEY,
+ SleepDuration Real,
+ SleepDate Date,
+ UserID References User(UserID)
+);
+
+
+--Table for Male Testosterone
+CREATE TABLE TestosteroneLevel (
+ LevelID INTEGER PRIMARY KEY,
+ TestDate Date,
+ Level TEXT CHECK (Level IN ('High', 'Medium', 'Low')),
+ UserID References User(UserID)
+);
+
+
+--Table for Male Factors for their Testosterone
+CREATE TABLE TestosteroneFactors (
+ FactorID INTEGER PRIMARY KEY,
+ FactorDate Date,
+ FactorType Integer,
+ FactorDescription Text,
+ FactorImpact Text,
+ UserID References User(UserID)
+);
+
+