WIP on testing SQLite data store

This commit is contained in:
2024-01-03 22:29:27 -05:00
parent dee2222eb1
commit b69b6c37a4
10 changed files with 19 additions and 23 deletions

View File

@@ -443,7 +443,7 @@ module Theme =
let themeName = fileName.Split(".").[0].ToLowerInvariant().Replace(" ", "-")
if themeName.EndsWith "-theme" then
if Regex.IsMatch(themeName, """^[a-z0-9\-]+$""") then
Ok(ThemeId(themeName[..themeName.Length - 6]))
Ok(ThemeId(themeName[..themeName.Length - 7]))
else Error $"Theme ID {fileName} is invalid"
else Error "Theme .zip file name must end in \"-theme.zip\""

View File

@@ -18,7 +18,7 @@ module CatchAll =
let textLink =
let extra = webLog.ExtraPath
let url = string ctx.Request.Path
(if extra = "" then url else url[..extra.Length]).ToLowerInvariant()
(if extra = "" then url else url[extra.Length..]).ToLowerInvariant()
let await it = (Async.AwaitTask >> Async.RunSynchronously) it
seq {
debug (fun () -> $"Considering URL {textLink}")

View File

@@ -79,7 +79,7 @@ module DataImplementation =
let createSQLite connStr : IData =
Sqlite.Configuration.useConnectionString connStr
let log = sp.GetRequiredService<ILogger<SQLiteData>>()
let conn = new SqliteConnection(connStr)
let conn = Sqlite.Configuration.dbConn ()
log.LogInformation $"Using SQLite database {conn.DataSource}"
SQLiteData(conn, log, Json.configure (JsonSerializer.CreateDefault()))