add creation date/times to lists
This commit is contained in:
parent
6c06ebb758
commit
a23e780e0f
1
resources/migrations/00022_add_lists_timestamp.down.sql
Normal file
1
resources/migrations/00022_add_lists_timestamp.down.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE lists DROP COLUMN IF EXISTS created_at;
|
1
resources/migrations/00022_add_lists_timestamp.up.sql
Normal file
1
resources/migrations/00022_add_lists_timestamp.up.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE lists ADD COLUMN created_at TIMESTAMP NOT NULL DEFAULT NOW();
|
|
@ -9,7 +9,7 @@
|
|||
[mtgcoll.common :as c]
|
||||
[mtgcoll.client.auth :as auth]
|
||||
[mtgcoll.client.page :refer [set-active-breadcrumb! set-error!]]
|
||||
[mtgcoll.client.utils :refer [get-field-value]]
|
||||
[mtgcoll.client.utils :refer [get-field-value format-date]]
|
||||
[mtgcoll.client.components.cards :refer [card-list-table ->card-list-pager]]
|
||||
[mtgcoll.client.components.search :as s]
|
||||
[mtgcoll.client.components.utils :refer [click-to-edit-textarea markdown confirm-modal]]))
|
||||
|
@ -98,18 +98,20 @@
|
|||
{:bordered true :striped true :condensed true :hover true}
|
||||
[:thead
|
||||
[:tr
|
||||
[:th.col-sm-7 "Name"]
|
||||
[:th.col-sm-3 "Card Qualities?"]
|
||||
[:th.col-sm-6 "Name"]
|
||||
[:th.col-sm-2 "Created At"]
|
||||
[:th.col-sm-2 "Card Qualities?"]
|
||||
[:th.col-sm-2 "Cards"]]]
|
||||
[:tbody
|
||||
(doall
|
||||
(map
|
||||
(fn [{:keys [id name is_public require_qualities num_cards]}]
|
||||
(fn [{:keys [id name is_public require_qualities created_at num_cards]}]
|
||||
^{:key id}
|
||||
[:tr
|
||||
(if (and (auth/authenticated?) (not is_public))
|
||||
{:class "warning"})
|
||||
[:td [:a {:href (->url "#/list/" id)} [:div name]]]
|
||||
[:td (format-date (new js/Date created_at))]
|
||||
[:td (if require_qualities "Yes" "")]
|
||||
[:td num_cards]])
|
||||
@lists))]]))]))))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[list-id user-id]
|
||||
(let [list-id (int list-id)
|
||||
public-only? (nil? user-id)]
|
||||
["select name, notes, is_public, require_qualities
|
||||
["select name, notes, is_public, require_qualities, created_at
|
||||
from lists
|
||||
where id = ?
|
||||
and is_public in (true, ?)"
|
||||
|
@ -27,6 +27,7 @@
|
|||
l.name,
|
||||
l.is_public,
|
||||
l.require_qualities,
|
||||
l.created_at,
|
||||
(
|
||||
select coalesce(sum(lc.quantity), 0)
|
||||
from lists_card_quantities lc
|
||||
|
|
Loading…
Reference in a new issue