refactored eventcollector & index page

This commit is contained in:
Ren Amamiya
2023-04-13 16:29:52 +07:00
parent 1f73be3a06
commit 2fced53a60
11 changed files with 235 additions and 243 deletions

View File

@@ -255,6 +255,16 @@ async fn count_total_notes(db: DbState<'_>) -> Result<i64, ()> {
db.note().count(vec![]).exec().await.map_err(|_| ())
}
#[tauri::command]
async fn count_total_channels(db: DbState<'_>) -> Result<i64, ()> {
db.channel().count(vec![]).exec().await.map_err(|_| ())
}
#[tauri::command]
async fn count_total_chats(db: DbState<'_>) -> Result<i64, ()> {
db.chat().count(vec![]).exec().await.map_err(|_| ())
}
#[tauri::command]
#[specta::specta]
async fn create_channel(db: DbState<'_>, data: CreateChannelData) -> Result<channel::Data, ()> {
@@ -405,6 +415,8 @@ async fn main() {
get_latest_notes,
get_note_by_id,
count_total_notes,
count_total_channels,
count_total_chats,
create_channel,
update_channel,
get_channels,