fixing the register model request 23/13523/1
authorrajdeep11 <rajdeep.sin@samsung.com>
Tue, 8 Oct 2024 11:50:52 +0000 (17:20 +0530)
committerrajdeep11 <rajdeep.sin@samsung.com>
Tue, 8 Oct 2024 11:52:35 +0000 (17:22 +0530)
Change-Id: I00756b0a0b3abd444722896368de3e829e0401bc
Signed-off-by: rajdeep11 <rajdeep.sin@samsung.com>
apis/mmes_apis.go
go.mod
go.sum
request.http

index ce04b71..995bef2 100644 (file)
@@ -27,6 +27,8 @@ import (
        "gerrit.o-ran-sc.org/r/aiml-fw/awmf/modelmgmtservice/logging"
        "gerrit.o-ran-sc.org/r/aiml-fw/awmf/modelmgmtservice/models"
        "github.com/gin-gonic/gin"
+       "github.com/google/uuid"
+
 )
 
 type MmeApiHandler struct {
@@ -53,6 +55,9 @@ func (m *MmeApiHandler) RegisterModel(cont *gin.Context) {
                return
        }
 
+       id := uuid.New()
+       modelInfo.Id = id.String()
+
        // TODO: validate the object
 
        if err := m.iDB.Create(modelInfo); err != nil {
@@ -62,7 +67,9 @@ func (m *MmeApiHandler) RegisterModel(cont *gin.Context) {
 
        logging.INFO("model is saved.")
 
-       cont.JSON(http.StatusCreated, gin.H{})
+       cont.JSON(http.StatusCreated, gin.H{
+               "modelInfo": modelInfo,
+       })
 
        // logging.INFO("Creating model...")
        // bodyBytes, _ := io.ReadAll(cont.Request.Body)
diff --git a/go.mod b/go.mod
index fa25acc..6c95709 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -10,6 +10,8 @@ require (
        github.com/stretchr/testify v1.8.3
        gorm.io/driver/postgres v1.5.9
        gorm.io/gorm v1.25.12
+    github.com/google/uuid v1.6.0
+
 )
 
 require (
diff --git a/go.sum b/go.sum
index 6ce65e0..56727c4 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -119,3 +119,5 @@ gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkw
 gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=
 gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
index e1ace5c..4266b52 100644 (file)
@@ -1,3 +1,4 @@
+### Note: update the vm ip in the host
 @host = x.x.x.x:8082
 
 ### registraton