model mgmt fixes 48/13848/3
authorMonosij Ghosh <mono.ghosh@samsung.com>
Tue, 10 Dec 2024 11:58:25 +0000 (17:28 +0530)
committerMonosij Ghosh <mono.ghosh@samsung.com>
Tue, 10 Dec 2024 12:04:21 +0000 (17:34 +0530)
modified return code for delete model API

Change-Id: I744b75515f3a47ccea40b4f034f32c297901e205
Signed-off-by: Monosij Ghosh <mono.ghosh@samsung.com>
apis/mmes_apis.go
request.http

index 914495d..c31fff5 100644 (file)
@@ -325,16 +325,13 @@ func (m *MmeApiHandler) UpdateModel(c *gin.Context) {
 func (m *MmeApiHandler) DeleteModel(cont *gin.Context) {
        id := cont.Param("modelRegistrationId")
        logging.INFO("Deleting model... id = ", id)
-       rowsAffected, err := m.iDB.Delete(id)
+       _, err := m.iDB.Delete(id)
        if err != nil {
                cont.JSON(http.StatusInternalServerError, gin.H{
                        "error": err.Error(),
                })
                return
        }
-       message := "modelInfo deleted"
-       if rowsAffected == 0 {
-               message = fmt.Sprintf("id = %s already doesn't exist in database", id)
-       }
-       cont.JSON(http.StatusOK, gin.H{"message": message})
+
+       cont.JSON(http.StatusNoContent, nil)
 }
index dc87c92..9b3bddc 100644 (file)
@@ -32,12 +32,16 @@ Content-Type: application/json
 GET http://{{host}}/models?model-name=TestModel1&model-version=v1.0
 Content-Type: application/json
 
-### updated model
-PUT http://{{host}}/model-registrations/79a20274-35a6-4f97-a669-8b42b73f087f
+### Get Model info by ID
+GET http://{{host}}/model-registrations/a43d1a80-e1c5-4d87-b90f-729736bdd89f
+Content-Type: application/json
+
+### Updated Model info by ID
+PUT http://{{host}}/model-registrations/a43d1a80-e1c5-4d87-b90f-729736bdd89f
 Content-Type: application/json
 
 {
-    "id": "79a20274-35a6-4f97-a669-8b42b73f087f",
+    "id": "a43d1a80-e1c5-4d87-b90f-729736bdd89f",
     "modelId": {
       "modelName": "TestModel1",
       "modelVersion": "v1.0",
@@ -55,5 +59,5 @@ Content-Type: application/json
     "modelLocation": ""
   }
 
-### delete modelinfo
-DELETE http://{{host}}/modelInfo/12345
\ No newline at end of file
+### delete model info by ID
+DELETE http://{{host}}/model-registrations/a43d1a80-e1c5-4d87-b90f-729736bdd89f