mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 00:28:20 -05:00
Merge pull request #3376 from penpot/niwinz-bugfixes-2023-w26-2
🐛 Bugfixes
This commit is contained in:
commit
16854e7e83
2 changed files with 37 additions and 31 deletions
|
@ -51,15 +51,13 @@
|
||||||
(db/insert-multi! pool :audit-log event-columns events))))
|
(db/insert-multi! pool :audit-log event-columns events))))
|
||||||
|
|
||||||
(def schema:event
|
(def schema:event
|
||||||
[:schema {:registry
|
|
||||||
{::valid-any [:or ::sm/inst :int :double [:string {:max 250}]]}}
|
|
||||||
[:map {:title "Event"}
|
[:map {:title "Event"}
|
||||||
[:name [:string {:max 250}]]
|
[:name [:string {:max 250}]]
|
||||||
[:type [:string {:max 250}]]
|
[:type [:string {:max 250}]]
|
||||||
[:props
|
[:props
|
||||||
[:map-of :keyword ::valid-any]]
|
[:map-of :keyword :any]]
|
||||||
[:context {:optional true}
|
[:context {:optional true}
|
||||||
[:map-of :keyword ::valid-any]]]])
|
[:map-of :keyword :any]]])
|
||||||
|
|
||||||
(def schema:push-audit-events
|
(def schema:push-audit-events
|
||||||
[:map {:title "push-audit-events"}
|
[:map {:title "push-audit-events"}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
[app.tokens :as tokens]
|
[app.tokens :as tokens]
|
||||||
[app.util.services :as sv]
|
[app.util.services :as sv]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
(declare check-profile-existence!)
|
(declare check-profile-existence!)
|
||||||
|
@ -41,7 +40,7 @@
|
||||||
(def schema:profile
|
(def schema:profile
|
||||||
[:map {:title "Profile"}
|
[:map {:title "Profile"}
|
||||||
[:id ::sm/uuid]
|
[:id ::sm/uuid]
|
||||||
[:fullname :string]
|
[:fullname [::sm/word-string {:max 250}]]
|
||||||
[:email ::sm/email]
|
[:email ::sm/email]
|
||||||
[:is-active {:optional true} :boolean]
|
[:is-active {:optional true} :boolean]
|
||||||
[:is-blocked {:optional true} :boolean]
|
[:is-blocked {:optional true} :boolean]
|
||||||
|
@ -82,12 +81,15 @@
|
||||||
|
|
||||||
;; --- MUTATION: Update Profile (own)
|
;; --- MUTATION: Update Profile (own)
|
||||||
|
|
||||||
|
(def schema:update-profile
|
||||||
|
[:map {:title "update-profile"}
|
||||||
|
[:fullname [::sm/word-string {:max 250}]]
|
||||||
|
[:lang {:optional true} [:string {:max 5}]]
|
||||||
|
[:theme {:optional true} [:string {:max 250}]]])
|
||||||
|
|
||||||
(sv/defmethod ::update-profile
|
(sv/defmethod ::update-profile
|
||||||
{::doc/added "1.0"
|
{::doc/added "1.0"
|
||||||
::sm/params [:map {:title "UpdateProfileParams"}
|
::sm/params schema:update-profile
|
||||||
[:fullname {:min 1} :string]
|
|
||||||
[:lang {:optional true} :string]
|
|
||||||
[:theme {:optional true} :string]]
|
|
||||||
::sm/result schema:profile}
|
::sm/result schema:profile}
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id fullname lang theme] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id fullname lang theme] :as params}]
|
||||||
|
|
||||||
|
@ -128,11 +130,14 @@
|
||||||
(declare update-profile-password!)
|
(declare update-profile-password!)
|
||||||
(declare invalidate-profile-session!)
|
(declare invalidate-profile-session!)
|
||||||
|
|
||||||
|
(def schema:update-profile-password
|
||||||
|
[:map {:title "update-profile-password"}
|
||||||
|
[:password [::sm/word-string {:max 500}]]
|
||||||
|
[:old-password [::sm/word-string {:max 500}]]])
|
||||||
|
|
||||||
(sv/defmethod ::update-profile-password
|
(sv/defmethod ::update-profile-password
|
||||||
{:doc/added "1.0"
|
{:doc/added "1.0"
|
||||||
::sm/params [:map {:title "UpdateProfilePasswordParams"}
|
::sm/params schema:update-profile-password
|
||||||
[:password :string]
|
|
||||||
[:old-password :string]]
|
|
||||||
::sm/result :nil}
|
::sm/result :nil}
|
||||||
|
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id password] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id password] :as params}]
|
||||||
|
@ -178,10 +183,13 @@
|
||||||
(declare upload-photo)
|
(declare upload-photo)
|
||||||
(declare update-profile-photo)
|
(declare update-profile-photo)
|
||||||
|
|
||||||
|
(def schema:update-profile-photo
|
||||||
|
[:map {:title "update-profile-photo"}
|
||||||
|
[:file ::media/upload]])
|
||||||
|
|
||||||
(sv/defmethod ::update-profile-photo
|
(sv/defmethod ::update-profile-photo
|
||||||
{:doc/added "1.1"
|
{:doc/added "1.1"
|
||||||
::sm/params [:map {:title "UpdateProfilePhotoParams"}
|
::sm/params schema:update-profile-photo
|
||||||
[:file ::media/upload]]
|
|
||||||
::sm/result :nil}
|
::sm/result :nil}
|
||||||
[cfg {:keys [::rpc/profile-id file] :as params}]
|
[cfg {:keys [::rpc/profile-id file] :as params}]
|
||||||
;; Validate incoming mime type
|
;; Validate incoming mime type
|
||||||
|
@ -239,11 +247,13 @@
|
||||||
(declare ^:private request-email-change!)
|
(declare ^:private request-email-change!)
|
||||||
(declare ^:private change-email-immediately!)
|
(declare ^:private change-email-immediately!)
|
||||||
|
|
||||||
(s/def ::request-email-change
|
(def schema:request-email-change
|
||||||
(s/keys :req [::rpc/profile-id]
|
[:map {:title "request-email-change"}
|
||||||
:req-un [::email]))
|
[:email ::sm/email]])
|
||||||
|
|
||||||
(sv/defmethod ::request-email-change
|
(sv/defmethod ::request-email-change
|
||||||
|
{::doc/added "1.0"
|
||||||
|
::sm/params schema:request-email-change}
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id email] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id email] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [profile (db/get-by-id conn :profile profile-id)
|
(let [profile (db/get-by-id conn :profile profile-id)
|
||||||
|
@ -304,12 +314,13 @@
|
||||||
|
|
||||||
;; --- MUTATION: Update Profile Props
|
;; --- MUTATION: Update Profile Props
|
||||||
|
|
||||||
(s/def ::props map?)
|
(def schema:update-profile-props
|
||||||
(s/def ::update-profile-props
|
[:map {:title "update-profile-props"}
|
||||||
(s/keys :req [::rpc/profile-id]
|
[:props [:map-of :keyword :any]]])
|
||||||
:req-un [::props]))
|
|
||||||
|
|
||||||
(sv/defmethod ::update-profile-props
|
(sv/defmethod ::update-profile-props
|
||||||
|
{::doc/added "1.0"
|
||||||
|
::sm/params schema:update-profile-props}
|
||||||
[{:keys [::db/pool]} {:keys [::rpc/profile-id props]}]
|
[{:keys [::db/pool]} {:keys [::rpc/profile-id props]}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [profile (get-profile conn profile-id ::db/for-update? true)
|
(let [profile (get-profile conn profile-id ::db/for-update? true)
|
||||||
|
@ -329,15 +340,12 @@
|
||||||
|
|
||||||
(filter-props props))))
|
(filter-props props))))
|
||||||
|
|
||||||
|
|
||||||
;; --- MUTATION: Delete Profile
|
;; --- MUTATION: Delete Profile
|
||||||
|
|
||||||
(declare ^:private get-owned-teams-with-participants)
|
(declare ^:private get-owned-teams-with-participants)
|
||||||
|
|
||||||
(s/def ::delete-profile
|
|
||||||
(s/keys :req [::rpc/profile-id]))
|
|
||||||
|
|
||||||
(sv/defmethod ::delete-profile
|
(sv/defmethod ::delete-profile
|
||||||
|
{::doc/added "1.0"}
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [teams (get-owned-teams-with-participants conn profile-id)
|
(let [teams (get-owned-teams-with-participants conn profile-id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue