big update
This commit is contained in:
@@ -53,7 +53,7 @@ func sendData(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
dateSince = strings.Split(newDateSince.Format(time.RFC3339Nano), "Z")[0]
|
||||
}
|
||||
records, err := getSnapshotRecordsFromDb(dateSince)
|
||||
records, err := fetchDatetimeSnapshotsSince(dateSince)
|
||||
if internalErrorOnErr(fmt.Errorf("couldn't get snapshots from db: %w", err), w, r) { return }
|
||||
json, err := createJsonFromSnapshotRecords(records)
|
||||
if internalErrorOnErr(fmt.Errorf("couldn't create json from snapshots: %w", err), w, r) { return }
|
||||
@@ -67,8 +67,8 @@ func createAndSendSnapshot(w http.ResponseWriter, r *http.Request) {
|
||||
if internalErrorOnErr(fmt.Errorf("couldn't create a snapshot: %w", err), w, r) { return }
|
||||
_, err = writeSnapshotToDb(snapshot)
|
||||
if internalErrorOnErr(fmt.Errorf("couldn't save snapshot to db: %w", err), w, r) { return }
|
||||
dbSnapshotRecord, err := getLastSnapshotRecordFromDb()
|
||||
json, err := createJsonFromSnapshotRecords([]*SnapshotRecord{dbSnapshotRecord})
|
||||
dbSnapshotRecord, err := fetchLastSnapshotWithDatetime()
|
||||
json, err := createJsonFromSnapshotRecords([]*DatetimeSnapshotRecord{dbSnapshotRecord})
|
||||
if internalErrorOnErr(fmt.Errorf("couldn't create json from last snapshots: %w", err), w, r) { return }
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, err = fmt.Fprintf(w, string(json))
|
||||
|
||||
Reference in New Issue
Block a user