Skip to content

Commit

Permalink
Database. Confirm on Last Update against Last Backup Date. Index. Con…
Browse files Browse the repository at this point in the history
…firm to load Demo Data if empty db.
  • Loading branch information
ravi66 committed Jul 1, 2024
1 parent ed19f9d commit c239812
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 18 deletions.
Binary file modified Demo.bin
Binary file not shown.
9 changes: 3 additions & 6 deletions Pages/Database.razor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const cacheName = 'Bit-Besql';
const bookDbPath = '/data/cache/book.sqlite3';

export async function downloadDb(fileName) {
export async function downloadDb(cacheName, bookDbPath, fileName) {

window.sqlitedb = window.sqlitedb || {
init: false,
Expand Down Expand Up @@ -39,7 +36,7 @@ export async function downloadJsonDb(fileName, contentStreamReference) {
URL.revokeObjectURL(url);
}

export async function uploadDatabase(blob) {
export async function uploadDatabase(cacheName, bookDbPath, blob) {

window.sqlitedb = window.sqlitedb || {
init: false,
Expand All @@ -62,4 +59,4 @@ export async function uploadDatabase(blob) {
});

await window.sqlitedb.cache.put(bookDbPath, response);
}
}
24 changes: 24 additions & 0 deletions Shared/LoadDemoData.razor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export async function uploadDemoData(cacheName, bookDbPath, blob) {

window.sqlitedb = window.sqlitedb || {
init: false,
cache: await caches.open(cacheName)
};

const match = await window.sqlitedb.cache.match(bookDbPath);

if (match && match.ok) {

await window.sqlitedb.cache.delete(bookDbPath);
}

const headers = new Headers({
'content-length': blob.size
});

const response = new Response(blob, {
headers
});

await window.sqlitedb.cache.put(bookDbPath, response);
}
Binary file modified _framework/Book.pdb.gz
Binary file not shown.
Binary file modified _framework/Book.wasm
Binary file not shown.
Binary file modified _framework/Book.wasm.br
Binary file not shown.
Binary file modified _framework/Book.wasm.gz
Binary file not shown.
Binary file modified _framework/System.Net.Http.wasm
Binary file not shown.
Binary file modified _framework/System.Net.Http.wasm.br
Binary file not shown.
Binary file modified _framework/System.Net.Http.wasm.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions _framework/blazor.boot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mainAssemblyName": "Book",
"resources": {
"hash": "sha256-Tjf9bC4yBvqMPRjYoBLEQU4O0jHfMoOTvnvsX7wa250=",
"hash": "sha256-50KmqgtcvZocw0XQk+GyAsPpVjwB9q+oR9XPvv0lM8U=",
"jsModuleNative": {
"dotnet.native.8.0.5.wkyh9oo3kb.js": "sha256-lkFc2fKj8dqoAHuxc/Unl13t2HadhodNXoP+8xTnWK0="
},
Expand All @@ -17,7 +17,7 @@
"assembly": {
"Bit.Besql.wasm": "sha256-8NehqPmV4vKdwcxXnnNZIYebo9MZa3/g6tiwrkEX9R0=",
"Blazor-ApexCharts.wasm": "sha256-YAnmqRuT0V9DVItiMpEhe37Cnwl6FBW685qEx2VbpPo=",
"Book.wasm": "sha256-URVgQk6DJBk3Ccsj+Pf8BFZ1AkQ2ipGDcREl+4P74mw=",
"Book.wasm": "sha256-GCTQOIMckv36Ww78mBeDeDfyVZG30qRcm6wk0lnnuzw=",
"FluentValidation.wasm": "sha256-1akWVGgQZ9ojnoh8cEfeVZK+gNpDt7EOzVVPLa0T/iQ=",
"Microsoft.AspNetCore.Components.Forms.wasm": "sha256-F/b8c141U/fiV6IhZVK1pfQSniboFMGKF1gJ+LPZ6BY=",
"Microsoft.AspNetCore.Components.wasm": "sha256-sF1s8domwlT1Zh2j+ThfKXs0NcSFvhX+Gyhc4HJGFBg=",
Expand Down Expand Up @@ -71,7 +71,7 @@
"System.Linq.Queryable.wasm": "sha256-r+2et4mFTbEC4+3GNd5vafpeKP4EYMh9pdJu9KBSHKw=",
"System.Linq.wasm": "sha256-xjpe7Q6ssNby/C5Vu5szxHHbBceZRWruRXbjoCFXmj0=",
"System.Memory.wasm": "sha256-i1KkC2j1Li9lqMx/dCotKQc/gntITZ5gd/ixr7HBfEk=",
"System.Net.Http.wasm": "sha256-aS8BNlDawDNSPGPbLKqSn1bpOHNOOB6cEIGyymmNh2c=",
"System.Net.Http.wasm": "sha256-zL097SnjkaNrNNU7LwepiiqtbI7RwGGGrGh0XmaZoBY=",
"System.Net.NetworkInformation.wasm": "sha256-W+sLnKWrfb50zwfGAOlk0GK7XmkcBMMPyC/jq4/1l1c=",
"System.Net.Primitives.wasm": "sha256-GeZdfwkPVasXFTz9vCUKORacc+jgJQSs5m/Z+5IR7/k=",
"System.ObjectModel.wasm": "sha256-K4qjxqFqPjAy665Zz8uWLCZ64wktZBpIBaiD5of0XtI=",
Expand Down Expand Up @@ -104,7 +104,7 @@
},
"satelliteResources": {
"fr": {
"Book.resources.wasm": "sha256-lWk1vrM1VafPQYzi62O12nXRUj0JUAqLW7IExAFANNc="
"Book.resources.wasm": "sha256-Qm26+Ia5HceavPadNR79yQJpWdroSyOm+giEbOSOIJQ="
}
}
},
Expand Down
Binary file modified _framework/blazor.boot.json.br
Binary file not shown.
Binary file modified _framework/blazor.boot.json.gz
Binary file not shown.
Binary file modified _framework/fr/Book.resources.wasm
Binary file not shown.
Binary file modified _framework/fr/Book.resources.wasm.br
Binary file not shown.
Binary file modified _framework/fr/Book.resources.wasm.gz
Binary file not shown.
18 changes: 11 additions & 7 deletions service-worker-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"url": "_framework\/icudt.dat"
},
{
"hash": "sha256-0xoimNJOI97Din4TFbJ8NEMMxj3+JupLo1GTzpvaPpU=",
"hash": "sha256-sXbHv9Sp69IIk5uqyWCiEE+0CQtw+iBGzLSmiBIxzxA=",
"url": "_framework\/blazor.boot.json"
},
{
Expand All @@ -37,7 +37,7 @@
"url": "_framework\/Blazor-ApexCharts.wasm"
},
{
"hash": "sha256-URVgQk6DJBk3Ccsj+Pf8BFZ1AkQ2ipGDcREl+4P74mw=",
"hash": "sha256-GCTQOIMckv36Ww78mBeDeDfyVZG30qRcm6wk0lnnuzw=",
"url": "_framework\/Book.wasm"
},
{
Expand Down Expand Up @@ -253,7 +253,7 @@
"url": "_framework\/System.Memory.wasm"
},
{
"hash": "sha256-aS8BNlDawDNSPGPbLKqSn1bpOHNOOB6cEIGyymmNh2c=",
"hash": "sha256-zL097SnjkaNrNNU7LwepiiqtbI7RwGGGrGh0XmaZoBY=",
"url": "_framework\/System.Net.Http.wasm"
},
{
Expand Down Expand Up @@ -373,17 +373,21 @@
"url": "_framework\/System.Xml.XDocument.wasm"
},
{
"hash": "sha256-lWk1vrM1VafPQYzi62O12nXRUj0JUAqLW7IExAFANNc=",
"hash": "sha256-Qm26+Ia5HceavPadNR79yQJpWdroSyOm+giEbOSOIJQ=",
"url": "_framework\/fr\/Book.resources.wasm"
},
{
"hash": "sha256-4q2U8VnKtP+KG1eghOfXcYGgk037g53r0M0WyZPoJv0=",
"url": "Book.styles.css"
},
{
"hash": "sha256-n6tCuix\/\/ZoGjw1l+P9xnw2zj0XSURLu5AU4BpWgsj0=",
"hash": "sha256-4el0B6b+HmiKsRKY8eLDjnLtoNjlyH5SLUx25dK2hyQ=",
"url": "Pages\/Database.razor.js"
},
{
"hash": "sha256-FPk+\/Ifpa6nHsjo8bUp+GsTPnPMbTYSZMbAiVrwxeFA=",
"url": "Shared\/LoadDemoData.razor.js"
},
{
"hash": "sha256-OHUlLyXuua1SwLOz5u\/T0SQCHI9Oo24Z\/lAhIHhGXao=",
"url": "404.html"
Expand All @@ -393,7 +397,7 @@
"url": "css\/app.css"
},
{
"hash": "sha256-g4bn\/U7UtM5HsVuf7Oxmw5872MVIeahdx1YX4HZ1JXk=",
"hash": "sha256-fojLUmXCodWgvPfAgqlhIb64YPoY7lbZzr+zK6LD5ck=",
"url": "Demo.bin"
},
{
Expand Down Expand Up @@ -477,5 +481,5 @@
"url": "_content\/MudBlazor\/MudBlazor.min.js"
}
],
"version": "Ddh4W5K9"
"version": "xyXyN9WU"
};
2 changes: 1 addition & 1 deletion service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ async function onFetch(event) {

return cachedResponse || fetch(event.request);
}
/* Manifest version: Ddh4W5K9 */
/* Manifest version: xyXyN9WU */

0 comments on commit c239812

Please sign in to comment.