mirror of https://codeberg.org/cage/tinmop/
- added tables for chats;
- fixed some slot names for chat entities.
This commit is contained in:
parent
1ec83e30d0
commit
9902d3d430
|
@ -40,7 +40,7 @@
|
|||
|
||||
(tooter:define-entity chat-message
|
||||
(message-id :field "id")
|
||||
(unreadp)
|
||||
(unreadp :field "unread")
|
||||
(emojis :translate-with #'decode-emoji)
|
||||
(updated-at :translate-with #'tooter:convert-timestamp)
|
||||
(content)
|
||||
|
@ -55,19 +55,21 @@
|
|||
(chat-id chat-id)
|
||||
(unreadp unreadp)
|
||||
(content content)
|
||||
(account-id account-id)) object
|
||||
(account-id account-id)
|
||||
(attachment attachment)) object
|
||||
(format stream
|
||||
"chat ~a id ~a unread ~a content ~s sender account ~a"
|
||||
"chat ~a id ~a unread ~a content ~s sender account ~a attachment ~a"
|
||||
chat-id
|
||||
message-id
|
||||
unreadp
|
||||
content
|
||||
account-id))))
|
||||
account-id
|
||||
attachment))))
|
||||
|
||||
(tooter:define-entity chat
|
||||
(chat-id :field "id")
|
||||
(updated-at :translate-with #'tooter:convert-timestamp)
|
||||
(unreadp)
|
||||
(unread-count :field "unread")
|
||||
(last-message :field "last_message" :translate-with #'decode-chat-message)
|
||||
(account :translate-with #'decode-account))
|
||||
|
||||
|
@ -75,14 +77,14 @@
|
|||
(print-unreadable-object (object stream :type t)
|
||||
(with-accessors ((chat-id chat-id)
|
||||
(updated-at updated-at)
|
||||
(unreadp unreadp)
|
||||
(unread-count unread-count)
|
||||
(last-message last-message)
|
||||
(account account)) object
|
||||
(format stream
|
||||
"id ~a updated-at ~a unread ~a last-message ~a account ~a"
|
||||
chat-id
|
||||
updated-at
|
||||
unreadp
|
||||
unread-count
|
||||
last-message
|
||||
account))))
|
||||
|
||||
|
|
28
src/db.lisp
28
src/db.lisp
|
@ -113,6 +113,12 @@
|
|||
(define-constant +table-conversation+ :conversation
|
||||
:test #'eq)
|
||||
|
||||
(define-constant +table-chat+ :chat
|
||||
:test #'eq)
|
||||
|
||||
(define-constant +table-chat-message+ :chat-message
|
||||
:test #'eq)
|
||||
|
||||
(define-constant +table-gemini-tofu-cert+ :gemini-tofu-cert
|
||||
:test #'eq)
|
||||
|
||||
|
@ -269,6 +275,24 @@
|
|||
" \"status-id\" TEXT"
|
||||
+make-close+)))
|
||||
|
||||
(defun make-chat ()
|
||||
(query-low-level (strcat (prepare-table +table-chat+ :autogenerated-id-p nil)
|
||||
"id TEXT NOT NULL,"
|
||||
" \"updated-at\" TEXT NOT NULL,"
|
||||
" \"unread-count\" INTEGER DEFAULT 0"
|
||||
+make-close+)))
|
||||
|
||||
(defun make-chat-message ()
|
||||
(query-low-level (strcat (prepare-table +table-chat-message+ :autogenerated-id-p nil)
|
||||
"id TEXT NOT NULL,"
|
||||
;; boolean
|
||||
" unreadp INTEGER DEFAULT 0,"
|
||||
" content TEXT,"
|
||||
" \"chat-id\" TEXT "
|
||||
(make-foreign +table-chat+ "id" +cascade+ +cascade+) +col-sep+
|
||||
" \"attachment-id\" TEXT NOT NULL"
|
||||
+make-close+)))
|
||||
|
||||
(defun make-conversation ()
|
||||
(query-low-level (strcat (prepare-table +table-conversation+)
|
||||
" folder TEXT, "
|
||||
|
@ -519,6 +543,8 @@
|
|||
+table-skipped-status+
|
||||
+table-poll-option+
|
||||
+table-poll+
|
||||
+table-chat-message+
|
||||
+table-chat+
|
||||
+table-gemini-tofu-cert+))
|
||||
|
||||
(defun build-views ())
|
||||
|
@ -548,6 +574,8 @@
|
|||
(make-pagination-status)
|
||||
(make-poll-option)
|
||||
(make-poll)
|
||||
(make-chat-message)
|
||||
(make-chat)
|
||||
(make-tofu-certs)
|
||||
(build-all-indices)
|
||||
(fs:set-file-permissions (db-path) (logior fs:+s-irusr+ fs:+s-iwusr+))))
|
||||
|
|
Loading…
Reference in New Issue