Add library push to website from the content editor
This commit is contained in:
1 parent
ec57bd73b3
commit
0f90babb7a
13 files changed
+281
-20
No files matched your search
@@ -1,12 +1,24 @@
|
||||
import type { LibraryData } from '#lib/library/types';
|
||||
import { libraryDatabase } from './database';
|
||||
import { storedImageIds } from './images';
|
||||
import { listMedia } from './media';
|
||||
import { listBooks } from './books';
|
||||
import { listGames } from './games';
|
||||
import { exportMedia, listMedia } from './media';
|
||||
import { exportBooks, listBooks } from './books';
|
||||
import { exportGames, listGames } from './games';
|
||||
import type { ExportedEntry } from './input';
|
||||
|
||||
export async function getLibrary(): Promise<LibraryData> {
|
||||
const database = await libraryDatabase();
|
||||
const imageIds = storedImageIds(database);
|
||||
return { ...listMedia(database, imageIds), books: listBooks(database, imageIds), games: listGames(database, imageIds) };
|
||||
}
|
||||
|
||||
export interface LibraryExport {
|
||||
media: ExportedEntry[];
|
||||
books: ExportedEntry[];
|
||||
games: ExportedEntry[];
|
||||
}
|
||||
|
||||
export async function exportLibrary(): Promise<LibraryExport> {
|
||||
const database = await libraryDatabase();
|
||||
return { media: exportMedia(database), books: exportBooks(database), games: exportGames(database) };
|
||||
}
|
||||
Reference in new issue
Block a user