Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: support GetIdentityDataProcedure() #24

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions internal/sbi/producer/data_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2540,9 +2540,17 @@ 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{}
gpsi, ok := (*response)["gpsi"]
if ok {
res.GpsiList = append(res.GpsiList, gpsi.(string))
}
ueId, ok := (*response)["ueId"]
if ok {
res.SupiList = append(res.SupiList, ueId.(string))
}
return httpwrapper.NewResponse(http.StatusOK, nil, res)
} else if problemDetails != nil {
return httpwrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
Expand All @@ -2552,10 +2560,16 @@ func HandleGetIdentityData(request *httpwrapper.Request) *httpwrapper.Response {
}

func GetIdentityDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) {
filter := bson.M{"ueId": ueId}
logger.DataRepoLog.Debugf("Handle GetIdentityDataProcedure: %+v", ueId)
filter := bson.M{
"$or": []bson.M{
{"gpsi": ueId},
{"ueId": ueId},
},
}
data, pd := getDataFromDB(collName, filter)
if pd != nil {
logger.DataRepoLog.Errorf("GetIdentityDataProcedure err: %s", pd.Detail)
logger.DataRepoLog.Errorf("GetIdentityDataProcedure err: %+v", pd)
return nil, pd
}
return &data, nil
Expand Down