This commit is contained in:
2023-12-18 16:51:47 +01:00
commit 88741b2303
36 changed files with 1490 additions and 0 deletions

51
internal/model/model.go Normal file
View File

@@ -0,0 +1,51 @@
package model
import (
"html/template"
"time"
)
type ScrapedArticle struct {
Title string
Content string
Slug string
OriginalUrl string
SourceId int
}
type DisplayArticle struct {
ID int
Title string
Content template.HTML
Slug string
OriginalUrl string
SourceId int
CreatedAt time.Time
FormatedCreatedAt string
SourceName string
}
const (
KlixSource = 1
SrpskainfoSource = 2
BljesakSource = 3
AvazSource = 4
)
func SourceName(sourceId int) string {
switch sourceId {
case KlixSource:
return "klix"
case SrpskainfoSource:
return "srpskainfo"
case BljesakSource:
return "bljesak"
case AvazSource:
return "avaz"
}
return "starenovine"
}
const (
Terminator = "TERMINATED"
)