Skip to content

Commit

Permalink
support GetIdentityDataProcedure()
Browse files Browse the repository at this point in the history
  • Loading branch information
ianchen0119 committed Dec 26, 2023
1 parent 15809d2 commit 2974744
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions internal/sbi/producer/data_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2540,9 +2540,15 @@ func HandleGetIdentityData(request *httpwrapper.Request) *httpwrapper.Response {
collName := "subscriptionData.identityData"

response, problemDetails := GetIdentityDataProcedure(collName, ueId)

if response != nil {
return httpwrapper.NewResponse(http.StatusOK, nil, response)
res := models.IdentityData{}
if (*response)["gpsi"] != nil {
res.GpsiList = append(res.GpsiList, (*response)["gpsi"].(string))
}
if (*response)["ueId"] != nil {
res.SupiList = append(res.SupiList, (*response)["ueId"].(string))
}
return httpwrapper.NewResponse(http.StatusOK, nil, res)
} else if problemDetails != nil {
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
Expand All @@ -2552,7 +2558,12 @@ func HandleGetIdentityData(request *httpwrapper.Request) *httpwrapper.Response {
}

func GetIdentityDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) {
filter := bson.M{"ueId": ueId}
filter := bson.M{
"$or": []bson.M{
bson.M{"gpsi": ueId},

Check failure on line 2563 in internal/sbi/producer/data_repository.go

View workflow job for this annotation

GitHub Actions / lint (1.18)

File is not `gofmt`-ed with `-s` (gofmt)
bson.M{"ueId": ueId},
},
}
data, pd := getDataFromDB(collName, filter)
if pd != nil {
logger.DataRepoLog.Errorf("GetIdentityDataProcedure err: %s", pd.Detail)
Expand Down

0 comments on commit 2974744

Please sign in to comment.