mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 23:08:25 +02:00
🎉 Add common
directory tree for code sharing between front and back.
This commit is contained in:
parent
ca3a42f680
commit
5b96e1e9fd
14 changed files with 288 additions and 41 deletions
|
@ -43,8 +43,8 @@
|
|||
width 200
|
||||
height 200}
|
||||
:as opts}]
|
||||
{:pre [(us/valid? ::thumbnail-opts opts)
|
||||
(fs/path? input)]}
|
||||
(s/assert ::thumbnail-opts opts)
|
||||
(s/assert fs/path? input)
|
||||
(let [tmp (fs/create-tempfile :suffix (str "." format))
|
||||
opr (doto (IMOperation.)
|
||||
(.addImage)
|
||||
|
@ -60,9 +60,7 @@
|
|||
|
||||
(defn make-thumbnail
|
||||
[input {:keys [width height format quality] :as opts}]
|
||||
{:pre [(us/valid? ::thumbnail-opts opts)
|
||||
(or (string? input)
|
||||
(fs/path input))]}
|
||||
(s/assert ::thumbnail-opts opts)
|
||||
(let [[filename ext] (fs/split-ext (fs/name input))
|
||||
suffix (->> [width height quality format]
|
||||
(interpose ".")
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
(s/def ::name ::us/string)
|
||||
(s/def ::path ::us/string)
|
||||
(s/def ::regex us/regex?)
|
||||
(s/def ::regex #(instance? java.util.regex.Pattern %))
|
||||
(s/def ::import-item
|
||||
(s/keys :req-un [::name ::path ::regex]))
|
||||
|
||||
|
|
|
@ -13,22 +13,22 @@
|
|||
[uxbox.services.mutations.project-files :as files]
|
||||
[uxbox.services.queries.project-pages :refer [decode-row]]
|
||||
[uxbox.services.util :as su]
|
||||
[uxbox.common.pages :as cp]
|
||||
[uxbox.common.spec :as cs]
|
||||
[uxbox.util.exceptions :as ex]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.spec :as us]
|
||||
[uxbox.util.sql :as sql]
|
||||
[uxbox.util.uuid :as uuid]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
||||
;; TODO: validate `:data` and `:metadata`
|
||||
|
||||
(s/def ::id ::us/uuid)
|
||||
(s/def ::name ::us/string)
|
||||
(s/def ::data any?)
|
||||
(s/def ::user ::us/uuid)
|
||||
(s/def ::project-id ::us/uuid)
|
||||
(s/def ::metadata any?)
|
||||
(s/def ::ordering ::us/number)
|
||||
(s/def ::id ::cs/uuid)
|
||||
(s/def ::name ::cs/string)
|
||||
(s/def ::data ::cp/data)
|
||||
(s/def ::user ::cs/uuid)
|
||||
(s/def ::project-id ::cs/uuid)
|
||||
(s/def ::metadata ::cp/metadata)
|
||||
(s/def ::ordering ::cs/number)
|
||||
|
||||
;; --- Mutation: Create Page
|
||||
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
Buffer
|
||||
(->bytes [data] (.getBytes ^Buffer data))
|
||||
|
||||
;; org.jooq.JSONB
|
||||
;; (->bytes [data] (->bytes (.toString data)))
|
||||
|
||||
String
|
||||
(->bytes [data] (.getBytes ^String data "UTF-8")))
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
(:require [clojure.walk :as walk]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
;; TODO: move to uxbox.common.helpers
|
||||
|
||||
(defn dissoc-in
|
||||
[m [k & ks :as keys]]
|
||||
(if ks
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
"A helpers for work with exceptions."
|
||||
(:require [clojure.spec.alpha :as s]))
|
||||
|
||||
;; TODO: moved to uxbox.common.exceptions
|
||||
|
||||
(s/def ::type keyword?)
|
||||
(s/def ::code keyword?)
|
||||
(s/def ::mesage string?)
|
||||
|
|
|
@ -65,10 +65,6 @@
|
|||
(with-open [input (ByteArrayInputStream. data)]
|
||||
(read! (reader input opts)))
|
||||
|
||||
;; ;; TODO: temporal
|
||||
;; (instance? org.jooq.JSONB data)
|
||||
;; (decode (.toString data) opts)
|
||||
|
||||
(string? data)
|
||||
(decode (.getBytes data "UTF-8") opts)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue