add username data to updates table
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-26 12:31:14 +10:00
parent dd13fd6759
commit f712c7254f
6 changed files with 21 additions and 7 deletions

View File

@@ -164,6 +164,7 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
params.EventId = sql.NullString{String: event.CloudEvent.ID, Valid: event.CloudEvent.ID != ""}
params.EventKey = sql.NullString{String: strconv.Itoa(event.CloudEvent.Data.Key), Valid: event.CloudEvent.Data.Key > 0}
params.UpdateTime = sql.NullInt64{Int64: unixTimestamp, Valid: unixTimestamp > 0}
params.UserName = sql.NullString{String: event.CloudEvent.Data.UserName, Valid: event.CloudEvent.Data.UserName != ""}
// Create the Update database record
result, err := h.Database.Queries().CreateUpdate(context.Background(), params)

View File

@@ -27,7 +27,7 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
mux.HandleFunc("/api/event/vm/delete", h.VmDelete)
mux.HandleFunc("/api/import/vm", h.VmImport)
// temporary endpoint
mux.HandleFunc("/api/cleanup/updates", h.UpdateCleanup)
//mux.HandleFunc("/api/cleanup/updates", h.UpdateCleanup)
return middleware.NewLoggingMiddleware(logger, mux)
}