Skip to content

Commit

Permalink
Merge branch 'feature/v4' of https://github.com/pixlise/core into fea…
Browse files Browse the repository at this point in the history
…ture/v4
  • Loading branch information
Peter Nemere committed Nov 24, 2023
2 parents 74b2c57 + bd7227a commit f6ea4b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion api/ws/handlers/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func createExpression(expr *protos.DataExpression, hctx wsHelpers.HandlerContext
if err != nil {
return nil, err
}

expr.Owner = wsHelpers.MakeOwnerSummary(ownerItem, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)
return expr, nil
}
Expand Down
9 changes: 7 additions & 2 deletions api/ws/handlers/quantification-retrieval.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func HandleQuantListReq(req *protos.QuantListReq, hctx wsHelpers.HandlerContext) (*protos.QuantListResp, error) {
filter, _, err := wsHelpers.MakeFilter(req.SearchParams, false, protos.ObjectType_OT_QUANTIFICATION, hctx)
filter, idToOwner, err := wsHelpers.MakeFilter(req.SearchParams, false, protos.ObjectType_OT_QUANTIFICATION, hctx)
if err != nil {
return nil, err
}
Expand All @@ -35,6 +35,9 @@ func HandleQuantListReq(req *protos.QuantListReq, hctx wsHelpers.HandlerContext)

quants := []*protos.QuantificationSummary{}
for _, item := range items {
if owner, ok := idToOwner[item.Id]; ok {
item.Owner = wsHelpers.MakeOwnerSummary(owner, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)
}
quants = append(quants, item)
}

Expand All @@ -44,7 +47,7 @@ func HandleQuantListReq(req *protos.QuantListReq, hctx wsHelpers.HandlerContext)
}

func HandleQuantGetReq(req *protos.QuantGetReq, hctx wsHelpers.HandlerContext) (*protos.QuantGetResp, error) {
dbItem, _, err := wsHelpers.GetUserObjectById[protos.QuantificationSummary](false, req.QuantId, protos.ObjectType_OT_QUANTIFICATION, dbCollections.QuantificationsName, hctx)
dbItem, ownerItem, err := wsHelpers.GetUserObjectById[protos.QuantificationSummary](false, req.QuantId, protos.ObjectType_OT_QUANTIFICATION, dbCollections.QuantificationsName, hctx)
if err != nil {
return nil, err
}
Expand All @@ -62,6 +65,8 @@ func HandleQuantGetReq(req *protos.QuantGetReq, hctx wsHelpers.HandlerContext) (
}
}

dbItem.Owner = wsHelpers.MakeOwnerSummary(ownerItem, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)

return &protos.QuantGetResp{
Summary: dbItem,
Data: quant,
Expand Down
3 changes: 2 additions & 1 deletion api/ws/handlers/screen-configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func writeScreenConfiguration(screenConfig *protos.ScreenConfiguration, hctx wsH
configuration.Name = screenConfig.Name
configuration.Tags = screenConfig.Tags
configuration.Description = screenConfig.Description
configuration.ScanConfigurations = screenConfig.ScanConfigurations

_, err = hctx.Svcs.MongoDB.Collection(dbCollections.ScreenConfigurationName).UpdateByID(sessCtx, screenConfig.Id, bson.D{{
Key: "$set",
Expand Down Expand Up @@ -183,7 +184,7 @@ func writeScreenConfiguration(screenConfig *protos.ScreenConfiguration, hctx wsH
return nil, err
}

screenConfig.Owner = wsHelpers.MakeOwnerSummary(owner, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)
configuration.Owner = wsHelpers.MakeOwnerSummary(owner, hctx.SessUser, hctx.Svcs.MongoDB, hctx.Svcs.TimeStamper)

return configuration, nil
}
Expand Down

0 comments on commit f6ea4b5

Please sign in to comment.