mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
✨ MR changes
This commit is contained in:
parent
debfe5490f
commit
700f3e9c10
@ -10,11 +10,10 @@
|
|||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.json :as json]
|
[app.common.json :as json]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.organization :as co]
|
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.schema.generators :as sg]
|
[app.common.schema.generators :as sg]
|
||||||
[app.common.time :as ct]
|
[app.common.time :as ct]
|
||||||
[app.common.types.team :as ctt]
|
[app.common.types.organization :as cto]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.http.client :as http]
|
[app.http.client :as http]
|
||||||
[app.rpc :as-alias rpc]
|
[app.rpc :as-alias rpc]
|
||||||
@ -207,7 +206,7 @@
|
|||||||
(str baseuri
|
(str baseuri
|
||||||
"/api/teams/"
|
"/api/teams/"
|
||||||
team-id)
|
team-id)
|
||||||
ctt/schema:team-with-organization params)))
|
cto/schema:team-with-organization params)))
|
||||||
|
|
||||||
(defn- get-org-membership-api
|
(defn- get-org-membership-api
|
||||||
[cfg {:keys [profile-id organization-id] :as params}]
|
[cfg {:keys [profile-id organization-id] :as params}]
|
||||||
@ -253,7 +252,7 @@
|
|||||||
"/api/organizations/"
|
"/api/organizations/"
|
||||||
organization-id
|
organization-id
|
||||||
"/add-team")
|
"/add-team")
|
||||||
ctt/schema:team-with-organization params)
|
cto/schema:team-with-organization params)
|
||||||
custom-photo (when-let [logo-id (get-in team [:organization :logo-id])]
|
custom-photo (when-let [logo-id (get-in team [:organization :logo-id])]
|
||||||
(str (cf/get :public-uri) "/assets/by-id/" logo-id))]
|
(str (cf/get :public-uri) "/assets/by-id/" logo-id))]
|
||||||
(cond-> team
|
(cond-> team
|
||||||
@ -380,7 +379,7 @@
|
|||||||
team-with-org (call cfg :get-team-org params)
|
team-with-org (call cfg :get-team-org params)
|
||||||
org (:organization team-with-org)]
|
org (:organization team-with-org)]
|
||||||
(if (some? org)
|
(if (some? org)
|
||||||
(-> (co/apply-organization team (assoc org :custom-photo
|
(-> (cto/apply-organization team (assoc org :custom-photo
|
||||||
(when-let [logo-id (:logo-id org)]
|
(when-let [logo-id (:logo-id org)]
|
||||||
(str (cf/get :public-uri) "/assets/by-id/" logo-id))))
|
(str (cf/get :public-uri) "/assets/by-id/" logo-id))))
|
||||||
(assoc :is-default (or (:is-default team) (true? (:is-your-penpot team-with-org)))))
|
(assoc :is-default (or (:is-default team) (true? (:is-your-penpot team-with-org)))))
|
||||||
|
|||||||
@ -253,15 +253,15 @@
|
|||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
|
||||||
(def ^:private schema:add-team-to-org
|
(def ^:private schema:add-team-to-organization
|
||||||
[:map
|
[:map
|
||||||
[:team-id ::sm/uuid]
|
[:team-id ::sm/uuid]
|
||||||
[:organization-id ::sm/uuid]])
|
[:organization-id ::sm/uuid]])
|
||||||
|
|
||||||
(sv/defmethod ::add-team-to-org
|
(sv/defmethod ::add-team-to-organization
|
||||||
{::rpc/auth true
|
{::rpc/auth true
|
||||||
::doc/added "2.17"
|
::doc/added "2.17"
|
||||||
::sm/params schema:add-team-to-org
|
::sm/params schema:add-team-to-organization
|
||||||
::db/transaction true}
|
::db/transaction true}
|
||||||
[cfg {:keys [::rpc/profile-id team-id organization-id]}]
|
[cfg {:keys [::rpc/profile-id team-id organization-id]}]
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,9 @@
|
|||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
|
[app.common.types.organization :refer [schema:team-with-organization]]
|
||||||
[app.common.types.profile :refer [schema:profile, schema:basic-profile]]
|
[app.common.types.profile :refer [schema:profile, schema:basic-profile]]
|
||||||
[app.common.types.team :refer [schema:team schema:team-with-organization]]
|
[app.common.types.team :refer [schema:team]]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.media :as media]
|
[app.media :as media]
|
||||||
|
|||||||
@ -4,7 +4,22 @@
|
|||||||
;;
|
;;
|
||||||
;; Copyright (c) KALEIDOS INC
|
;; Copyright (c) KALEIDOS INC
|
||||||
|
|
||||||
(ns app.common.organization)
|
(ns app.common.types.organization
|
||||||
|
(:require
|
||||||
|
[app.common.schema :as sm]))
|
||||||
|
|
||||||
|
(def schema:team-with-organization
|
||||||
|
[:map
|
||||||
|
[:id ::sm/uuid]
|
||||||
|
[:is-your-penpot :boolean]
|
||||||
|
[:organization
|
||||||
|
[:map
|
||||||
|
[:id ::sm/uuid]
|
||||||
|
[:name ::sm/text]
|
||||||
|
[:slug ::sm/text]
|
||||||
|
[:owner-id ::sm/uuid]
|
||||||
|
[:avatar-bg-url ::sm/uri]
|
||||||
|
[:logo-id {:optional true} [:maybe ::sm/uuid]]]]])
|
||||||
|
|
||||||
(def organization->team-keys
|
(def organization->team-keys
|
||||||
"Mapping from organization field keys to their corresponding :organization-* team keys."
|
"Mapping from organization field keys to their corresponding :organization-* team keys."
|
||||||
@ -26,16 +26,4 @@
|
|||||||
[:id ::sm/uuid]
|
[:id ::sm/uuid]
|
||||||
[:name :string]])
|
[:name :string]])
|
||||||
|
|
||||||
(def schema:team-with-organization
|
|
||||||
[:map
|
|
||||||
[:id ::sm/uuid]
|
|
||||||
[:is-your-penpot :boolean]
|
|
||||||
[:organization
|
|
||||||
[:map
|
|
||||||
[:id ::sm/uuid]
|
|
||||||
[:name ::sm/text]
|
|
||||||
[:slug ::sm/text]
|
|
||||||
[:owner-id ::sm/uuid]
|
|
||||||
[:avatar-bg-url ::sm/uri]
|
|
||||||
[:logo-id {:optional true} [:maybe ::sm/uuid]]]]])
|
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,9 @@
|
|||||||
[app.common.features :as cfeat]
|
[app.common.features :as cfeat]
|
||||||
[app.common.files.helpers :as cfh]
|
[app.common.files.helpers :as cfh]
|
||||||
[app.common.logging :as log]
|
[app.common.logging :as log]
|
||||||
[app.common.organization :as co]
|
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.time :as ct]
|
[app.common.time :as ct]
|
||||||
|
[app.common.types.organization :as co]
|
||||||
[app.common.types.project :refer [valid-project?]]
|
[app.common.types.project :refer [valid-project?]]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user