diff --git a/backend/src/app/rpc/mutations/projects.clj b/backend/src/app/rpc/mutations/projects.clj index 357b3841c..1a4598db4 100644 --- a/backend/src/app/rpc/mutations/projects.clj +++ b/backend/src/app/rpc/mutations/projects.clj @@ -117,11 +117,15 @@ (s/def ::delete-project (s/keys :req-un [::id ::profile-id])) +;; TODO: right now, we just don't allow delete default projects, in a +;; future we need to ensure raise a correct exception signaling that +;; this is not allowed. + (sv/defmethod ::delete-project [{:keys [pool] :as cfg} {:keys [id profile-id] :as params}] (db/with-atomic [conn pool] (proj/check-edition-permissions! conn profile-id id) (db/update! conn :project {:deleted-at (dt/now)} - {:id id}) + {:id id :is-default false}) nil)) diff --git a/backend/src/app/rpc/mutations/teams.clj b/backend/src/app/rpc/mutations/teams.clj index d0eae6dee..0d385fa2e 100644 --- a/backend/src/app/rpc/mutations/teams.clj +++ b/backend/src/app/rpc/mutations/teams.clj @@ -125,6 +125,10 @@ (s/def ::delete-team (s/keys :req-un [::profile-id ::id])) +;; TODO: right now just don't allow delete default team, in future it +;; should raise a speific exception for signal that this acction is +;; not allowed. + (sv/defmethod ::delete-team [{:keys [pool] :as cfg} {:keys [id profile-id] :as params}] (db/with-atomic [conn pool] @@ -135,7 +139,7 @@ (db/update! conn :team {:deleted-at (dt/now)} - {:id id}) + {:id id :is-default false}) nil))) diff --git a/backend/src/app/rpc/queries/profile.clj b/backend/src/app/rpc/queries/profile.clj index da36bb664..5e1456c60 100644 --- a/backend/src/app/rpc/queries/profile.clj +++ b/backend/src/app/rpc/queries/profile.clj @@ -95,7 +95,8 @@ (defn retrieve-profile-data-by-email [conn email] (try - (db/get-by-params conn :profile {:email (str/lower email)}) + (db/get-by-params conn :profile {:email (str/lower email) + :deleted-at nil}) (catch Exception _e))) ;; --- Attrs Helpers diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index a55b117c5..2ea76f03a 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -206,7 +206,6 @@ (dissoc state :current-file-id :current-project-id - :current-team-id :workspace-data :workspace-editor-state :workspace-file