mirror of
https://github.com/penpot/penpot.git
synced 2025-06-26 08:06:58 +02:00
♻️ Make the namespacing independent of the branding.
This commit is contained in:
parent
aaf8b71837
commit
6c67c3c71b
305 changed files with 2399 additions and 2580 deletions
|
@ -7,20 +7,20 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.cli.fixtures
|
||||
(ns app.cli.fixtures
|
||||
"A initial fixtures."
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[mount.core :as mount]
|
||||
[sodi.pwhash :as pwhash]
|
||||
[uxbox.common.data :as d]
|
||||
[uxbox.common.pages :as cp]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.migrations]
|
||||
[uxbox.services.mutations.profile :as profile]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.data :as d]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.migrations]
|
||||
[app.services.mutations.profile :as profile]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
(defn- mk-uuid
|
||||
[prefix & args]
|
||||
|
@ -86,7 +86,7 @@
|
|||
:fullname (str "Profile " index)
|
||||
:password "123123"
|
||||
:demo? true
|
||||
:email (str "profile" index ".test@uxbox.io")})))
|
||||
:email (str "profile" index ".test@app.io")})))
|
||||
|
||||
create-profiles
|
||||
(fn [conn]
|
||||
|
@ -264,9 +264,9 @@
|
|||
[{:keys [preset]
|
||||
:or {preset :small}}]
|
||||
(try
|
||||
(-> (mount/only #{#'uxbox.config/config
|
||||
#'uxbox.db/pool
|
||||
#'uxbox.migrations/migrations})
|
||||
(-> (mount/only #{#'app.config/config
|
||||
#'app.db/pool
|
||||
#'app.migrations/migrations})
|
||||
(mount/start))
|
||||
(run* preset)
|
||||
(catch Exception e
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.cli.media-loader
|
||||
(ns app.cli.media-loader
|
||||
"Media libraries importer (command line helper)."
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
|
@ -15,17 +15,17 @@
|
|||
[clojure.java.io :as io]
|
||||
[mount.core :as mount]
|
||||
[datoteka.core :as fs]
|
||||
[uxbox.config]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.media]
|
||||
[uxbox.media-storage]
|
||||
[uxbox.migrations]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.services.mutations.projects :as projects]
|
||||
[uxbox.services.mutations.files :as files]
|
||||
[uxbox.services.mutations.colors :as colors]
|
||||
[uxbox.services.mutations.media :as media])
|
||||
[app.config]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.media]
|
||||
[app.media-storage]
|
||||
[app.migrations]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.services.mutations.projects :as projects]
|
||||
[app.services.mutations.files :as files]
|
||||
[app.services.mutations.colors :as colors]
|
||||
[app.services.mutations.media :as media])
|
||||
(:import
|
||||
java.io.PushbackReader))
|
||||
|
||||
|
@ -219,11 +219,11 @@
|
|||
(let [path (validate-path path)]
|
||||
|
||||
(try
|
||||
(-> (mount/only #{#'uxbox.config/config
|
||||
#'uxbox.db/pool
|
||||
#'uxbox.migrations/migrations
|
||||
#'uxbox.media/semaphore
|
||||
#'uxbox.media-storage/media-storage})
|
||||
(-> (mount/only #{#'app.config/config
|
||||
#'app.db/pool
|
||||
#'app.migrations/migrations
|
||||
#'app.media/semaphore
|
||||
#'app.media-storage/media-storage})
|
||||
(mount/start))
|
||||
(run* path)
|
||||
(catch Exception e
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.config
|
||||
(ns app.config
|
||||
"A configuration management."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
|
@ -15,16 +15,16 @@
|
|||
[cuerdas.core :as str]
|
||||
[environ.core :refer [env]]
|
||||
[mount.core :refer [defstate]]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
(def defaults
|
||||
{:http-server-port 6060
|
||||
:http-server-cors "http://localhost:3449"
|
||||
:database-uri "postgresql://127.0.0.1/uxbox"
|
||||
:database-username "uxbox"
|
||||
:database-password "uxbox"
|
||||
:database-uri "postgresql://127.0.0.1/app"
|
||||
:database-username "app"
|
||||
:database-password "app"
|
||||
|
||||
:media-directory "resources/public/media"
|
||||
:assets-directory "resources/public/static"
|
||||
|
@ -161,7 +161,10 @@
|
|||
(fn [acc k v]
|
||||
(cond-> acc
|
||||
(str/starts-with? (name k) "uxbox-")
|
||||
(assoc (keyword (subs (name k) 6)) v)))
|
||||
(assoc (keyword (subs (name k) 6)) v)
|
||||
|
||||
(str/starts-with? (name k) "app-")
|
||||
(assoc (keyword (subs (name k) 4)) v)))
|
||||
{}
|
||||
env))
|
||||
|
||||
|
@ -175,9 +178,9 @@
|
|||
[env]
|
||||
(assoc (read-config env)
|
||||
:redis-uri "redis://redis/1"
|
||||
:database-uri "postgresql://postgres/uxbox_test"
|
||||
:media-directory "/tmp/uxbox/media"
|
||||
:assets-directory "/tmp/uxbox/static"
|
||||
:database-uri "postgresql://postgres/app_test"
|
||||
:media-directory "/tmp/app/media"
|
||||
:assets-directory "/tmp/app/static"
|
||||
:migrations-verbose false))
|
||||
|
||||
(defstate config
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.db
|
||||
(ns app.db
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.data.json :as json]
|
||||
|
@ -18,12 +18,12 @@
|
|||
[next.jdbc.result-set :as jdbc-rs]
|
||||
[next.jdbc.sql :as jdbc-sql]
|
||||
[next.jdbc.sql.builder :as jdbc-bld]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.util.transit :as t]
|
||||
[uxbox.util.data :as data])
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.time :as dt]
|
||||
[app.util.transit :as t]
|
||||
[app.util.data :as data])
|
||||
(:import
|
||||
org.postgresql.util.PGobject
|
||||
org.postgresql.util.PGInterval
|
|
@ -7,17 +7,17 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.emails
|
||||
(ns app.emails
|
||||
"Main api for send emails."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.emails :as emails]))
|
||||
[app.config :as cfg]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.emails :as emails]))
|
||||
|
||||
;; --- Defaults
|
||||
|
|
@ -7,24 +7,24 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http
|
||||
(ns app.http
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[mount.core :as mount :refer [defstate]]
|
||||
[reitit.ring :as rring]
|
||||
[ring.adapter.jetty9 :as jetty]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.http.auth :as auth]
|
||||
[uxbox.http.auth.google :as google]
|
||||
[uxbox.http.auth.ldap :as ldap]
|
||||
[uxbox.http.debug :as debug]
|
||||
[uxbox.http.errors :as errors]
|
||||
[uxbox.http.handlers :as handlers]
|
||||
[uxbox.http.middleware :as middleware]
|
||||
[uxbox.http.session :as session]
|
||||
[uxbox.http.ws :as ws]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.services.notifications :as usn]))
|
||||
[app.config :as cfg]
|
||||
[app.http.auth :as auth]
|
||||
[app.http.auth.google :as google]
|
||||
[app.http.auth.ldap :as ldap]
|
||||
[app.http.debug :as debug]
|
||||
[app.http.errors :as errors]
|
||||
[app.http.handlers :as handlers]
|
||||
[app.http.middleware :as middleware]
|
||||
[app.http.session :as session]
|
||||
[app.http.ws :as ws]
|
||||
[app.metrics :as mtx]
|
||||
[app.services.notifications :as usn]))
|
||||
|
||||
(defn- create-router
|
||||
[]
|
|
@ -7,12 +7,12 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http.auth
|
||||
(ns app.http.auth
|
||||
(:require
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.http.session :as session]
|
||||
[uxbox.services.mutations :as sm]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.http.session :as session]
|
||||
[app.services.mutations :as sm]))
|
||||
|
||||
(defn login-handler
|
||||
[req]
|
|
@ -7,18 +7,18 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http.auth.google
|
||||
(ns app.http.auth.google
|
||||
(:require
|
||||
[clojure.data.json :as json]
|
||||
[clojure.tools.logging :as log]
|
||||
[lambdaisland.uri :as uri]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.tokens :as tokens]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.http.session :as session]
|
||||
[uxbox.util.http :as http]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.tokens :as tokens]
|
||||
[app.services.mutations :as sm]
|
||||
[app.http.session :as session]
|
||||
[app.util.http :as http]))
|
||||
|
||||
(def base-goauth-uri "https://accounts.google.com/o/oauth2/v2/auth")
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
(ns uxbox.http.auth.ldap
|
||||
(ns app.http.auth.ldap
|
||||
(:require
|
||||
[clj-ldap.client :as client]
|
||||
[clojure.set :as set]
|
||||
[mount.core :refer [defstate]]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.http.session :as session]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.services.mutations :as sm]
|
||||
[app.http.session :as session]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
|
|
@ -4,14 +4,14 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.http.debug
|
||||
(ns app.http.debug
|
||||
"Debug related handlers."
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[promesa.core :as p]
|
||||
[uxbox.http.errors :as errors]
|
||||
[uxbox.http.session :as session]
|
||||
[uxbox.common.uuid :as uuid]))
|
||||
[app.http.errors :as errors]
|
||||
[app.http.session :as session]
|
||||
[app.common.uuid :as uuid]))
|
||||
|
||||
(defn emails-list
|
||||
[req]
|
|
@ -4,12 +4,12 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.http.errors
|
||||
(ns app.http.errors
|
||||
"A errors handling for the http server."
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.metrics :as mtx]
|
||||
[app.metrics :as mtx]
|
||||
[io.aviso.exception :as e]))
|
||||
|
||||
(defmulti handle-exception
|
|
@ -7,14 +7,14 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http.handlers
|
||||
(ns app.http.handlers
|
||||
(:require
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.emails :as emails]
|
||||
[uxbox.http.session :as session]
|
||||
[uxbox.services.init]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.queries :as sq]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.emails :as emails]
|
||||
[app.http.session :as session]
|
||||
[app.services.init]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.queries :as sq]))
|
||||
|
||||
(def unauthorized-services
|
||||
#{:create-demo-profile
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.http.middleware
|
||||
(ns app.http.middleware
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[ring.middleware.cookies :refer [wrap-cookies]]
|
||||
|
@ -15,10 +15,10 @@
|
|||
[ring.middleware.multipart-params :refer [wrap-multipart-params]]
|
||||
[ring.middleware.params :refer [wrap-params]]
|
||||
[ring.middleware.resource :refer [wrap-resource]]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.util.transit :as t]))
|
||||
[app.metrics :as mtx]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.util.transit :as t]))
|
||||
|
||||
(defn- wrap-parse-request-body
|
||||
[handler]
|
|
@ -7,10 +7,10 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http.session
|
||||
(ns app.http.session
|
||||
(:require
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.tokens :as tokens]))
|
||||
[app.db :as db]
|
||||
[app.services.tokens :as tokens]))
|
||||
|
||||
(defn extract-auth-token
|
||||
[request]
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.http.ws
|
||||
(ns app.http.ws
|
||||
"Web Socket handlers"
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
|
@ -16,10 +16,10 @@
|
|||
[ring.middleware.cookies :refer [wrap-cookies]]
|
||||
[ring.middleware.keyword-params :refer [wrap-keyword-params]]
|
||||
[ring.middleware.params :refer [wrap-params]]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.http.session :refer [wrap-session]]
|
||||
[uxbox.services.notifications :as nf]))
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.http.session :refer [wrap-session]]
|
||||
[app.services.notifications :as nf]))
|
||||
|
||||
(s/def ::file-id ::us/uuid)
|
||||
(s/def ::session-id ::us/uuid)
|
|
@ -7,13 +7,13 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.main
|
||||
(ns app.main
|
||||
(:require
|
||||
[mount.core :as mount]))
|
||||
|
||||
(defn- enable-asserts
|
||||
[_]
|
||||
(let [m (System/getProperty "uxbox.enable-asserts")]
|
||||
(let [m (System/getProperty "app.enable-asserts")]
|
||||
(or (nil? m) (= "true" m))))
|
||||
|
||||
;; Set value for all new threads bindings.
|
||||
|
@ -26,11 +26,11 @@
|
|||
|
||||
(defn run
|
||||
[params]
|
||||
(require 'uxbox.config
|
||||
'uxbox.migrations
|
||||
'uxbox.worker
|
||||
'uxbox.media
|
||||
'uxbox.http)
|
||||
(require 'app.config
|
||||
'app.migrations
|
||||
'app.worker
|
||||
'app.media
|
||||
'app.http)
|
||||
(mount/start))
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.media
|
||||
(ns app.media
|
||||
"Media postprocessing."
|
||||
(:require
|
||||
[clojure.core.async :as a]
|
||||
|
@ -15,14 +15,14 @@
|
|||
[clojure.spec.alpha :as s]
|
||||
[datoteka.core :as fs]
|
||||
[mount.core :refer [defstate]]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.common.data :as d]
|
||||
[uxbox.common.media :as cm]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.media-storage :as mst]
|
||||
[uxbox.util.storage :as ust]
|
||||
[uxbox.util.http :as http])
|
||||
[app.config :as cfg]
|
||||
[app.common.data :as d]
|
||||
[app.common.media :as cm]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.media-storage :as mst]
|
||||
[app.util.storage :as ust]
|
||||
[app.util.http :as http])
|
||||
(:import
|
||||
java.io.ByteArrayInputStream
|
||||
java.io.InputStream
|
|
@ -7,15 +7,15 @@
|
|||
;;
|
||||
;; Copyright (c) 2017-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.media-storage
|
||||
"A media storage impl for uxbox."
|
||||
(ns app.media-storage
|
||||
"A media storage impl for app."
|
||||
(:require
|
||||
[mount.core :refer [defstate]]
|
||||
[clojure.java.io :as io]
|
||||
[cuerdas.core :as str]
|
||||
[datoteka.core :as fs]
|
||||
[uxbox.util.storage :as ust]
|
||||
[uxbox.config :refer [config]]))
|
||||
[app.util.storage :as ust]
|
||||
[app.config :refer [config]]))
|
||||
|
||||
;; --- State
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.metrics
|
||||
(ns app.metrics
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[cuerdas.core :as str])
|
|
@ -7,12 +7,12 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.migrations
|
||||
(ns app.migrations
|
||||
(:require
|
||||
[mount.core :as mount :refer [defstate]]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.util.migrations :as mg]))
|
||||
[app.db :as db]
|
||||
[app.config :as cfg]
|
||||
[app.util.migrations :as mg]))
|
||||
|
||||
(def +migrations+
|
||||
{:name "uxbox-main"
|
|
@ -4,16 +4,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.redis
|
||||
(ns app.redis
|
||||
(:refer-clojure :exclude [run!])
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[lambdaisland.uri :refer [uri]]
|
||||
[mount.core :as mount :refer [defstate]]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.util.data :as data]
|
||||
[uxbox.util.redis :as redis])
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.util.data :as data]
|
||||
[app.util.redis :as redis])
|
||||
(:import
|
||||
java.lang.AutoCloseable))
|
||||
|
40
backend/src/app/services/init.clj
Normal file
40
backend/src/app/services/init.clj
Normal file
|
@ -0,0 +1,40 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
;; defined by the Mozilla Public License, v. 2.0.
|
||||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns app.services.init
|
||||
"A initialization of services."
|
||||
(:require
|
||||
[mount.core :as mount :refer [defstate]]))
|
||||
|
||||
(defn- load-query-services
|
||||
[]
|
||||
(require 'app.services.queries.media)
|
||||
(require 'app.services.queries.colors)
|
||||
(require 'app.services.queries.projects)
|
||||
(require 'app.services.queries.files)
|
||||
(require 'app.services.queries.pages)
|
||||
(require 'app.services.queries.profile)
|
||||
(require 'app.services.queries.recent-files)
|
||||
(require 'app.services.queries.viewer))
|
||||
|
||||
(defn- load-mutation-services
|
||||
[]
|
||||
(require 'app.services.mutations.demo)
|
||||
(require 'app.services.mutations.media)
|
||||
(require 'app.services.mutations.colors)
|
||||
(require 'app.services.mutations.projects)
|
||||
(require 'app.services.mutations.files)
|
||||
(require 'app.services.mutations.pages)
|
||||
(require 'app.services.mutations.profile))
|
||||
|
||||
(defstate query-services
|
||||
:start (load-query-services))
|
||||
|
||||
(defstate mutation-services
|
||||
:start (load-mutation-services))
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.middleware
|
||||
(ns app.services.middleware
|
||||
"Common middleware for services."
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[expound.alpha :as expound]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.metrics :as mtx]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.metrics :as mtx]))
|
||||
|
||||
(defn wrap-spec
|
||||
[handler]
|
|
@ -7,10 +7,10 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.mutations
|
||||
(ns app.services.mutations
|
||||
(:require
|
||||
[uxbox.services.middleware :as middleware]
|
||||
[uxbox.util.dispatcher :as uds]))
|
||||
[app.services.middleware :as middleware]
|
||||
[app.util.dispatcher :as uds]))
|
||||
|
||||
(uds/defservice handle
|
||||
:dispatch-by ::type
|
|
@ -7,18 +7,18 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.colors
|
||||
(ns app.services.mutations.colors
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.queries.teams :as teams]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.queries.teams :as teams]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,20 +7,20 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.demo
|
||||
(ns app.services.mutations.demo
|
||||
"A demo specific mutations."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[sodi.prng]
|
||||
[sodi.util]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.mutations.profile :as profile]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.util.time :as tm]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.mutations.profile :as profile]
|
||||
[app.tasks :as tasks]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.time :as tm]))
|
||||
|
||||
(sm/defmutation ::create-demo-profile
|
||||
[_]
|
|
@ -7,24 +7,24 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.files
|
||||
(ns app.services.mutations.files
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[datoteka.core :as fs]
|
||||
[promesa.core :as p]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.pages :as cp]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.mutations.projects :as proj]
|
||||
[uxbox.services.queries.files :as files]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.storage :as ust]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.mutations.projects :as proj]
|
||||
[app.services.queries.files :as files]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.storage :as ust]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,23 +7,23 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.mutations.media
|
||||
(ns app.services.mutations.media
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[datoteka.core :as fs]
|
||||
[uxbox.common.media :as cm]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.media :as media]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.queries.teams :as teams]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.media-storage :as mst]
|
||||
[uxbox.util.storage :as ust]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.media :as cm]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.media :as media]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.queries.teams :as teams]
|
||||
[app.tasks :as tasks]
|
||||
[app.media-storage :as mst]
|
||||
[app.util.storage :as ust]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
(def thumbnail-options
|
||||
{:width 100
|
||||
|
@ -46,16 +46,16 @@
|
|||
(declare persist-media-object-on-fs)
|
||||
(declare persist-media-thumbnail-on-fs)
|
||||
|
||||
(s/def :uxbox$upload/filename ::us/string)
|
||||
(s/def :uxbox$upload/size ::us/integer)
|
||||
(s/def :uxbox$upload/content-type cm/valid-media-types)
|
||||
(s/def :uxbox$upload/tempfile any?)
|
||||
(s/def :app$upload/filename ::us/string)
|
||||
(s/def :app$upload/size ::us/integer)
|
||||
(s/def :app$upload/content-type cm/valid-media-types)
|
||||
(s/def :app$upload/tempfile any?)
|
||||
|
||||
(s/def ::upload
|
||||
(s/keys :req-un [:uxbox$upload/filename
|
||||
:uxbox$upload/size
|
||||
:uxbox$upload/tempfile
|
||||
:uxbox$upload/content-type]))
|
||||
(s/keys :req-un [:app$upload/filename
|
||||
:app$upload/size
|
||||
:app$upload/tempfile
|
||||
:app$upload/content-type]))
|
||||
|
||||
(s/def ::content ::upload)
|
||||
|
|
@ -7,25 +7,25 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.pages
|
||||
(ns app.services.mutations.pages
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.data :as d]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.pages :as cp]
|
||||
[uxbox.common.pages-migrations :as pmg]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.queries.files :as files]
|
||||
[uxbox.services.queries.pages :refer [decode-row]]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.redis :as redis]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.util.transit :as t]))
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages-migrations :as pmg]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.queries.files :as files]
|
||||
[app.services.queries.pages :refer [decode-row]]
|
||||
[app.tasks :as tasks]
|
||||
[app.redis :as redis]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.time :as dt]
|
||||
[app.util.transit :as t]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.profile
|
||||
(ns app.services.mutations.profile
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -17,25 +17,25 @@
|
|||
[sodi.prng]
|
||||
[sodi.pwhash]
|
||||
[sodi.util]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.common.media :as cm]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.emails :as emails]
|
||||
[uxbox.media :as media]
|
||||
[uxbox.media-storage :as mst]
|
||||
[uxbox.services.tokens :as tokens]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.services.mutations.media :as media-mutations]
|
||||
[uxbox.services.mutations.projects :as projects]
|
||||
[uxbox.services.mutations.teams :as teams]
|
||||
[uxbox.services.queries.profile :as profile]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.storage :as ust]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.media :as cm]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.emails :as emails]
|
||||
[app.media :as media]
|
||||
[app.media-storage :as mst]
|
||||
[app.services.tokens :as tokens]
|
||||
[app.services.mutations :as sm]
|
||||
[app.services.mutations.media :as media-mutations]
|
||||
[app.services.mutations.projects :as projects]
|
||||
[app.services.mutations.teams :as teams]
|
||||
[app.services.queries.profile :as profile]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.storage :as ust]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,17 +7,17 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.projects
|
||||
(ns app.services.mutations.projects
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,15 +7,15 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.mutations.teams
|
||||
(ns app.services.mutations.teams
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.mutations :as sm]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.services.mutations :as sm]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,20 +7,20 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.notifications
|
||||
(ns app.services.notifications
|
||||
"A websocket based notifications mechanism."
|
||||
(:require
|
||||
[clojure.core.async :as a :refer [>! <!]]
|
||||
[clojure.tools.logging :as log]
|
||||
[promesa.core :as p]
|
||||
[ring.adapter.jetty9 :as jetty]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.redis :as redis]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.util.transit :as t]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.redis :as redis]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.time :as dt]
|
||||
[app.util.transit :as t]))
|
||||
|
||||
(defmacro go-try
|
||||
[& body]
|
|
@ -7,10 +7,10 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.queries
|
||||
(ns app.services.queries
|
||||
(:require
|
||||
[uxbox.services.middleware :as middleware]
|
||||
[uxbox.util.dispatcher :as uds]))
|
||||
[app.services.middleware :as middleware]
|
||||
[app.util.dispatcher :as uds]))
|
||||
|
||||
(uds/defservice handle
|
||||
:dispatch-by ::type
|
|
@ -7,19 +7,19 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.colors
|
||||
(ns app.services.queries.colors
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[promesa.exec :as px]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.services.queries.teams :as teams]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.data :as data]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.services.queries :as sq]
|
||||
[app.services.queries.teams :as teams]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.data :as data]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.files
|
||||
(ns app.services.queries.files
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.media :as media]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.media :as media]
|
||||
[app.services.queries :as sq]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
(declare decode-row)
|
||||
|
|
@ -7,15 +7,15 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.media
|
||||
(ns app.services.queries.media
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.media :as media]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.services.queries.teams :as teams]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.media :as media]
|
||||
[app.services.queries :as sq]
|
||||
[app.services.queries.teams :as teams]))
|
||||
|
||||
(s/def ::id ::us/uuid)
|
||||
(s/def ::name ::us/string)
|
|
@ -7,17 +7,17 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.pages
|
||||
(ns app.services.queries.pages
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.pages-migrations :as pmg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.services.queries.files :as files]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.spec :as us]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pages-migrations :as pmg]
|
||||
[app.db :as db]
|
||||
[app.services.queries :as sq]
|
||||
[app.services.queries.files :as files]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -4,16 +4,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.profile
|
||||
(ns app.services.queries.profile
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.media :as media]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.media :as media]
|
||||
[app.services.queries :as sq]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -4,14 +4,14 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.projects
|
||||
(ns app.services.queries.projects
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.services.queries :as sq]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
(declare decode-row)
|
||||
|
|
@ -7,15 +7,15 @@
|
|||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.recent-files
|
||||
(ns app.services.queries.recent-files
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.services.queries.projects :refer [retrieve-projects]]
|
||||
[uxbox.services.queries.files :refer [decode-row]]))
|
||||
[app.db :as db]
|
||||
[app.common.spec :as us]
|
||||
[app.services.queries :as sq]
|
||||
[app.services.queries.projects :refer [retrieve-projects]]
|
||||
[app.services.queries.files :refer [decode-row]]))
|
||||
|
||||
(def ^:private sql:project-files-recent
|
||||
"select distinct
|
|
@ -7,15 +7,15 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.queries.teams
|
||||
(ns app.services.queries.teams
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.util.blob :as blob]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.services.queries :as sq]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; --- Team Edition Permissions
|
||||
|
|
@ -7,21 +7,21 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.queries.viewer
|
||||
(ns app.services.queries.viewer
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[promesa.core :as p]
|
||||
[promesa.exec :as px]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.services.queries :as sq]
|
||||
[uxbox.services.queries.files :as files]
|
||||
[uxbox.services.queries.media :as media-queries]
|
||||
[uxbox.services.queries.pages :as pages]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.data :as data]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.services.queries :as sq]
|
||||
[app.services.queries.files :as files]
|
||||
[app.services.queries.media :as media-queries]
|
||||
[app.services.queries.pages :as pages]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.data :as data]))
|
||||
|
||||
;; --- Helpers & Specs
|
||||
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.services.tokens
|
||||
(ns app.services.tokens
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[sodi.prng]
|
||||
[sodi.util]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.db :as db]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.util.time :as dt]
|
||||
[app.db :as db]))
|
||||
|
||||
(defn next-token
|
||||
([] (next-token 96))
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks
|
||||
(ns app.tasks
|
||||
(:require
|
||||
[cuerdas.core :as str]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.metrics :as mtx]))
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.util.time :as dt]
|
||||
[app.metrics :as mtx]))
|
||||
|
||||
(s/def ::name ::us/string)
|
||||
(s/def ::delay
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.delete-object
|
||||
(ns app.tasks.delete-object
|
||||
"Generic task for permanent deletion of objects."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.storage :as ust]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.storage :as ust]))
|
||||
|
||||
(s/def ::type keyword?)
|
||||
(s/def ::id ::us/uuid)
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.delete-profile
|
||||
(ns app.tasks.delete-profile
|
||||
"Task for permanent deletion of profiles."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.storage :as ust]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.storage :as ust]))
|
||||
|
||||
(declare delete-profile-data)
|
||||
(declare delete-teams)
|
|
@ -7,21 +7,21 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.gc
|
||||
(ns app.tasks.gc
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[cuerdas.core :as str]
|
||||
[postal.core :as postal]
|
||||
[promesa.core :as p]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.media-storage :as mst]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.storage :as ust]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.tasks :as tasks]
|
||||
[app.media-storage :as mst]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.storage :as ust]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Task: Remove deleted media
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.tasks.impl
|
||||
(ns app.tasks.impl
|
||||
"Async tasks implementation."
|
||||
(:require
|
||||
[cuerdas.core :as str]
|
||||
|
@ -15,13 +15,13 @@
|
|||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[promesa.exec :as px]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.util.async :as aa]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.time :as dt])
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.util.async :as aa]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.time :as dt])
|
||||
(:import
|
||||
java.util.concurrent.ScheduledExecutorService
|
||||
java.util.concurrent.Executors
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.remove-media
|
||||
(ns app.tasks.remove-media
|
||||
"Demo accounts garbage collector."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.media-storage :as mst]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.storage :as ust]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.media-storage :as mst]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.storage :as ust]))
|
||||
|
||||
(s/def ::path ::us/not-empty-string)
|
||||
(s/def ::props
|
|
@ -7,16 +7,16 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.sendmail
|
||||
(ns app.tasks.sendmail
|
||||
(:require
|
||||
[clojure.data.json :as json]
|
||||
[clojure.tools.logging :as log]
|
||||
[postal.core :as postal]
|
||||
[uxbox.common.data :as d]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.util.http :as http]))
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.http :as http]))
|
||||
|
||||
(defmulti sendmail (fn [config email] (:sendmail-backend config)))
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
:context result))))
|
||||
|
||||
(defn handler
|
||||
{:uxbox.tasks/name "sendmail"}
|
||||
{:app.tasks/name "sendmail"}
|
||||
[{:keys [props] :as task}]
|
||||
(sendmail cfg/config props))
|
||||
|
|
@ -7,17 +7,17 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.tasks.trim-file
|
||||
(ns app.tasks.trim-file
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.tasks :as tasks]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.time :as dt]))
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.time :as dt]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Task: Trim File
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.async
|
||||
(ns app.util.async
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
|
@ -7,10 +7,10 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.blob
|
||||
(ns app.util.blob
|
||||
"A generic blob storage encoding. Mainly used for
|
||||
page data, page options and txlog payload storage."
|
||||
(:require [uxbox.util.transit :as t])
|
||||
(:require [app.util.transit :as t])
|
||||
(:import
|
||||
java.io.ByteArrayInputStream
|
||||
java.io.ByteArrayOutputStream
|
|
@ -1,4 +1,4 @@
|
|||
(ns uxbox.util.cli
|
||||
(ns app.util.cli
|
||||
"Command line interface helpers.")
|
||||
|
||||
(defn exit!
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.closeable
|
||||
(ns app.util.closeable
|
||||
"A closeable abstraction. A drop in replacement for
|
||||
clojure builtin `with-open` syntax abstraction."
|
||||
(:refer-clojure :exclude [with-open]))
|
|
@ -4,12 +4,12 @@
|
|||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.data
|
||||
(ns app.util.data
|
||||
"Data transformations utils."
|
||||
(:require [clojure.walk :as walk]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
;; TODO: move to uxbox.common.helpers
|
||||
;; TODO: move to app.common.helpers
|
||||
|
||||
(defn dissoc-in
|
||||
[m [k & ks :as keys]]
|
|
@ -4,13 +4,13 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.dispatcher
|
||||
(ns app.util.dispatcher
|
||||
"A generic service dispatcher implementation."
|
||||
(:refer-clojure :exclude [defmethod])
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[expound.alpha :as expound]
|
||||
[uxbox.common.exceptions :as ex])
|
||||
[app.common.exceptions :as ex])
|
||||
(:import
|
||||
clojure.lang.IDeref
|
||||
clojure.lang.MapEntry
|
|
@ -4,14 +4,14 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.emails
|
||||
(ns app.util.emails
|
||||
(:require
|
||||
[clojure.java.io :as io]
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.util.template :as tmpl]))
|
||||
[app.common.spec :as us]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.util.template :as tmpl]))
|
||||
|
||||
;; --- Impl.
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.http
|
||||
(ns app.util.http
|
||||
"Http client abstraction layer."
|
||||
(:require
|
||||
[promesa.core :as p]
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.migrations
|
||||
(ns app.util.migrations
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[clojure.java.io :as io]
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.redis
|
||||
(ns app.util.redis
|
||||
"Asynchronous posgresql client."
|
||||
(:refer-clojure :exclude [run!])
|
||||
(:require
|
|
@ -22,7 +22,7 @@
|
|||
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(ns uxbox.util.sql
|
||||
(ns app.util.sql
|
||||
"A composable sql helpers."
|
||||
(:refer-clojure :exclude [test update set format])
|
||||
(:require [clojure.core :as c]
|
|
@ -7,7 +7,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.storage
|
||||
(ns app.util.storage
|
||||
"A local filesystem storage implementation."
|
||||
(:require
|
||||
[clojure.java.io :as io]
|
||||
|
@ -17,7 +17,7 @@
|
|||
[datoteka.proto :as fp]
|
||||
[sodi.prng :as sodi.prng]
|
||||
[sodi.util :as sodi.util]
|
||||
[uxbox.common.exceptions :as ex])
|
||||
[app.common.exceptions :as ex])
|
||||
(:import
|
||||
java.io.ByteArrayInputStream
|
||||
java.io.InputStream
|
|
@ -4,13 +4,13 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.svg
|
||||
(ns app.util.svg
|
||||
"Icons SVG parsing helpers."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.exceptions :as ex])
|
||||
[app.common.spec :as us]
|
||||
[app.common.exceptions :as ex])
|
||||
(:import
|
||||
org.jsoup.Jsoup
|
||||
org.jsoup.nodes.Attribute
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.template
|
||||
(ns app.util.template
|
||||
"A lightweight abstraction over mustache.java template engine.
|
||||
The documentation can be found: http://mustache.github.io/mustache.5.html"
|
||||
(:require
|
||||
|
@ -13,7 +13,7 @@
|
|||
[clojure.java.io :as io]
|
||||
[cuerdas.core :as str]
|
||||
[selmer.parser :as sp]
|
||||
[uxbox.common.exceptions :as ex]))
|
||||
[app.common.exceptions :as ex]))
|
||||
|
||||
;; (sp/cache-off!)
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
;;
|
||||
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.time
|
||||
(ns app.util.time
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[app.common.exceptions :as ex]
|
||||
[cognitect.transit :as t])
|
||||
(:import
|
||||
java.time.Instant
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
(defmethod print-method Duration
|
||||
[mv ^java.io.Writer writer]
|
||||
(.write writer (str "#uxbox/duration \"" (.toString ^Duration mv) "\"")))
|
||||
(.write writer (str "#app/duration \"" (.toString ^Duration mv) "\"")))
|
||||
|
||||
(defmethod print-dup Duration [o w]
|
||||
(print-method o w))
|
||||
|
@ -212,7 +212,7 @@
|
|||
|
||||
(defmethod print-method CronExpression
|
||||
[mv ^java.io.Writer writer]
|
||||
(.write writer (str "#uxbox/cron \"" (.toString ^CronExpression mv) "\"")))
|
||||
(.write writer (str "#app/cron \"" (.toString ^CronExpression mv) "\"")))
|
||||
|
||||
(defmethod print-dup CronExpression
|
||||
[o w]
|
||||
|
@ -248,7 +248,7 @@
|
|||
|
||||
(defmethod print-method Instant
|
||||
[mv ^java.io.Writer writer]
|
||||
(.write writer (str "#uxbox/instant \"" (.toString ^Instant mv) "\"")))
|
||||
(.write writer (str "#app/instant \"" (.toString ^Instant mv) "\"")))
|
||||
|
||||
(defmethod print-dup Instant [o w]
|
||||
(print-method o w))
|
|
@ -7,22 +7,22 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.util.transit
|
||||
(ns app.util.transit
|
||||
(:require
|
||||
[cognitect.transit :as t]
|
||||
[clojure.java.io :as io]
|
||||
[linked.core :as lk]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.util.data :as data]
|
||||
[uxbox.common.geom.point :as gpt]
|
||||
[uxbox.common.geom.matrix :as gmt])
|
||||
[app.util.time :as dt]
|
||||
[app.util.data :as data]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.matrix :as gmt])
|
||||
(:import
|
||||
linked.set.LinkedSet
|
||||
java.io.ByteArrayInputStream
|
||||
java.io.ByteArrayOutputStream
|
||||
java.io.File
|
||||
uxbox.common.geom.point.Point
|
||||
uxbox.common.geom.matrix.Matrix))
|
||||
app.common.geom.point.Point
|
||||
app.common.geom.matrix.Matrix))
|
||||
|
||||
;; --- Handlers
|
||||
|
|
@ -4,12 +4,12 @@
|
|||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.workers
|
||||
(ns app.util.workers
|
||||
"A distributed asynchronous tasks queue implementation on top
|
||||
of PostgreSQL reliable advirsory locking mechanism."
|
||||
#_(:require
|
||||
[suricatta.core :as sc]
|
||||
[uxbox.db :as db]))
|
||||
[app.db :as db]))
|
||||
|
||||
;; (defn- poll-for-task
|
||||
;; [conn queue]
|
|
@ -7,39 +7,39 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.worker
|
||||
(ns app.worker
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[mount.core :as mount :refer [defstate]]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.metrics :as mtx]
|
||||
[uxbox.tasks.delete-object]
|
||||
[uxbox.tasks.delete-profile]
|
||||
[uxbox.tasks.gc]
|
||||
[uxbox.tasks.remove-media]
|
||||
[uxbox.tasks.sendmail]
|
||||
[uxbox.tasks.trim-file]
|
||||
[uxbox.util.time :as dt]
|
||||
[uxbox.worker-impl :as impl]))
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.tasks.delete-object]
|
||||
[app.tasks.delete-profile]
|
||||
[app.tasks.gc]
|
||||
[app.tasks.remove-media]
|
||||
[app.tasks.sendmail]
|
||||
[app.tasks.trim-file]
|
||||
[app.util.time :as dt]
|
||||
[app.worker-impl :as impl]))
|
||||
|
||||
;; --- State initialization
|
||||
|
||||
(def ^:private tasks
|
||||
{"delete-profile" #'uxbox.tasks.delete-profile/handler
|
||||
"delete-object" #'uxbox.tasks.delete-object/handler
|
||||
"remove-media" #'uxbox.tasks.remove-media/handler
|
||||
"sendmail" #'uxbox.tasks.sendmail/handler})
|
||||
{"delete-profile" #'app.tasks.delete-profile/handler
|
||||
"delete-object" #'app.tasks.delete-object/handler
|
||||
"remove-media" #'app.tasks.remove-media/handler
|
||||
"sendmail" #'app.tasks.sendmail/handler})
|
||||
|
||||
(def ^:private schedule
|
||||
[{:id "remove-deleted-media"
|
||||
:cron (dt/cron "0 0 0 */1 * ? *") ;; daily
|
||||
:fn #'uxbox.tasks.gc/remove-deleted-media}
|
||||
:fn #'app.tasks.gc/remove-deleted-media}
|
||||
{:id "trim-file"
|
||||
:cron (dt/cron "0 0 0 */1 * ? *") ;; daily
|
||||
:fn #'uxbox.tasks.trim-file/handler}
|
||||
:fn #'app.tasks.trim-file/handler}
|
||||
])
|
||||
|
||||
|
|
@ -7,21 +7,21 @@
|
|||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
|
||||
(ns uxbox.worker-impl
|
||||
(ns app.worker-impl
|
||||
(:require
|
||||
[cuerdas.core :as str]
|
||||
[clojure.core.async :as a]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[promesa.exec :as px]
|
||||
[uxbox.common.exceptions :as ex]
|
||||
[uxbox.common.spec :as us]
|
||||
[uxbox.common.uuid :as uuid]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.util.async :as aa]
|
||||
[uxbox.util.blob :as blob]
|
||||
[uxbox.util.time :as dt])
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.util.async :as aa]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.time :as dt])
|
||||
(:import
|
||||
org.eclipse.jetty.util.thread.QueuedThreadPool
|
||||
java.util.concurrent.ExecutorService
|
|
@ -1,3 +1,3 @@
|
|||
{uxbox/instant uxbox.util.time/from-string
|
||||
uxbox/cron uxbox.util.time/cron
|
||||
uxbox/duration uxbox.util.time/duration}
|
||||
{app/instant app.util.time/from-string
|
||||
app/cron app.util.time/cron
|
||||
app/duration app.util.time/duration}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
;; defined by the Mozilla Public License, v. 2.0.
|
||||
;;
|
||||
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.services.init
|
||||
"A initialization of services."
|
||||
(:require
|
||||
[mount.core :as mount :refer [defstate]]))
|
||||
|
||||
(defn- load-query-services
|
||||
[]
|
||||
(require 'uxbox.services.queries.media)
|
||||
(require 'uxbox.services.queries.colors)
|
||||
(require 'uxbox.services.queries.projects)
|
||||
(require 'uxbox.services.queries.files)
|
||||
(require 'uxbox.services.queries.pages)
|
||||
(require 'uxbox.services.queries.profile)
|
||||
(require 'uxbox.services.queries.recent-files)
|
||||
(require 'uxbox.services.queries.viewer))
|
||||
|
||||
(defn- load-mutation-services
|
||||
[]
|
||||
(require 'uxbox.services.mutations.demo)
|
||||
(require 'uxbox.services.mutations.media)
|
||||
(require 'uxbox.services.mutations.colors)
|
||||
(require 'uxbox.services.mutations.projects)
|
||||
(require 'uxbox.services.mutations.files)
|
||||
(require 'uxbox.services.mutations.pages)
|
||||
(require 'uxbox.services.mutations.profile))
|
||||
|
||||
(defstate query-services
|
||||
:start (load-query-services))
|
||||
|
||||
(defstate mutation-services
|
||||
:start (load-mutation-services))
|
Loading…
Add table
Add a link
Reference in a new issue