aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Batos-Parac <adrian.batos-parac@amdocs.com>2018-04-27 10:24:33 -0400
committerAdrian Batos-Parac <adrian.batos-parac@amdocs.com>2018-04-27 10:28:14 -0400
commit330f1cb56cfafd1508438139dadc7cc645262ec6 (patch)
tree912938cf4949bfb01c1777d9ce87453a7c14acb3 /src
parent236c2ccbe6ae61afd7677b409ff52fd7a6ce9298 (diff)
Fix truth assertion creation2.0.0-ONAPbeijing2.0.0-ONAP
Fixes the issue where the truth dimension required the create query parameter when it did not need it. Change-Id: Ic810e81210d2087b8e48f69ae8316f9ebb963dad Issue-ID: AAI-797 Signed-off-by: abatos <adrian.batos-parac@amdocs.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallifrey/handler.clj27
-rw-r--r--src/gallifrey/store.clj1
2 files changed, 14 insertions, 14 deletions
diff --git a/src/gallifrey/handler.clj b/src/gallifrey/handler.clj
index 61bdd16..cef8f0d 100644
--- a/src/gallifrey/handler.clj
+++ b/src/gallifrey/handler.clj
@@ -40,14 +40,15 @@
(when (#{:put :delete} (-> ctx :request :request-method))
(-> ctx :request :params :actor empty?)))
:exists? (fn [ctx]
- (if-let [resource (store/get-entity @the-store type id
- :t-t (parse-ts ctx :t-t) :t-k (parse-ts ctx :t-k))]
- {::resource ((case type
- "entity" serialize-entity
- "relationship" serialize-relationship) resource)}
- (when (and (= :put (-> ctx :request :request-method))
- (-> ctx :request :params :create not-empty))
- true)))
+ (let [put? (= :put (-> ctx :request :request-method))]
+ (if-let [resource (if put?
+ (store/get-entity @the-store type id :t-k (parse-ts ctx :t-k))
+ (store/get-entity @the-store type id
+ :t-t (parse-ts ctx :t-t) :t-k (parse-ts ctx :t-k)))]
+ {::resource ((case type
+ "entity" serialize-entity
+ "relationship" serialize-relationship) resource)}
+ (when (and put? (-> ctx :request :params :create not-empty)) true))))
:existed? (fn [ctx] (entity-existed? type id :t-k (parse-ts ctx :t-k)))
:handle-ok ::resource
:can-put-to-missing? false
@@ -80,11 +81,11 @@
(when-let [resource (not-empty
(store/entity-history @the-store type id))]
{::resource (map-vals (partial map #(-> %
- (update :k-start str)
- (update :k-end str)
- (update :t-start str)
- (update :t-end str)
- compact)) resource)}))
+ (update :k-start str)
+ (update :k-end str)
+ (update :t-start str)
+ (update :t-end str)
+ compact)) resource)}))
:handle-ok ::resource)
(defresource entity-lifespan-endpoint [type id]
diff --git a/src/gallifrey/store.clj b/src/gallifrey/store.clj
index 4f10f7c..05ac202 100644
--- a/src/gallifrey/store.clj
+++ b/src/gallifrey/store.clj
@@ -1,4 +1,3 @@
-
(ns gallifrey.store
(:require [utilis.map :refer [compact map-keys map-vals]]
[utilis.types.keyword :refer [->keyword]]