move from file storage to sqlite3

This commit is contained in:
2025-01-03 01:00:06 +01:00
parent fbca771479
commit 98655fd1fb
16 changed files with 150 additions and 389 deletions

View File

@@ -2,13 +2,12 @@ package model
import (
"time"
"crypto/sha256"
"encoding/hex"
)
// TODO docstring
type Article struct {
Identifier int
SourceUrl string
PublishDate time.Time
FetchDate time.Time
@@ -42,13 +41,3 @@ func (a *Article) ViewModel() *ArticleViewModel {
Summary: summary,
}
}
// --- implement IIdentifiable interface ---
// Generates a hash based on the source url of the article. Can be used to
// identify the article.
func (article *Article) Id() string {
hash := sha256.Sum256([]byte(article.SourceUrl))
return hex.EncodeToString(hash[:])
}