Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions server/src/config/importConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

export const IMPORT_CONFIG = {
// Google Books API settings
language: "en",
printType: "books",
queryType: "general",

// Import limits
booksPerRequest: 20,
maxPagesPerSubject: 4,
maxRequestsPerRun: 20,
requestDelayMs: 1000,

// Subjects to search for
subjects: [
"fantasy",
"science fiction",
"mystery",
"history",
"biography",
"romance",
"horror",
"thriller",
"philosophy",
"psychology",
"technology",
"historical fiction",
],
};
4 changes: 2 additions & 2 deletions server/src/graphql/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
listGenres,
type BookRecord,
type BookSort,
} from '../services/books.js';
} from '../services/bookService.js';
import {
addToShelf,
getShelf,
Expand All @@ -17,7 +17,7 @@ import {
withEntry,
withMyEntries,
type ShelfSort,
} from '../services/shelf.js';
} from '../services/shelfService.js';
import { USER_ID_HEADER, type Context } from './context.js';

/*
Expand Down
36 changes: 36 additions & 0 deletions server/src/models/ImportProgress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import mongoose from "mongoose";

const importProgressSchema = new mongoose.Schema(
{
queryKey: {
type: String,
required: true,
unique: true,
},

nextStartIndex: {
type: Number,
default: 0,
min: 0,
},

completed: {
type: Boolean,
default: false,
},

lastImportedAt: {
type: Date,
default: null,
},
},
{
timestamps: true,
}
);

export const ImportProgress = mongoose.model(
"ImportProgress",
importProgressSchema
);
Loading