(db: DatabaseAdapter)
| 121 | } |
| 122 | |
| 123 | function queryStats(db: DatabaseAdapter): PushImportResult['session'] { |
| 124 | const row = db.prepare('SELECT COUNT(*) as total, MIN(ts) as first, MAX(ts) as last FROM message').get() as { |
| 125 | total: number |
| 126 | first: number | null |
| 127 | last: number | null |
| 128 | } |
| 129 | const memberRow = db |
| 130 | .prepare(`SELECT COUNT(*) as cnt FROM member WHERE COALESCE(account_name, '') != ?`) |
| 131 | .get(SYSTEM_MEMBER_NAME) as { cnt: number } |
| 132 | return { totalCount: row.total, memberCount: memberRow.cnt, firstTimestamp: row.first, lastTimestamp: row.last } |
| 133 | } |
| 134 | |
| 135 | function normalizeSenderAccountName(sender: string, accountName: string | undefined): string | undefined { |
| 136 | return sender === SYSTEM_SENDER_ID ? SYSTEM_MEMBER_NAME : accountName |
no test coverage detected