mirror of
https://codeberg.org/cage/tinmop/
synced 2025-01-07 01:41:10 +01:00
- 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
|
(tooter:define-entity chat-message
|
||||||
(message-id :field "id")
|
(message-id :field "id")
|
||||||
(unreadp)
|
(unreadp :field "unread")
|
||||||
(emojis :translate-with #'decode-emoji)
|
(emojis :translate-with #'decode-emoji)
|
||||||
(updated-at :translate-with #'tooter:convert-timestamp)
|
(updated-at :translate-with #'tooter:convert-timestamp)
|
||||||
(content)
|
(content)
|
||||||
@ -55,19 +55,21 @@
|
|||||||
(chat-id chat-id)
|
(chat-id chat-id)
|
||||||
(unreadp unreadp)
|
(unreadp unreadp)
|
||||||
(content content)
|
(content content)
|
||||||
(account-id account-id)) object
|
(account-id account-id)
|
||||||
|
(attachment attachment)) object
|
||||||
(format stream
|
(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
|
chat-id
|
||||||
message-id
|
message-id
|
||||||
unreadp
|
unreadp
|
||||||
content
|
content
|
||||||
account-id))))
|
account-id
|
||||||
|
attachment))))
|
||||||
|
|
||||||
(tooter:define-entity chat
|
(tooter:define-entity chat
|
||||||
(chat-id :field "id")
|
(chat-id :field "id")
|
||||||
(updated-at :translate-with #'tooter:convert-timestamp)
|
(updated-at :translate-with #'tooter:convert-timestamp)
|
||||||
(unreadp)
|
(unread-count :field "unread")
|
||||||
(last-message :field "last_message" :translate-with #'decode-chat-message)
|
(last-message :field "last_message" :translate-with #'decode-chat-message)
|
||||||
(account :translate-with #'decode-account))
|
(account :translate-with #'decode-account))
|
||||||
|
|
||||||
@ -75,14 +77,14 @@
|
|||||||
(print-unreadable-object (object stream :type t)
|
(print-unreadable-object (object stream :type t)
|
||||||
(with-accessors ((chat-id chat-id)
|
(with-accessors ((chat-id chat-id)
|
||||||
(updated-at updated-at)
|
(updated-at updated-at)
|
||||||
(unreadp unreadp)
|
(unread-count unread-count)
|
||||||
(last-message last-message)
|
(last-message last-message)
|
||||||
(account account)) object
|
(account account)) object
|
||||||
(format stream
|
(format stream
|
||||||
"id ~a updated-at ~a unread ~a last-message ~a account ~a"
|
"id ~a updated-at ~a unread ~a last-message ~a account ~a"
|
||||||
chat-id
|
chat-id
|
||||||
updated-at
|
updated-at
|
||||||
unreadp
|
unread-count
|
||||||
last-message
|
last-message
|
||||||
account))))
|
account))))
|
||||||
|
|
||||||
|
28
src/db.lisp
28
src/db.lisp
@ -113,6 +113,12 @@
|
|||||||
(define-constant +table-conversation+ :conversation
|
(define-constant +table-conversation+ :conversation
|
||||||
:test #'eq)
|
: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
|
(define-constant +table-gemini-tofu-cert+ :gemini-tofu-cert
|
||||||
:test #'eq)
|
:test #'eq)
|
||||||
|
|
||||||
@ -269,6 +275,24 @@
|
|||||||
" \"status-id\" TEXT"
|
" \"status-id\" TEXT"
|
||||||
+make-close+)))
|
+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 ()
|
(defun make-conversation ()
|
||||||
(query-low-level (strcat (prepare-table +table-conversation+)
|
(query-low-level (strcat (prepare-table +table-conversation+)
|
||||||
" folder TEXT, "
|
" folder TEXT, "
|
||||||
@ -519,6 +543,8 @@
|
|||||||
+table-skipped-status+
|
+table-skipped-status+
|
||||||
+table-poll-option+
|
+table-poll-option+
|
||||||
+table-poll+
|
+table-poll+
|
||||||
|
+table-chat-message+
|
||||||
|
+table-chat+
|
||||||
+table-gemini-tofu-cert+))
|
+table-gemini-tofu-cert+))
|
||||||
|
|
||||||
(defun build-views ())
|
(defun build-views ())
|
||||||
@ -548,6 +574,8 @@
|
|||||||
(make-pagination-status)
|
(make-pagination-status)
|
||||||
(make-poll-option)
|
(make-poll-option)
|
||||||
(make-poll)
|
(make-poll)
|
||||||
|
(make-chat-message)
|
||||||
|
(make-chat)
|
||||||
(make-tofu-certs)
|
(make-tofu-certs)
|
||||||
(build-all-indices)
|
(build-all-indices)
|
||||||
(fs:set-file-permissions (db-path) (logior fs:+s-irusr+ fs:+s-iwusr+))))
|
(fs:set-file-permissions (db-path) (logior fs:+s-irusr+ fs:+s-iwusr+))))
|
||||||
|
Loading…
Reference in New Issue
Block a user