Skip to content

Commit 7724c68

Browse files
committed
Postgres: domain service and tests ready
1 parent 8263408 commit 7724c68

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

webstore-demo/integrant-simple-server/src/clj/simpleserver/service/domain/domain_postgres.clj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,23 @@
3636
(get-product
3737
[_ _ pg-id p-id]
3838
(log/debug (str "ENTER get-product, pg-id: " pg-id ", p-id: " p-id))
39-
))
39+
(if-let [kv (sql-get-product db {:pg-id (str pg-id) :p-id (str p-id)})]
40+
[(:id kv)
41+
(:pg_id kv)
42+
(:title kv)
43+
(.toPlainString (.stripTrailingZeros (:price kv)))
44+
(:a_or_d kv)
45+
(str (:year kv))
46+
(:country kv)
47+
(:g_or_l kv)])))
4048

4149

4250
(comment
4351
(simpleserver.test-config/go)
52+
(simpleserver.test-config/halt)
4453
(simpleserver.test-config/test-env)
4554
(let [db (get-in (simpleserver.test-config/test-env) [:service :domain :db])]
4655
(sql-get-products db {:pg-id (str 2)}))
56+
(let [db (get-in (simpleserver.test-config/test-env) [:service :domain :db])]
57+
(sql-get-product db {:pg-id (str 2) :p-id (str 4)}))
4758
)

webstore-demo/integrant-simple-server/test/clj/simpleserver/service/domain/domain_test.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
; Rich comment.
5555
#_(comment
5656
(ss-tc/go)
57+
(ss-domain-s/get-product (ss-tc/test-env) 2 4)
5758
(ss-test-service/init-domain (ss-tc/test-env))
5859
(ss-tc/test-env)
5960
)

0 commit comments

Comments
 (0)