From: Monosij Ghosh Date: Tue, 10 Dec 2024 11:58:25 +0000 (+0530) Subject: model mgmt fixes X-Git-Tag: 4.0.0~18 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F13848%2F3;p=aiml-fw%2Fawmf%2Fmodelmgmtservice.git model mgmt fixes modified return code for delete model API Change-Id: I744b75515f3a47ccea40b4f034f32c297901e205 Signed-off-by: Monosij Ghosh --- diff --git a/apis/mmes_apis.go b/apis/mmes_apis.go index 914495d..c31fff5 100644 --- a/apis/mmes_apis.go +++ b/apis/mmes_apis.go @@ -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) } diff --git a/request.http b/request.http index dc87c92..9b3bddc 100644 --- a/request.http +++ b/request.http @@ -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