mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Add asset repository and refactor asset service (#540)
* build endpoint to get asset count by month * Added asset repository * Added create asset * get asset by device ID * Added test for existing methods * Refactor additional endpoint * Refactor database api to get curated locations and curated objects * Refactor get search properties * Fixed cookies parsing for websocket * Added API to get asset count by time group * Remove unused code
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { serverApi } from '@api';
|
||||
import { serverApi, TimeGroupEnum } from '@api';
|
||||
import * as cookieParser from 'cookie';
|
||||
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
@@ -21,6 +21,9 @@ export const load: LayoutServerLoad = async ({ request }) => {
|
||||
user: userInfo
|
||||
};
|
||||
} catch (e) {
|
||||
console.log('[ERROR] layout.server.ts [LayoutServerLoad]: ', e);
|
||||
console.error('[ERROR] layout.server.ts [LayoutServerLoad]: ', e);
|
||||
return {
|
||||
user: undefined
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
import Close from 'svelte-material-icons/Close.svelte';
|
||||
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import {
|
||||
notificationController,
|
||||
NotificationType
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import { closeWebsocketConnection, openWebsocketConnection } from '$lib/stores/websocket';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -193,6 +195,18 @@
|
||||
console.error('Error deleteSelectedAssetHandler', e);
|
||||
}
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
openWebsocketConnection();
|
||||
|
||||
const { data: assets } = await api.assetApi.getAllAssets();
|
||||
|
||||
setAssetInfo(assets);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
closeWebsocketConnection();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
Reference in New Issue
Block a user