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
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-10 21:11:13 +01:00
|
|
|
const (
|
|
|
|
|
KlixSource = 1
|
|
|
|
|
)
|
2022-02-13 05:12:49 +01:00
|
|
|
|
|
|
|
|
func SourceName(sourceId int) string {
|
|
|
|
|
switch sourceId {
|
|
|
|
|
case KlixSource:
|
|
|
|
|
return "klix"
|
|
|
|
|
}
|
|
|
|
|
return "starenovine"
|
|
|
|
|
}
|