summaryrefslogtreecommitdiff
path: root/pkg/database
diff options
context:
space:
mode:
authorJulien Dessaux2025-01-13 10:11:20 +0100
committerJulien Dessaux2025-01-13 10:11:20 +0100
commit1292d189cf15dd7ea904d5f76dc9630514f175c4 (patch)
tree6aab0161136c1d53ba8d0ffe931d9810b1b9c419 /pkg/database
parentfeat(tfstated): store created and updated timestamps for states (diff)
downloadtfstated-1292d189cf15dd7ea904d5f76dc9630514f175c4.tar.gz
tfstated-1292d189cf15dd7ea904d5f76dc9630514f175c4.tar.bz2
tfstated-1292d189cf15dd7ea904d5f76dc9630514f175c4.zip
feat(webui): implement logout process
Diffstat (limited to 'pkg/database')
-rw-r--r--pkg/database/sessions.go8
1 files changed, 8 insertions, 0 deletions
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,