refactor(server): library service (#8050)

* refactor: library service

* chore: open api

* fix: checks
This commit is contained in:
Jason Rasmussen 2024-03-18 15:59:53 -05:00 committed by GitHub
parent 761e7fdd2d
commit 40262c30cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 198 additions and 335 deletions

View file

@ -20,7 +20,7 @@
const dispatch = createEventDispatcher<{
cancel: void;
submit: { ownerId: string | null };
submit: { ownerId: string };
delete: void;
}>();

View file

@ -28,7 +28,6 @@
removeOfflineFiles,
scanLibrary,
updateLibrary,
type CreateLibraryDto,
type LibraryResponseDto,
type LibraryStatsResponseDto,
type UserResponseDto,
@ -117,14 +116,9 @@
}
}
const handleCreate = async (ownerId: string | null) => {
const handleCreate = async (ownerId: string) => {
try {
let createLibraryDto: CreateLibraryDto = { type: LibraryType.External };
if (ownerId) {
createLibraryDto = { ...createLibraryDto, ownerId };
}
const createdLibrary = await createLibrary({ createLibraryDto });
const createdLibrary = await createLibrary({ createLibraryDto: { ownerId, type: LibraryType.External } });
notificationController.show({
message: `Created library: ${createdLibrary.name}`,