MCPcopy Create free account
hub / github.com/astercloud/aster / Delete

Method Delete

server/handlers/session.go:240–270  ·  view source on GitHub ↗

Delete deletes a session

(c *gin.Context)

Source from the content-addressed store, hash-verified

238
239// Delete deletes a session
240func (h *SessionHandler) Delete(c *gin.Context) {
241 ctx := c.Request.Context()
242 id := c.Param("id")
243
244 if err := (*h.store).Delete(ctx, "sessions", id); err != nil {
245 if errors.Is(err, store.ErrNotFound) {
246 c.JSON(http.StatusNotFound, gin.H{
247 "success": false,
248 "error": gin.H{
249 "code": "not_found",
250 "message": "Session not found",
251 },
252 })
253 return
254 }
255 c.JSON(http.StatusInternalServerError, gin.H{
256 "success": false,
257 "error": gin.H{
258 "code": "internal_error",
259 "message": "Failed to delete session: " + err.Error(),
260 },
261 })
262 return
263 }
264
265 logging.Info(ctx, "session.deleted", map[string]any{
266 "session_id": id,
267 })
268
269 c.Status(http.StatusNoContent)
270}
271
272// GetMessages retrieves session messages
273func (h *SessionHandler) GetMessages(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

InfoFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.65
StatusMethod · 0.45

Tested by

no test coverage detected