Refactoring finalised ... I think.
This commit is contained in:
@@ -47,6 +47,7 @@ func MessagesInboxHandler(db *sql.DB) http.HandlerFunc {
|
||||
tmpl := templateHelpers.LoadTemplateFiles("messages.html", "templates/account/messages/index.html")
|
||||
|
||||
if err := tmpl.ExecuteTemplate(w, "layout", context); err != nil {
|
||||
// ToDo: Make this load all error pages without defining explictly.
|
||||
templateHelpers.RenderError(w, r, 500)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ var db *sql.DB
|
||||
func InitDB(filepath string) *sql.DB {
|
||||
var err error
|
||||
cfg := config.Get()
|
||||
db, err := sql.Open("sqlite", filepath)
|
||||
db, err = sql.Open("sqlite", filepath)
|
||||
if err != nil {
|
||||
log.Fatal("❌ Failed to open DB:", err)
|
||||
}
|
||||
@@ -29,6 +29,7 @@ func InitDB(filepath string) *sql.DB {
|
||||
SchemaUsersMessages,
|
||||
SchemaUsersNotifications,
|
||||
SchemaAuditLog,
|
||||
SchemaAuditLogin,
|
||||
SchemaLogTicketMatching,
|
||||
SchemaAdminAccessLog,
|
||||
SchemaNewAuditLog,
|
||||
|
||||
@@ -175,6 +175,16 @@ CREATE TABLE IF NOT EXISTS audit_log (
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);`
|
||||
|
||||
const SchemaAuditLogin = `
|
||||
CREATE TABLE IF NOT EXISTS audit_login (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT,
|
||||
success BOOLEAN,
|
||||
ip TEXT,
|
||||
user_agent TEXT,
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);`
|
||||
|
||||
const SchemaSyndicates = `
|
||||
CREATE TABLE IF NOT EXISTS syndicates (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
Reference in New Issue
Block a user