-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow licenses #2973
Workflow licenses #2973
Changes from 1 commit
4c64343
1c20d51
1fe38eb
7907712
d6577e6
0074023
01416d9
b681b20
2552fb6
71df995
262551e
cabcd36
4412120
f999d23
1134926
fc8a298
b053b9c
a5f2cd2
3b1e514
e240ffa
52b5296
148f3c8
91e041b
9f64e04
c7a46ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{:ns rems.migrations.refactor-workflow-licenses | ||
:up-fn migrate-up | ||
:down-fn nil} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
[rems.application.events :as events] | ||
[rems.common.roles :refer [+admin-read-roles+ +admin-write-roles+]] | ||
[rems.schema-base :as schema-base] | ||
[rems.util :refer [getx-user-id]] | ||
[ring.util.http-response :refer :all] | ||
[schema.core :as s])) | ||
|
||
|
@@ -15,14 +14,16 @@ | |
:title s/Str | ||
(s/optional-key :forms) [{:form/id s/Int}] | ||
:type (apply s/enum events/workflow-types) ; TODO: exclude master workflow? | ||
(s/optional-key :handlers) [schema-base/UserId]}) | ||
(s/optional-key :handlers) [schema-base/UserId] | ||
(s/optional-key :licenses) [schema-base/LicenseId]}) | ||
|
||
(s/defschema EditWorkflowCommand | ||
{:id s/Int | ||
(s/optional-key :organization) schema-base/OrganizationId | ||
;; type can't change | ||
(s/optional-key :title) s/Str | ||
(s/optional-key :handlers) [schema-base/UserId]}) | ||
(s/optional-key :handlers) [schema-base/UserId] | ||
(s/optional-key :licenses) [schema-base/LicenseId]}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably remove the option of setting licenses in edit as it could affect existing applications. It's the same with forms and there we don't allow editing. |
||
|
||
(s/defschema CreateWorkflowResponse | ||
{:success s/Bool | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,3 +71,12 @@ | |
:licenses | ||
(get-licenses {:wfid (:wfid item) | ||
:items [(:id item)]}))) | ||
|
||
(defn join-license [x] | ||
(-> (get-license (:license/id x)) | ||
(dissoc :id) | ||
(merge x))) | ||
|
||
(defn license-exists? [id] | ||
(some? (db/get-license {:id id}))) | ||
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could potentially be very expensive (it's a query per license). I'm sure we have some other these kinds of checks around. We could add a task to go over them and see what approach is best. Could be for example cached. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something that we have perhaps not specified yet in "layer architecture" is how the ids of various things should be passed on. Could be nice to have
{:license/id 123}
format at this level but it could also work to have the123
for the DB layer and keep the map for API and service layers.