MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / DeleteIdentity

Method DeleteIdentity

api/identity.go:126–140  ·  view source on GitHub ↗

DeleteIdentity deletes an existing identity record by its ID. It extracts the ID from the route parameters and deletes the record. If the ID is missing or there's an error deleting the identity, it responds with an appropriate error message. Parameters: - c: The Gin context containing the request a

(c *gin.Context)

Source from the content-addressed store, hash-verified

124// - 400 Bad Request: If the ID is missing or there's an error deleting the identity.
125// - 200 OK: If the identity is successfully deleted.
126func (a Api) DeleteIdentity(c *gin.Context) {
127 id, passed := c.Params.Get("id")
128 if !passed {
129 c.JSON(http.StatusBadRequest, gin.H{"error": "id is required. pass id in the route /:id"})
130 return
131 }
132
133 err := a.ledgerforge.DeleteIdentity(id)
134 if err != nil {
135 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
136 return
137 }
138
139 c.JSON(http.StatusOK, gin.H{"message": "Identity deleted successfully"})
140}
141
142// GetAllIdentities retrieves all identity records in the system.
143// It fetches the identity records and responds with the list of identities.

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
DeleteIdentityMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected