Skip to content

Instantly share code, notes, and snippets.

@kenbier
Last active December 20, 2016 22:53
Show Gist options
  • Select an option

  • Save kenbier/f2667be66a7a79bc0a5ab845d81002a2 to your computer and use it in GitHub Desktop.

Select an option

Save kenbier/f2667be66a7a79bc0a5ab845d81002a2 to your computer and use it in GitHub Desktop.

Revisions

  1. kenbier revised this gist Dec 20, 2016. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    q
    {:keys [history comment support-id] :as params}]
    {:action (fn []
    (let [{:keys [db/id user/adstage-id user/email]} user
    (let [{:keys [db/id user/email]} user
    connection (db/get-connection database)
    session {:history history
    :comment comment}]
    @@ -14,6 +14,5 @@
    ;; Store the key to the user session.
    @(d/transact connection [[:db/add id :user/sessions support-id]])
    ;; Sumologic will search for this log.
    (timbre/error "new support request recorded:"
    (:user/email user) support-id comment)
    (timbre/error "new support request recorded:" email support-id comment)
    support-id))})
  2. kenbier revised this gist Dec 20, 2016. 1 changed file with 6 additions and 9 deletions.
    15 changes: 6 additions & 9 deletions support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,19 @@
    (defusecase api-mutate 'support-request/new with policy/existence
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env} q
    (defmethod api-mutate 'support-request/new
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env}
    q
    {:keys [history comment support-id] :as params}]
    {:action (fn []
    (let [{:keys [db/id user/adstage-id user/email]} user

    ;; Use the users email as the comment if it is missing.
    support-comment (or comment email "")
    connection (db/get-connection database)
    session {:history history
    :comment support-comment}]
    :comment comment}]

    ;; Store the user session.
    (kv/store blob-store support-id session)
    ;; Store the key to the user session.
    @(d/transact connection [[:db/add id :user/sessions support-id]])

    ;; Sumologic will search for this log!
    ;; Sumologic will search for this log.
    (timbre/error "new support request recorded:"
    (:user/email user) support-id comment)
    support-id))})
  3. kenbier revised this gist Dec 20, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    (defmethod api-mutate 'support-request/new
    (defusecase api-mutate 'support-request/new with policy/existence
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env} q
    {:keys [history comment support-id] :as params}]
  4. kenbier revised this gist Dec 20, 2016. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,22 @@
    (defusecase api-mutate 'support-request/new with policy/existence
    (defmethod api-mutate 'support-request/new
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env} q
    {:keys [history comment support-id] :as params}]
    {:action (fn []
    (let [{:keys [db/id user/adstage-id user/email]} user

    ;; use the users email as the comment if it is missing.
    ;; Use the users email as the comment if it is missing.
    support-comment (or comment email "")
    connection (db/get-connection database)
    session {:history history
    :comment support-comment}]

    ;; Store the user session.
    (kv/store blob-store support-id session)
    ;; Store the key to the user session.
    @(d/transact connection [[:db/add id :user/sessions support-id]])

    ;; Sumologic will search for this log!
    (timbre/error "new support request recorded:"
    (:user/email user) support-id comment)
    (ci/perform-async twarc-scheduler support-id)
    support-id))})
  5. kenbier revised this gist Nov 6, 2016. 1 changed file with 0 additions and 14 deletions.
    14 changes: 0 additions & 14 deletions support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,3 @@
    (ns arc.use-cases.support-request-new
    (:require
    [arc.api.helper :refer :all]
    [arc.use-cases :refer [api-mutate api-read]]
    [arc.util :refer [inspect] :as util]
    [arc.helpers :as h]
    [arc.components.key-value-store :as kv]
    [datomic.api :as d]
    [lib.policy :as policy]
    [lib.use-case :refer [defusecase]]
    [untangled.datomic.protocols :as db]
    [taoensso.timbre :as timbre]
    [arc.jobs.check-invariants :as ci]))

    (defusecase api-mutate 'support-request/new with policy/existence
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env} q
  6. kenbier created this gist Nov 6, 2016.
    32 changes: 32 additions & 0 deletions support_request_new.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    (ns arc.use-cases.support-request-new
    (:require
    [arc.api.helper :refer :all]
    [arc.use-cases :refer [api-mutate api-read]]
    [arc.util :refer [inspect] :as util]
    [arc.helpers :as h]
    [arc.components.key-value-store :as kv]
    [datomic.api :as d]
    [lib.policy :as policy]
    [lib.use-case :refer [defusecase]]
    [untangled.datomic.protocols :as db]
    [taoensso.timbre :as timbre]
    [arc.jobs.check-invariants :as ci]))

    (defusecase api-mutate 'support-request/new with policy/existence
    [{:keys [blob-store twarc-scheduler
    database current/user] :as env} q
    {:keys [history comment support-id] :as params}]
    {:action (fn []
    (let [{:keys [db/id user/adstage-id user/email]} user

    ;; use the users email as the comment if it is missing.
    support-comment (or comment email "")
    connection (db/get-connection database)
    session {:history history
    :comment support-comment}]
    (kv/store blob-store support-id session)
    @(d/transact connection [[:db/add id :user/sessions support-id]])
    (timbre/error "new support request recorded:"
    (:user/email user) support-id comment)
    (ci/perform-async twarc-scheduler support-id)
    support-id))})