From 700f3e9c105071bdfe769edb651f91ae365c7f75 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 24 Apr 2026 12:09:51 +0200 Subject: [PATCH] :sparkles: MR changes --- backend/src/app/nitrate.clj | 13 ++++++------- backend/src/app/rpc/commands/nitrate.clj | 6 +++--- backend/src/app/rpc/management/nitrate.clj | 3 ++- .../app/common/{ => types}/organization.cljc | 17 ++++++++++++++++- common/src/app/common/types/team.cljc | 12 ------------ frontend/src/app/main/data/dashboard.cljs | 2 +- 6 files changed, 28 insertions(+), 25 deletions(-) rename common/src/app/common/{ => types}/organization.cljc (76%) diff --git a/backend/src/app/nitrate.clj b/backend/src/app/nitrate.clj index ad4318ec6c..00ccdac7c6 100644 --- a/backend/src/app/nitrate.clj +++ b/backend/src/app/nitrate.clj @@ -10,11 +10,10 @@ [app.common.exceptions :as ex] [app.common.json :as json] [app.common.logging :as l] - [app.common.organization :as co] [app.common.schema :as sm] [app.common.schema.generators :as sg] [app.common.time :as ct] - [app.common.types.team :as ctt] + [app.common.types.organization :as cto] [app.config :as cf] [app.http.client :as http] [app.rpc :as-alias rpc] @@ -207,7 +206,7 @@ (str baseuri "/api/teams/" team-id) - ctt/schema:team-with-organization params))) + cto/schema:team-with-organization params))) (defn- get-org-membership-api [cfg {:keys [profile-id organization-id] :as params}] @@ -253,7 +252,7 @@ "/api/organizations/" organization-id "/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])] (str (cf/get :public-uri) "/assets/by-id/" logo-id))] (cond-> team @@ -380,9 +379,9 @@ team-with-org (call cfg :get-team-org params) org (:organization team-with-org)] (if (some? org) - (-> (co/apply-organization team (assoc org :custom-photo - (when-let [logo-id (:logo-id org)] - (str (cf/get :public-uri) "/assets/by-id/" logo-id)))) + (-> (cto/apply-organization team (assoc org :custom-photo + (when-let [logo-id (:logo-id org)] + (str (cf/get :public-uri) "/assets/by-id/" logo-id)))) (assoc :is-default (or (:is-default team) (true? (:is-your-penpot team-with-org))))) team)) (catch Throwable cause diff --git a/backend/src/app/rpc/commands/nitrate.clj b/backend/src/app/rpc/commands/nitrate.clj index ddabb9bb65..26d690f166 100644 --- a/backend/src/app/rpc/commands/nitrate.clj +++ b/backend/src/app/rpc/commands/nitrate.clj @@ -253,15 +253,15 @@ nil) -(def ^:private schema:add-team-to-org +(def ^:private schema:add-team-to-organization [:map [:team-id ::sm/uuid] [:organization-id ::sm/uuid]]) -(sv/defmethod ::add-team-to-org +(sv/defmethod ::add-team-to-organization {::rpc/auth true ::doc/added "2.17" - ::sm/params schema:add-team-to-org + ::sm/params schema:add-team-to-organization ::db/transaction true} [cfg {:keys [::rpc/profile-id team-id organization-id]}] diff --git a/backend/src/app/rpc/management/nitrate.clj b/backend/src/app/rpc/management/nitrate.clj index f07451abc5..8af099de97 100644 --- a/backend/src/app/rpc/management/nitrate.clj +++ b/backend/src/app/rpc/management/nitrate.clj @@ -11,8 +11,9 @@ [app.common.data :as d] [app.common.exceptions :as ex] [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.team :refer [schema:team schema:team-with-organization]] + [app.common.types.team :refer [schema:team]] [app.config :as cf] [app.db :as db] [app.media :as media] diff --git a/common/src/app/common/organization.cljc b/common/src/app/common/types/organization.cljc similarity index 76% rename from common/src/app/common/organization.cljc rename to common/src/app/common/types/organization.cljc index e7e5bc49b1..b504954cfb 100644 --- a/common/src/app/common/organization.cljc +++ b/common/src/app/common/types/organization.cljc @@ -4,7 +4,22 @@ ;; ;; 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 "Mapping from organization field keys to their corresponding :organization-* team keys." diff --git a/common/src/app/common/types/team.cljc b/common/src/app/common/types/team.cljc index c8707f8b0f..0fd341b43c 100644 --- a/common/src/app/common/types/team.cljc +++ b/common/src/app/common/types/team.cljc @@ -26,16 +26,4 @@ [:id ::sm/uuid] [: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]]]]]) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 8ef722de9f..c55d757d80 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -11,9 +11,9 @@ [app.common.features :as cfeat] [app.common.files.helpers :as cfh] [app.common.logging :as log] - [app.common.organization :as co] [app.common.schema :as sm] [app.common.time :as ct] + [app.common.types.organization :as co] [app.common.types.project :refer [valid-project?]] [app.common.uuid :as uuid] [app.config :as cf]