show 'Owned' list in lists table. prevent certain operations on it
This commit is contained in:
parent
2cf7a11c7b
commit
62cdd59d45
|
@ -17,18 +17,22 @@
|
||||||
|
|
||||||
(defn remove-list!
|
(defn remove-list!
|
||||||
[list-id]
|
[list-id]
|
||||||
|
(if (= 0 list-id)
|
||||||
|
(throw (Exception. "Cannot remove the 'Owned' list."))
|
||||||
(vexec! view-system db
|
(vexec! view-system db
|
||||||
["delete from lists
|
["delete from lists
|
||||||
where id = ?"
|
where id = ?"
|
||||||
(int list-id)]))
|
(int list-id)])))
|
||||||
|
|
||||||
(defn update-list-name!
|
(defn update-list-name!
|
||||||
[list-id name]
|
[list-id name]
|
||||||
|
(if (= 0 list-id)
|
||||||
|
(throw (Exception. "Cannot change the name of the 'Owned' list."))
|
||||||
(vexec! view-system db
|
(vexec! view-system db
|
||||||
["update lists
|
["update lists
|
||||||
set name = ?
|
set name = ?
|
||||||
where id = ?"
|
where id = ?"
|
||||||
(str name) (int list-id)]))
|
(str name) (int list-id)])))
|
||||||
|
|
||||||
(defn update-list-note!
|
(defn update-list-note!
|
||||||
[list-id note]
|
[list-id note]
|
||||||
|
@ -40,8 +44,10 @@
|
||||||
|
|
||||||
(defn update-list-visibility!
|
(defn update-list-visibility!
|
||||||
[list-id public?]
|
[list-id public?]
|
||||||
|
(if (= 0 list-id)
|
||||||
|
(throw (Exception. "Cannot change the visibility of the 'Owned' list."))
|
||||||
(vexec! view-system db
|
(vexec! view-system db
|
||||||
["update lists
|
["update lists
|
||||||
set is_public = ?
|
set is_public = ?
|
||||||
where id = ?"
|
where id = ?"
|
||||||
(boolean public?) (int list-id)]))
|
(boolean public?) (int list-id)])))
|
||||||
|
|
|
@ -34,8 +34,7 @@
|
||||||
where lc.list_id = l.id
|
where lc.list_id = l.id
|
||||||
) as num_cards
|
) as num_cards
|
||||||
from lists l
|
from lists l
|
||||||
where l.id != 0
|
where l.is_public in (true, ?)
|
||||||
and l.is_public in (true, ?)
|
|
||||||
order by l.name"
|
order by l.name"
|
||||||
public-only?]))
|
public-only?]))
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@
|
||||||
(let [public-only? (nil? user-id)]
|
(let [public-only? (nil? user-id)]
|
||||||
["select id, name
|
["select id, name
|
||||||
from lists
|
from lists
|
||||||
where id != 0
|
where is_public in (true, ?)
|
||||||
and is_public in (true, ?)
|
|
||||||
order by name"
|
order by name"
|
||||||
public-only?]))
|
public-only?]))
|
||||||
|
|
Loading…
Reference in a new issue