Skip to content

Commit

Permalink
refactor: allow specifying document plan id via graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
rokasramas committed Feb 11, 2021
1 parent fe9915d commit e7e2d3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/resources/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ type Mutation {
): Boolean!

createDocumentPlan(
id: ID
uid: ID!
name: String!
kind: String
Expand Down
5 changes: 3 additions & 2 deletions api/src/api/graphql/translate/document_plan.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
(:require [api.utils :refer [read-mapper]]
[jsonista.core :as json]))

(defn schema->dp [{:keys [uid name kind blocklyXml documentPlan dataSampleId dataSampleRow]}]
{:uid uid
(defn schema->dp [{:keys [id uid name kind blocklyXml documentPlan dataSampleId dataSampleRow]}]
{:id id
:uid uid
:name name
:kind kind
:blocklyXml blocklyXml
Expand Down
2 changes: 1 addition & 1 deletion api/src/data/entities/document_plan.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(db/delete! document-plans-db document-plan-id))

(defn add-document-plan
([document-plan] (add-document-plan document-plan (utils/gen-rand-str 16)))
([document-plan] (add-document-plan document-plan (or (:id document-plan) (utils/gen-rand-str 16))))
([document-plan provided-id]
(db/write! document-plans-db provided-id document-plan true)))

Expand Down

0 comments on commit e7e2d3f

Please sign in to comment.