Line data Source code
1 4 : (ns matchscore.db.postgres.payment-reminder-neighbours
2 : (:require
3 : [next.jdbc :as jdbc]
4 : [next.jdbc.result-set :as rs]))
5 :
6 :
7 16 : (def ^:private jdbc-options {:builder-fn rs/as-unqualified-kebab-maps})
8 :
9 :
10 4 : (defn sibling-starts
11 : "Returns non-cancelled starts for sibling events in the inclusive time range."
12 : [ds template-id event-id from to]
13 2 : (->>
14 2 : (jdbc/execute!
15 1 : ds
16 2 : ["SELECT datetime_start
17 : FROM events
18 : WHERE template_id = ?::uuid
19 : AND uuid <> ?::uuid
20 : AND state <> 'cancelled'
21 : AND datetime_start BETWEEN ? AND ?
22 : ORDER BY datetime_start"
23 1 : template-id
24 1 : event-id
25 3 : (java.sql.Timestamp/from from)
26 3 : (java.sql.Timestamp/from to)]
27 1 : jdbc-options)
28 1 : (mapv :datetime-start)))
|