Skip to content

Commit 4f14522

Browse files
Audit project and application updates
1 parent b07f416 commit 4f14522

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎cmd/stackhost/main.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ func (a *app) projectRoute(w http.ResponseWriter, r *http.Request) {
443443
jsonError(w, 500, "internal_error", "Não foi possível atualizar o projeto.")
444444
return
445445
}
446+
if userID, ok := r.Context().Value(userKey{}).(int64); ok {
447+
a.audit(userID, "project.updated", "project", id)
448+
}
446449
a.publish("project.updated", map[string]any{"id": id})
447450
w.WriteHeader(http.StatusNoContent)
448451
}
@@ -538,6 +541,9 @@ func (a *app) applicationRoute(w http.ResponseWriter, r *http.Request) {
538541
jsonError(w, 500, "internal_error", "Não foi possível atualizar a aplicação.")
539542
return
540543
}
544+
if userID, ok := r.Context().Value(userKey{}).(int64); ok {
545+
a.audit(userID, "application.updated", "application", id)
546+
}
541547
a.publish("application.updated", map[string]any{"id": id})
542548
w.WriteHeader(http.StatusNoContent)
543549
}

0 commit comments

Comments
 (0)