(cursor: string)
| 127 | } |
| 128 | |
| 129 | function buildCursorCondition(cursor: string): SQL<unknown> | null { |
| 130 | const cursorData = decodeCursor(cursor) |
| 131 | if (!cursorData?.createdAt || !cursorData.id) return null |
| 132 | |
| 133 | const cursorDate = new Date(cursorData.createdAt) |
| 134 | if (Number.isNaN(cursorDate.getTime())) return null |
| 135 | |
| 136 | return or( |
| 137 | lt(auditLog.createdAt, cursorDate), |
| 138 | and(eq(auditLog.createdAt, cursorDate), lt(auditLog.id, cursorData.id)) |
| 139 | )! |
| 140 | } |
| 141 | |
| 142 | interface CursorPaginatedResult { |
| 143 | data: DbAuditLog[] |
no test coverage detected