feat: add json db for timeline (WIP); update fontawesome.
parent
2e2f15874b
commit
e3b71962e5
@ -0,0 +1,42 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Macchinista struct {
|
||||||
|
Name string `json:"username"`
|
||||||
|
Uid string `json:"password"`
|
||||||
|
Date string `json:"date"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GenericEvent struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Date string `json:"date"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type EventsDB struct {
|
||||||
|
Macchinisti map[string]*Macchinista `json:"macchinisti"`
|
||||||
|
GenericEvent map[string]*GenericEvent `json:"eventi,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetEvents() ([]EventsDB, error) {
|
||||||
|
var events []EventsDB
|
||||||
|
|
||||||
|
eventsJsonData, err := ioutil.ReadFile("./storia.json")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := json.Unmarshal(eventsJsonData, &events); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return events, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Logica per ordinare gli eventi
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
"macchinisti":
|
||||||
|
{
|
||||||
|
"nome": "Francesco Minnocci",
|
||||||
|
"uid": "minnocci",
|
||||||
|
"date": "2022/02",
|
||||||
|
"type": "entry"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nome": "Francesco Caporali",
|
||||||
|
"uid": "caporali",
|
||||||
|
"date": "201?/??",
|
||||||
|
"type": "exit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"eventi":
|
||||||
|
{
|
||||||
|
"title": "Nuovo sito del PHC",
|
||||||
|
"description": "TBA",
|
||||||
|
"date": "2022/??"
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue