MCPcopy Index your code
hub / github.com/coder/coder / DeleteApp

Function DeleteApp

coderd/oauth2provider/apps.go:183–207  ·  view source on GitHub ↗

DeleteApp returns an http.HandlerFunc that handles DELETE /oauth2-provider/apps/{app}

(db database.Store, auditor *audit.Auditor, logger slog.Logger)

Source from the content-addressed store, hash-verified

181
182// DeleteApp returns an http.HandlerFunc that handles DELETE /oauth2-provider/apps/{app}
183func DeleteApp(db database.Store, auditor *audit.Auditor, logger slog.Logger) http.HandlerFunc {
184 return func(rw http.ResponseWriter, r *http.Request) {
185 var (
186 ctx = r.Context()
187 app = httpmw.OAuth2ProviderApp(r)
188 aReq, commitAudit = audit.InitRequest[database.OAuth2ProviderApp](rw, &audit.RequestParams{
189 Audit: *auditor,
190 Log: logger,
191 Request: r,
192 Action: database.AuditActionDelete,
193 })
194 )
195 aReq.Old = app
196 defer commitAudit()
197 err := db.DeleteOAuth2ProviderAppByID(ctx, app.ID)
198 if err != nil {
199 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
200 Message: "Internal error deleting OAuth2 application.",
201 Detail: err.Error(),
202 })
203 return
204 }
205 rw.WriteHeader(http.StatusNoContent)
206 }
207}

Callers 1

Calls 7

OAuth2ProviderAppFunction · 0.92
InitRequestFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected