/
cleanup.go
49 lines (37 loc) · 1.29 KB
/
cleanup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package cleanup
import (
"net/http"
log "github.com/sirupsen/logrus"
)
// MigrateDatabase is awesome
func MigrateDatabase(w http.ResponseWriter, r *http.Request) {
// Load up a context and http client
ctx := r.Context()
log.WithContext(ctx).Infof("Context loaded. Starting execution.")
log.WithContext(ctx).Info("No Migrations to run, exiting :)")
return
// fbClient := serverutils.GetFirebaseClient(ctx)
// if fbClient == nil {
// w.WriteHeader(500)
// return
// }
// defer fbClient.Close()
// // Get the list of sections we are actively tracking
// sectionsSnapshot := fbClient.Collection("tracked_sections").Documents(ctx)
// // Actually get all the data within these docs
// sectionDocuments, err := sectionsSnapshot.GetAll()
// if err != nil {
// log.WithContext(ctx).Errorf("Error getting tracked_sections! sec: %v", sectionDocuments)
// log.WithContext(ctx).Errorf("Error getting tracked_sections! Err: %v", err)
// w.WriteHeader(500)
// return
// }
// log.WithContext(ctx).Debugf("successfully got sectionDocuments we are tracking")
// fbBatch := fbClient.Batch()
// for _, doc := range sectionDocuments {
// data := doc.Data()
// data["crn"] = doc.Ref.ID
// fbBatch.Create(fbClient.Collection("sections_tracked").NewDoc(), data)
// }
// fbBatch.Commit(ctx)
}