From 1292d189cf15dd7ea904d5f76dc9630514f175c4 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 13 Jan 2025 10:11:20 +0100 Subject: feat(webui): implement logout process --- pkg/database/sessions.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkg/database') diff --git a/pkg/database/sessions.go b/pkg/database/sessions.go index decba8e..43f9d50 100644 --- a/pkg/database/sessions.go +++ b/pkg/database/sessions.go @@ -27,6 +27,14 @@ func (db *DB) CreateSession(account *model.Account) (string, error) { return sessionId.String(), nil } +func (db *DB) DeleteSession(session *model.Session) error { + _, err := db.Exec(`DELETE FROM sessions WHERE id = ?`, session.Id) + if err != nil { + return fmt.Errorf("failed to delete session %s: %w", session.Id, err) + } + return nil +} + func (db *DB) LoadSessionById(id string) (*model.Session, error) { session := model.Session{ Id: id, -- cgit v1.2.3