From b12ae1f2c764404210f49a365908e89e3709f922 Mon Sep 17 00:00:00 2001 From: siwei xu Date: Tue, 17 Sep 2024 03:53:33 -0400 Subject: [PATCH] CMR-9848: Modified tags association status return. --- search-app/src/cmr/search/api/tags.clj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/search-app/src/cmr/search/api/tags.clj b/search-app/src/cmr/search/api/tags.clj index 65e187f5f2..e5c77a6c9d 100644 --- a/search-app/src/cmr/search/api/tags.clj +++ b/search-app/src/cmr/search/api/tags.clj @@ -18,15 +18,15 @@ [headers] (mt/extract-header-mime-type #{mt/json} headers "content-type" true)) -(defn- has-error? - "Whether there's an error in [data]." +(defn- all-data-contain-errors? + "Whether all entries in data contain errors." [data] - (some #(contains? % :errors) data)) + (not (some #(nil? (:errors %)) data))) (defn tag-api-response "Creates a successful tag response with the given data response" ([data] - (if (has-error? data) + (if (all-data-contain-errors? data) (tag-api-response 400 data) (tag-api-response 200 data))) ([status-code data]