mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
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:
@@ -7,7 +7,7 @@ A self-hosted library management and reading platform for ebooks, PDFs, audioboo
|
||||
[](https://github.com/bookorbit/bookorbit/stargazers)
|
||||
[](https://github.com/bookorbit/bookorbit/actions/workflows/ci.yml)
|
||||
[](https://github.com/bookorbit/bookorbit/actions/workflows/release.yml)
|
||||
[](https://codecov.io/gh/bookorbit/bookorbit)
|
||||
[](https://codecov.io/gh/bookorbit/bookorbit)
|
||||
[](https://github.com/bookorbit/bookorbit/releases)
|
||||
[](https://github.com/bookorbit/bookorbit/commits/main)
|
||||
[](LICENSE)
|
||||
@@ -123,12 +123,6 @@ For local development, see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md). To contri
|
||||
|
||||
---
|
||||
|
||||
## Code Coverage Map
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Support
|
||||
|
||||
- **Questions and discussion:** [GitHub Discussions](https://github.com/bookorbit/bookorbit/discussions)
|
||||
|
||||
+19
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user