Skip to content

Commit

Permalink
Merge pull request #25 from merlin-northern/reverting_release_name_an…
Browse files Browse the repository at this point in the history
…d_docs_search_filter

chore: deployments: reverting release name filtering and docs
  • Loading branch information
merlin-northern authored Sep 6, 2024
2 parents b281012 + 811bb23 commit 48c061c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions backend/services/deployments/docs/management_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1073,17 +1073,17 @@ paths:
parameters:
- name: name
in: query
description: Artifact name prefix filter.
description: Release name filter.
required: false
type: string
- name: description
in: query
description: Artifact description filter. Any artifact containing this string in the description will be returned.
description: Release description filter.
required: false
type: string
- name: device_type
in: query
description: Artifact device type filter. Any artifact containing this string in the device type will be returned.
description: Release device type filter.
required: false
type: string
responses:
Expand Down Expand Up @@ -1170,17 +1170,17 @@ paths:
parameters:
- name: name
in: query
description: Artifact name prefix filter.
description: Artifact name filter.
required: false
type: string
- name: description
in: query
description: Artifact description filter. Any artifact containing this string in the description will be returned.
description: Artifact description filter.
required: false
type: string
- name: device_type
in: query
description: Artifact device type filter. Any artifact containing this string in the device type will be returned.
description: Artifact device type filter.
required: false
type: string
- name: page
Expand Down
2 changes: 1 addition & 1 deletion backend/services/deployments/docs/management_api_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ paths:
parameters:
- name: name
in: query
description: Release name prefix filter.
description: Release name filter.
required: false
type: string
- name: tag
Expand Down
16 changes: 8 additions & 8 deletions backend/services/deployments/store/mongo/datastore_mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (db *DataStoreMongo) getReleases_1_2_14(
{Key: "$match", Value: bson.M{
StorageKeyImageName: bson.M{
"$regex": primitive.Regex{
Pattern: "^" + regexp.QuoteMeta(filt.Name),
Pattern: ".*" + regexp.QuoteMeta(filt.Name) + ".*",
Options: "i",
},
},
Expand Down Expand Up @@ -593,7 +593,7 @@ func (db *DataStoreMongo) getReleases_1_2_14(
{Key: "$match", Value: bson.M{
"artifacts." + StorageKeyImageDescription: bson.M{
"$regex": primitive.Regex{
Pattern: regexp.QuoteMeta(filt.Description),
Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*",
Options: "i",
},
},
Expand All @@ -605,7 +605,7 @@ func (db *DataStoreMongo) getReleases_1_2_14(
{Key: "$match", Value: bson.M{
"artifacts." + StorageKeyImageDeviceTypes: bson.M{
"$regex": primitive.Regex{
Pattern: regexp.QuoteMeta(filt.DeviceType),
Pattern: ".*" + regexp.QuoteMeta(filt.DeviceType) + ".*",
Options: "i",
},
},
Expand Down Expand Up @@ -713,7 +713,7 @@ func (db *DataStoreMongo) getReleases_1_2_15(
if filt != nil {
if filt.Name != "" {
filter[StorageKeyReleaseName] = bson.M{"$regex": primitive.Regex{
Pattern: "^" + regexp.QuoteMeta(filt.Name),
Pattern: regexp.QuoteMeta(filt.Name) + ".*",
Options: "i",
}}
}
Expand All @@ -722,7 +722,7 @@ func (db *DataStoreMongo) getReleases_1_2_15(
}
if filt.Description != "" {
filter[StorageKeyReleaseArtifactsDescription] = bson.M{"$regex": primitive.Regex{
Pattern: regexp.QuoteMeta(filt.Description),
Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*",
Options: "i",
}}
}
Expand Down Expand Up @@ -1202,23 +1202,23 @@ func (db *DataStoreMongo) ListImages(
if filt.Name != "" {
filters[StorageKeyImageName] = bson.M{
"$regex": primitive.Regex{
Pattern: "^" + regexp.QuoteMeta(filt.Name),
Pattern: ".*" + regexp.QuoteMeta(filt.Name) + ".*",
Options: "i",
},
}
}
if filt.Description != "" {
filters[StorageKeyImageDescription] = bson.M{
"$regex": primitive.Regex{
Pattern: regexp.QuoteMeta(filt.Description),
Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*",
Options: "i",
},
}
}
if filt.DeviceType != "" {
filters[StorageKeyImageDeviceTypes] = bson.M{
"$regex": primitive.Regex{
Pattern: regexp.QuoteMeta(filt.DeviceType),
Pattern: ".*" + regexp.QuoteMeta(filt.DeviceType) + ".*",
Options: "i",
},
}
Expand Down

0 comments on commit 48c061c

Please sign in to comment.