Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
e1c216f28f | |||
c9a6ef8006 | |||
c6328acb1c | |||
f85a3da50e | |||
2ef228a192 | |||
977ff77d50 |
@ -17,7 +17,7 @@ var MongoClient (*mongo.Client)
|
||||
|
||||
// Builds the DB URI based on the loaded configuration parameters
|
||||
func getDbUri(cfg *helpers.Configuration) string {
|
||||
var uri = "mongodb://" + cfg.DbUser + ":" + cfg.DbPass + "@" + cfg.DbHost + ":" + cfg.DbPort
|
||||
var uri = "mongodb://" + cfg.DbUser + ":" + cfg.DbPass + "@" + cfg.DbHost + ":" + cfg.DbPort + "/?authSource=owlboard"
|
||||
return uri
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ func GetTiplocFromCrs(crs string) (tiploc string, err error) {
|
||||
},
|
||||
}
|
||||
|
||||
coll := MongoClient.Database(DatabaseName).Collection(StationsCollection)
|
||||
coll := MongoClient.Database(DatabaseName).Collection(CorpusCollection)
|
||||
cursor, err := coll.Aggregate(context.Background(), pipeline)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -144,7 +144,7 @@ func GetStanoxFromCrs(crs string) (stanox string, err error) {
|
||||
},
|
||||
}
|
||||
|
||||
coll := MongoClient.Database(DatabaseName).Collection(StationsCollection)
|
||||
coll := MongoClient.Database(DatabaseName).Collection(CorpusCollection)
|
||||
cursor, err := coll.Aggregate(context.Background(), pipeline)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -47,13 +47,13 @@ func PutPisMetadata(version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Info("New Stations Metadata written", zap.String("version", version))
|
||||
log.Info("New PIS Metadata written", zap.String("version", version))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Puts complete PIS dataset to database
|
||||
func PutPisData(pis *[]database.PIS) (int64, error) {
|
||||
coll := MongoClient.Database(DatabaseName).Collection("pis_testing")
|
||||
coll := MongoClient.Database(DatabaseName).Collection(PisCollection)
|
||||
|
||||
var docs []interface{}
|
||||
for _, entry := range *pis {
|
||||
@ -69,7 +69,7 @@ func PutPisData(pis *[]database.PIS) (int64, error) {
|
||||
}
|
||||
|
||||
func CreatePisIndeces() error {
|
||||
coll := MongoClient.Database(DatabaseName).Collection("pis_testing")
|
||||
coll := MongoClient.Database(DatabaseName).Collection(PisCollection)
|
||||
|
||||
crsIndex := mongo.IndexModel{
|
||||
Keys: bson.D{{"stops", 1}},
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
// Version Constants
|
||||
const versionNum string = "2024.11.4"
|
||||
const versionNum string = "2025.01.1"
|
||||
const versionSuffix string = ""
|
||||
const Version string = versionNum + versionSuffix
|
||||
|
||||
|
@ -56,7 +56,7 @@ func Check() {
|
||||
}
|
||||
|
||||
if oldMetadata != nil {
|
||||
if oldMetadata.LastVersion != apiResp.Name {
|
||||
if oldMetadata.LastVersion == apiResp.Name {
|
||||
log.Info("PIS Data is up to date")
|
||||
return
|
||||
}
|
||||
@ -67,4 +67,9 @@ func Check() {
|
||||
if err != nil {
|
||||
log.Error("Error updating PIS Data", zap.Error(err))
|
||||
}
|
||||
|
||||
err = dbAccess.PutPisMetadata(apiResp.Name)
|
||||
if err != nil {
|
||||
log.Error("Error updating PIS Metadata", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ func runUpdate(tarballUrl string) error {
|
||||
}
|
||||
log.Info("Loaded PIS Files to Slice")
|
||||
|
||||
// Temporarily use "pis_testing" collection to ensure all works as expected
|
||||
err = dbAccess.DropCollection("pis_testing")
|
||||
err = dbAccess.DropCollection(dbAccess.PisCollection)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user