Files
old-svevijesti/internal/model/model.go

53 lines
853 B
Go
Raw Normal View History

2022-02-10 21:11:13 +01:00
package model
2022-02-14 11:03:56 +01:00
import (
"html/template"
"time"
)
2022-02-13 05:12:49 +01:00
2022-02-10 21:11:13 +01:00
type ScrapedArticle struct {
Title string
Content string
Slug string
OriginalUrl string
SourceId int
}
2022-02-13 05:12:49 +01:00
type DisplayArticle struct {
ID int
Title string
2022-02-14 11:03:56 +01:00
Content template.HTML
2022-02-13 05:12:49 +01:00
Slug string
OriginalUrl string
SourceId int
CreatedAt time.Time
FormatedCreatedAt string
SourceName string
2024-01-29 14:55:20 +01:00
Category string
2022-02-13 05:12:49 +01:00
}
2022-02-10 21:11:13 +01:00
const (
2022-02-15 07:03:30 +01:00
KlixSource = 1
SrpskainfoSource = 2
2022-02-15 18:00:30 +01:00
BljesakSource = 3
2022-02-22 21:06:27 +01:00
AvazSource = 4
2022-02-10 21:11:13 +01:00
)
2022-02-13 05:12:49 +01:00
func SourceName(sourceId int) string {
switch sourceId {
case KlixSource:
return "klix"
2022-02-15 07:03:30 +01:00
case SrpskainfoSource:
return "srpskainfo"
2022-02-15 18:00:30 +01:00
case BljesakSource:
return "bljesak"
2022-02-22 21:06:27 +01:00
case AvazSource:
return "avaz"
2022-02-13 05:12:49 +01:00
}
return "starenovine"
}
2022-02-15 07:03:30 +01:00
const (
Terminator = "TERMINATED"
)