From: rajdeep11 Date: Tue, 8 Oct 2024 11:50:52 +0000 (+0530) Subject: fixing the register model request X-Git-Tag: 4.0.0~36 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=650c6fb71b204a8a72ff0abf8e31402ea6ece9d1;p=aiml-fw%2Fawmf%2Fmodelmgmtservice.git fixing the register model request Change-Id: I00756b0a0b3abd444722896368de3e829e0401bc Signed-off-by: rajdeep11 --- diff --git a/apis/mmes_apis.go b/apis/mmes_apis.go index ce04b71..995bef2 100644 --- a/apis/mmes_apis.go +++ b/apis/mmes_apis.go @@ -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 --- 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 --- 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= diff --git a/request.http b/request.http index e1ace5c..4266b52 100644 --- a/request.http +++ b/request.http @@ -1,3 +1,4 @@ +### Note: update the vm ip in the host @host = x.x.x.x:8082 ### registraton