new revenue getters

This commit is contained in:
samantha42
2026-03-25 15:36:05 +01:00
parent 63be7b9282
commit 4e5b830e75
8 changed files with 98 additions and 49 deletions

View File

@@ -6,7 +6,6 @@ import (
"database/sql"
"encoding/json"
"net/http"
"strconv"
_ "github.com/mattn/go-sqlite3"
)
@@ -51,6 +50,7 @@ func AddRevenueEntryHandler(db *sql.DB) http.HandlerFunc {
}
}
/*
func GetRevenueReportHandler(db *sql.DB) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
companyID, _ := strconv.Atoi(r.URL.Query().Get("company_id"))
@@ -58,7 +58,7 @@ func GetRevenueReportHandler(db *sql.DB) http.HandlerFunc {
year, _ := strconv.Atoi(r.URL.Query().Get("year"))
idx, _ := strconv.Atoi(r.URL.Query().Get("index"))
entries, err := service.GetRevenue(db, companyID, model.PeriodType(periodType), year, idx)
entries, err := database.GetRevenueByPeriod(db, companyID, )
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -68,3 +68,4 @@ func GetRevenueReportHandler(db *sql.DB) http.HandlerFunc {
json.NewEncoder(w).Encode(entries)
}
}
*/