forked from CSCfi/rems
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
1,510 additions
and
999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS organization; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE organization ( | ||
id VARCHAR(255) NOT NULL PRIMARY KEY, | ||
modifierUserId varchar(255) NOT NULL, | ||
modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
data jsonb NOT NULL | ||
); |
3 changes: 3 additions & 0 deletions
3
resources/migrations/20200519062723-multiple-organizations.edn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{:ns rems.migrations.multiple-organizations | ||
:up-fn migrate-up | ||
:down-fn nil} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns rems.api.organizations | ||
(:require [compojure.api.sweet :refer :all] | ||
[rems.api.schema :refer :all] | ||
[rems.api.util] ; required for route :roles | ||
[rems.api.services.organizations :as organizations] | ||
[rems.util :refer [getx-user-id]] | ||
[ring.util.http-response :refer :all] | ||
[schema.core :as s])) | ||
|
||
(s/defschema CreateOrganizationCommand | ||
OrganizationFull) | ||
|
||
(s/defschema CreateOrganizationResponse | ||
{:success s/Bool | ||
(s/optional-key :organization/id) s/Str | ||
(s/optional-key :errors) [s/Any]}) | ||
|
||
(def organizations-api | ||
(context "/organizations" [] | ||
:tags ["organizations"] | ||
|
||
(GET "/" [] | ||
:summary "Get organizations. Returns more information for owners and handlers." | ||
:roles #{:logged-in} | ||
:query-params [{owner :- (describe s/Str "return only organizations that are owned by owner") nil}] | ||
:return [OrganizationFull] | ||
(ok (organizations/get-organizations (getx-user-id) owner))) | ||
|
||
(POST "/create" [] | ||
:summary "Create organization" | ||
:roles #{:owner} | ||
:body [command CreateOrganizationCommand] | ||
:return CreateOrganizationResponse | ||
(ok (organizations/add-organization! (getx-user-id) command))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.