fix(books): update date when metadata is auto fetched

Update the `updatedAt` field on the `books` table whenever book metadata is
automatically fetched or bulk updated. Additionally, filter codecov reports
to only include server coverage and ignore test/config files, and update
the README codecov badge to reflect this.

Closes #186
This commit is contained in:
neon
2026-06-01 05:07:59 +00:00
parent 53a08788bc
commit 9111f84c47
4 changed files with 26 additions and 9 deletions
+1 -7
View File
@@ -7,7 +7,7 @@ A self-hosted library management and reading platform for ebooks, PDFs, audioboo
[![Stars](https://img.shields.io/github/stars/bookorbit/bookorbit?style=flat)](https://github.com/bookorbit/bookorbit/stargazers)
[![CI](https://github.com/bookorbit/bookorbit/actions/workflows/ci.yml/badge.svg)](https://github.com/bookorbit/bookorbit/actions/workflows/ci.yml)
[![Release](https://github.com/bookorbit/bookorbit/actions/workflows/release.yml/badge.svg)](https://github.com/bookorbit/bookorbit/actions/workflows/release.yml)
[![codecov](https://codecov.io/gh/bookorbit/bookorbit/graph/badge.svg?token=F6TADEFCUV)](https://codecov.io/gh/bookorbit/bookorbit)
[![Server Coverage](https://codecov.io/gh/bookorbit/bookorbit/graph/badge.svg?token=F6TADEFCUV&flag=server)](https://codecov.io/gh/bookorbit/bookorbit)
[![Latest release](https://img.shields.io/github/v/release/bookorbit/bookorbit?label=latest)](https://github.com/bookorbit/bookorbit/releases)
[![Commits/month](https://img.shields.io/github/commit-activity/m/bookorbit/bookorbit?label=commits%2Fmonth)](https://github.com/bookorbit/bookorbit/commits/main)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](LICENSE)
@@ -123,12 +123,6 @@ For local development, see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md). To contri
---
## Code Coverage Map
![Codecov Grid](https://codecov.io/gh/bookorbit/bookorbit/graphs/tree.svg?token=F6TADEFCUV)
---
## Support
- **Questions and discussion:** [GitHub Discussions](https://github.com/bookorbit/bookorbit/discussions)
+19
View File
@@ -59,3 +59,22 @@ flags:
paths:
- client/**
carryforward: true
ignore:
- "server/src/**/*.test.ts"
- "server/src/scripts/**"
- "server/src/**/*.module.ts"
- "server/src/main.ts"
- "server/src/db/schema/**"
- "server/src/**/*.types.ts"
- "server/src/**/*.interface.ts"
- "server/src/**/*.constants.ts"
- "server/src/**/*.enum.ts"
- "server/src/config/**"
- "server/src/common/types/**"
- "client/src/**/*.test.ts"
- "client/src/**/*.spec.ts"
- "client/src/**/__tests__/**"
- "client/src/main.ts"
- "client/src/**/*.d.ts"
- "client/src/**/*.types.ts"
@@ -357,8 +357,10 @@ describe('BookRepository', () => {
expect(db.delete).toHaveBeenCalledTimes(1);
expect(deleteWhere).toHaveBeenCalledTimes(1);
expect(db.update).toHaveBeenCalledTimes(1);
expect(updateWhere).toHaveBeenCalledTimes(1);
expect(db.update).toHaveBeenCalledTimes(2);
expect(updateBuilder.set).toHaveBeenNthCalledWith(1, { title: 'Updated' });
expect(updateBuilder.set).toHaveBeenNthCalledWith(2, expect.objectContaining({ updatedAt: expect.any(Date) }));
expect(updateWhere).toHaveBeenCalledTimes(2);
expect(db.insert).toHaveBeenCalledTimes(1);
});
@@ -988,6 +988,7 @@ export class BookRepository {
executor: MetadataUpdateExecutor = this.db,
): Promise<void> {
await executor.update(bookMetadata).set(fields).where(eq(bookMetadata.bookId, bookId));
await executor.update(books).set({ updatedAt: new Date() }).where(eq(books.id, bookId));
}
async bulkUpdateMetadataFields(
@@ -997,6 +998,7 @@ export class BookRepository {
): Promise<void> {
if (bookIds.length === 0) return;
await executor.update(bookMetadata).set(fields).where(inArray(bookMetadata.bookId, bookIds));
await executor.update(books).set({ updatedAt: new Date() }).where(inArray(books.id, bookIds));
}
async upsertProgress(