mirror of
https://github.com/sakaljurgis/nntp-worker.git
synced 2026-07-08 21:27:41 +00:00
18 lines
752 B
TypeScript
18 lines
752 B
TypeScript
import { Repository } from './repository';
|
|
|
|
export async function updateLastReplyDate(repository: Repository) {
|
|
let mismatched = await repository.getLastReplyMismatchedArticles(100);
|
|
console.log(`Updating last reply date for ${mismatched.totalItems} articles. Total pages: ${mismatched.totalPages}`);
|
|
while (mismatched.items.length > 0) {
|
|
for (const item of mismatched.items) {
|
|
await repository.updateArticle(item.id, {
|
|
lastReplyDate: item.calculatedLastReplyDate,
|
|
numReplies: item.calculatedNumReplies,
|
|
});
|
|
}
|
|
|
|
mismatched = await repository.getLastReplyMismatchedArticles(100);
|
|
console.log(`Updating last reply date for ${mismatched.totalItems} articles. Total pages: ${mismatched.totalPages}`);
|
|
}
|
|
}
|