You've already forked immich
							
							
				mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 00:18:28 +02:00 
			
		
		
		
	chore(web): generate API functions with a single argument (#2568)
This commit is contained in:
		| @@ -20,7 +20,7 @@ function web { | |||||||
|   wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/v6.0.1/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache |   wget -O apiInner.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/v6.0.1/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache | ||||||
|   patch -u apiInner.mustache < apiInner.mustache.patch |   patch -u apiInner.mustache < apiInner.mustache.patch | ||||||
|   cd ../../.. |   cd ../../.. | ||||||
|   npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api -t ./openapi-generator/templates/web |   npx --yes @openapitools/openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api -t ./openapi-generator/templates/web --additional-properties=useSingleRequestParameter=true | ||||||
| } | } | ||||||
|  |  | ||||||
| if [[ $1 == 'mobile' ]]; then | if [[ $1 == 'mobile' ]]; then | ||||||
|   | |||||||
							
								
								
									
										1904
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1904
									
								
								web/src/api/open-api/api.ts
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -21,13 +21,13 @@ export const oauth = { | |||||||
| 	getConfig: (location: Location) => { | 	getConfig: (location: Location) => { | ||||||
| 		const redirectUri = location.href.split('?')[0]; | 		const redirectUri = location.href.split('?')[0]; | ||||||
| 		console.log(`OAuth Redirect URI: ${redirectUri}`); | 		console.log(`OAuth Redirect URI: ${redirectUri}`); | ||||||
| 		return api.oauthApi.generateConfig({ redirectUri }); | 		return api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri } }); | ||||||
| 	}, | 	}, | ||||||
| 	login: (location: Location) => { | 	login: (location: Location) => { | ||||||
| 		return api.oauthApi.callback({ url: location.href }); | 		return api.oauthApi.callback({ oAuthCallbackDto: { url: location.href } }); | ||||||
| 	}, | 	}, | ||||||
| 	link: (location: Location): AxiosPromise<UserResponseDto> => { | 	link: (location: Location): AxiosPromise<UserResponseDto> => { | ||||||
| 		return api.oauthApi.link({ url: location.href }); | 		return api.oauthApi.link({ oAuthCallbackDto: { url: location.href } }); | ||||||
| 	}, | 	}, | ||||||
| 	unlink: () => { | 	unlink: () => { | ||||||
| 		return api.oauthApi.unlink(); | 		return api.oauthApi.unlink(); | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
|  |  | ||||||
| 	const deleteUser = async () => { | 	const deleteUser = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const deletedUser = await api.userApi.deleteUser(user.id); | 			const deletedUser = await api.userApi.deleteUser({ userId: user.id }); | ||||||
| 			if (deletedUser.data.deletedAt != null) { | 			if (deletedUser.data.deletedAt != null) { | ||||||
| 				dispatch('user-delete-success'); | 				dispatch('user-delete-success'); | ||||||
| 			} else { | 			} else { | ||||||
|   | |||||||
| @@ -102,7 +102,7 @@ | |||||||
| 		const title = jobDetails[jobId]?.title; | 		const title = jobDetails[jobId]?.title; | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.jobApi.sendJobCommand(jobId, jobCommand); | 			const { data } = await api.jobApi.sendJobCommand({ jobId, jobCommandDto: jobCommand }); | ||||||
| 			jobs[jobId] = data; | 			jobs[jobId] = data; | ||||||
|  |  | ||||||
| 			switch (jobCommand.command) { | 			switch (jobCommand.command) { | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| 	const dispatch = createEventDispatcher(); | 	const dispatch = createEventDispatcher(); | ||||||
|  |  | ||||||
| 	const restoreUser = async () => { | 	const restoreUser = async () => { | ||||||
| 		const restoredUser = await api.userApi.restoreUser(user.id); | 		const restoredUser = await api.userApi.restoreUser({ userId: user.id }); | ||||||
| 		if (restoredUser.data.deletedAt == null) dispatch('user-restore-success'); | 		if (restoredUser.data.deletedAt == null) dispatch('user-restore-success'); | ||||||
| 		else dispatch('user-restore-fail'); | 		else dispatch('user-restore-fail'); | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -28,8 +28,10 @@ | |||||||
| 			const { data: configs } = await api.systemConfigApi.getConfig(); | 			const { data: configs } = await api.systemConfigApi.getConfig(); | ||||||
|  |  | ||||||
| 			const result = await api.systemConfigApi.updateConfig({ | 			const result = await api.systemConfigApi.updateConfig({ | ||||||
|  | 				systemConfigDto: { | ||||||
| 					...configs, | 					...configs, | ||||||
| 					ffmpeg: ffmpegConfig | 					ffmpeg: ffmpegConfig | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			ffmpegConfig = { ...result.data.ffmpeg }; | 			ffmpegConfig = { ...result.data.ffmpeg }; | ||||||
|   | |||||||
| @@ -73,8 +73,10 @@ | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			const { data: updated } = await api.systemConfigApi.updateConfig({ | 			const { data: updated } = await api.systemConfigApi.updateConfig({ | ||||||
|  | 				systemConfigDto: { | ||||||
| 					...current, | 					...current, | ||||||
| 					oauth: oauthConfig | 					oauth: oauthConfig | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			oauthConfig = { ...updated.oauth }; | 			oauthConfig = { ...updated.oauth }; | ||||||
|   | |||||||
| @@ -48,8 +48,10 @@ | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			const { data: updated } = await api.systemConfigApi.updateConfig({ | 			const { data: updated } = await api.systemConfigApi.updateConfig({ | ||||||
|  | 				systemConfigDto: { | ||||||
| 					...current, | 					...current, | ||||||
| 					passwordLogin: passwordLoginConfig | 					passwordLogin: passwordLoginConfig | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			passwordLoginConfig = { ...updated.passwordLogin }; | 			passwordLoginConfig = { ...updated.passwordLogin }; | ||||||
|   | |||||||
| @@ -97,8 +97,10 @@ | |||||||
| 			const { data: currentConfig } = await api.systemConfigApi.getConfig(); | 			const { data: currentConfig } = await api.systemConfigApi.getConfig(); | ||||||
|  |  | ||||||
| 			const result = await api.systemConfigApi.updateConfig({ | 			const result = await api.systemConfigApi.updateConfig({ | ||||||
|  | 				systemConfigDto: { | ||||||
| 					...currentConfig, | 					...currentConfig, | ||||||
| 					storageTemplate: storageConfig | 					storageTemplate: storageConfig | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			storageConfig.template = result.data.storageTemplate.template; | 			storageConfig.template = result.data.storageTemplate.template; | ||||||
|   | |||||||
| @@ -86,9 +86,10 @@ describe('AlbumCard component', () => { | |||||||
| 		expect(albumImgElement).toHaveAttribute('alt', album.id); | 		expect(albumImgElement).toHaveAttribute('alt', album.id); | ||||||
| 		expect(apiMock.assetApi.getAssetThumbnail).toHaveBeenCalledTimes(1); | 		expect(apiMock.assetApi.getAssetThumbnail).toHaveBeenCalledTimes(1); | ||||||
| 		expect(apiMock.assetApi.getAssetThumbnail).toHaveBeenCalledWith( | 		expect(apiMock.assetApi.getAssetThumbnail).toHaveBeenCalledWith( | ||||||
| 			'thumbnailIdOne', | 			{ | ||||||
| 			ThumbnailFormat.Jpeg, | 				assetId: 'thumbnailIdOne', | ||||||
| 			undefined, | 				format: ThumbnailFormat.Jpeg | ||||||
|  | 			}, | ||||||
| 			{ responseType: 'blob' } | 			{ responseType: 'blob' } | ||||||
| 		); | 		); | ||||||
| 		expect(createObjectURLMock).toHaveBeenCalledWith(thumbnailBlob); | 		expect(createObjectURLMock).toHaveBeenCalledWith(thumbnailBlob); | ||||||
|   | |||||||
| @@ -36,9 +36,10 @@ | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		const { data } = await api.assetApi.getAssetThumbnail( | 		const { data } = await api.assetApi.getAssetThumbnail( | ||||||
| 			thubmnailId, | 			{ | ||||||
| 			ThumbnailFormat.Jpeg, | 				assetId: thubmnailId, | ||||||
| 			undefined, | 				format: ThumbnailFormat.Jpeg | ||||||
|  | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				responseType: 'blob' | 				responseType: 'blob' | ||||||
| 			} | 			} | ||||||
| @@ -61,7 +62,7 @@ | |||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	const getAlbumOwnerInfo = async (): Promise<UserResponseDto> => { | 	const getAlbumOwnerInfo = async (): Promise<UserResponseDto> => { | ||||||
| 		const { data } = await api.userApi.getUserById(album.ownerId); | 		const { data } = await api.userApi.getUserById({ userId: album.ownerId }); | ||||||
|  |  | ||||||
| 		return data; | 		return data; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -124,8 +124,11 @@ | |||||||
| 	$: { | 	$: { | ||||||
| 		if (!isEditingTitle && currentAlbumName != album.albumName && isOwned) { | 		if (!isEditingTitle && currentAlbumName != album.albumName && isOwned) { | ||||||
| 			api.albumApi | 			api.albumApi | ||||||
| 				.updateAlbumInfo(album.id, { | 				.updateAlbumInfo({ | ||||||
|  | 					id: album.id, | ||||||
|  | 					updateAlbumDto: { | ||||||
| 						albumName: album.albumName | 						albumName: album.albumName | ||||||
|  | 					} | ||||||
| 				}) | 				}) | ||||||
| 				.then(() => { | 				.then(() => { | ||||||
| 					currentAlbumName = album.albumName; | 					currentAlbumName = album.albumName; | ||||||
| @@ -143,13 +146,13 @@ | |||||||
| 	const createAlbumHandler = async (event: CustomEvent) => { | 	const createAlbumHandler = async (event: CustomEvent) => { | ||||||
| 		const { assets }: { assets: AssetResponseDto[] } = event.detail; | 		const { assets }: { assets: AssetResponseDto[] } = event.detail; | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.albumApi.addAssetsToAlbum( | 			const { data } = await api.albumApi.addAssetsToAlbum({ | ||||||
| 				album.id, | 				id: album.id, | ||||||
| 				{ | 				addAssetsDto: { | ||||||
| 					assetIds: assets.map((a) => a.id) | 					assetIds: assets.map((a) => a.id) | ||||||
| 				}, | 				}, | ||||||
| 				sharedLink?.key | 				key: sharedLink?.key | ||||||
| 			); | 			}); | ||||||
|  |  | ||||||
| 			if (data.album) { | 			if (data.album) { | ||||||
| 				album = data.album; | 				album = data.album; | ||||||
| @@ -168,8 +171,11 @@ | |||||||
| 		const { selectedUsers }: { selectedUsers: UserResponseDto[] } = event.detail; | 		const { selectedUsers }: { selectedUsers: UserResponseDto[] } = event.detail; | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.albumApi.addUsersToAlbum(album.id, { | 			const { data } = await api.albumApi.addUsersToAlbum({ | ||||||
|  | 				id: album.id, | ||||||
|  | 				addUsersDto: { | ||||||
| 					sharedUserIds: Array.from(selectedUsers).map((u) => u.id) | 					sharedUserIds: Array.from(selectedUsers).map((u) => u.id) | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			album = data; | 			album = data; | ||||||
| @@ -193,7 +199,7 @@ | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.albumApi.getAlbumInfo(album.id); | 			const { data } = await api.albumApi.getAlbumInfo({ id: album.id }); | ||||||
|  |  | ||||||
| 			album = data; | 			album = data; | ||||||
| 			isShowShareInfoModal = false; | 			isShowShareInfoModal = false; | ||||||
| @@ -213,7 +219,7 @@ | |||||||
| 			) | 			) | ||||||
| 		) { | 		) { | ||||||
| 			try { | 			try { | ||||||
| 				await api.albumApi.deleteAlbum(album.id); | 				await api.albumApi.deleteAlbum({ id: album.id }); | ||||||
| 				goto(backUrl); | 				goto(backUrl); | ||||||
| 			} catch (e) { | 			} catch (e) { | ||||||
| 				console.error('Error [userDeleteMenu] ', e); | 				console.error('Error [userDeleteMenu] ', e); | ||||||
| @@ -241,10 +247,7 @@ | |||||||
| 				let total = 0; | 				let total = 0; | ||||||
|  |  | ||||||
| 				const { data, status, headers } = await api.albumApi.downloadArchive( | 				const { data, status, headers } = await api.albumApi.downloadArchive( | ||||||
| 					album.id, | 					{ id: album.id, skip: skip || undefined, key: sharedLink?.key }, | ||||||
| 					undefined, |  | ||||||
| 					skip || undefined, |  | ||||||
| 					sharedLink?.key, |  | ||||||
| 					{ | 					{ | ||||||
| 						responseType: 'blob', | 						responseType: 'blob', | ||||||
| 						onDownloadProgress: function (progressEvent) { | 						onDownloadProgress: function (progressEvent) { | ||||||
| @@ -311,8 +314,11 @@ | |||||||
| 	const setAlbumThumbnailHandler = (event: CustomEvent) => { | 	const setAlbumThumbnailHandler = (event: CustomEvent) => { | ||||||
| 		const { asset }: { asset: AssetResponseDto } = event.detail; | 		const { asset }: { asset: AssetResponseDto } = event.detail; | ||||||
| 		try { | 		try { | ||||||
| 			api.albumApi.updateAlbumInfo(album.id, { | 			api.albumApi.updateAlbumInfo({ | ||||||
|  | 				id: album.id, | ||||||
|  | 				updateAlbumDto: { | ||||||
| 					albumThumbnailAssetId: asset.id | 					albumThumbnailAssetId: asset.id | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
| 		} catch (e) { | 		} catch (e) { | ||||||
| 			console.error('Error [setAlbumThumbnailHandler] ', e); | 			console.error('Error [setAlbumThumbnailHandler] ', e); | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ | |||||||
| 	const removeUser = async (userId: string) => { | 	const removeUser = async (userId: string) => { | ||||||
| 		if (window.confirm('Do you want to remove selected user from the album?')) { | 		if (window.confirm('Do you want to remove selected user from the album?')) { | ||||||
| 			try { | 			try { | ||||||
| 				await api.albumApi.removeUserFromAlbum(album.id, userId); | 				await api.albumApi.removeUserFromAlbum({ id: album.id, userId }); | ||||||
| 				dispatch('user-deleted', { userId }); | 				dispatch('user-deleted', { userId }); | ||||||
| 			} catch (e) { | 			} catch (e) { | ||||||
| 				console.error('Error [share-info-modal] [removeUser]', e); | 				console.error('Error [share-info-modal] [removeUser]', e); | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| 	let sharedLinks: SharedLinkResponseDto[] = []; | 	let sharedLinks: SharedLinkResponseDto[] = []; | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		await getSharedLinks(); | 		await getSharedLinks(); | ||||||
| 		const { data } = await api.userApi.getAllUsers(false); | 		const { data } = await api.userApi.getAllUsers({ isAll: false }); | ||||||
|  |  | ||||||
| 		// remove invalid users | 		// remove invalid users | ||||||
| 		users = data.filter((user) => !(user.deletedAt || user.id === album.ownerId)); | 		users = data.filter((user) => !(user.deletedAt || user.id === album.ownerId)); | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ | |||||||
|  |  | ||||||
| 	const getAllAlbums = async () => { | 	const getAllAlbums = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.albumApi.getAllAlbums(undefined, asset.id); | 			const { data } = await api.albumApi.getAllAlbums({ assetId: asset.id }); | ||||||
| 			appearsInAlbums = data; | 			appearsInAlbums = data; | ||||||
| 		} catch (e) { | 		} catch (e) { | ||||||
| 			console.error('Error getting album that asset belong to', e); | 			console.error('Error getting album that asset belong to', e); | ||||||
| @@ -151,7 +151,9 @@ | |||||||
|  |  | ||||||
| 			$downloadAssets[imageFileName] = 0; | 			$downloadAssets[imageFileName] = 0; | ||||||
|  |  | ||||||
| 			const { data, status } = await api.assetApi.downloadFile(assetId, key, { | 			const { data, status } = await api.assetApi.downloadFile( | ||||||
|  | 				{ assetId, key }, | ||||||
|  | 				{ | ||||||
| 					responseType: 'blob', | 					responseType: 'blob', | ||||||
| 					onDownloadProgress: (progressEvent) => { | 					onDownloadProgress: (progressEvent) => { | ||||||
| 						if (progressEvent.lengthComputable) { | 						if (progressEvent.lengthComputable) { | ||||||
| @@ -160,7 +162,8 @@ | |||||||
| 							$downloadAssets[imageFileName] = Math.floor((current / total) * 100); | 							$downloadAssets[imageFileName] = Math.floor((current / total) * 100); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 			}); | 				} | ||||||
|  | 			); | ||||||
|  |  | ||||||
| 			if (!(data instanceof Blob)) { | 			if (!(data instanceof Blob)) { | ||||||
| 				return; | 				return; | ||||||
| @@ -203,7 +206,9 @@ | |||||||
| 				) | 				) | ||||||
| 			) { | 			) { | ||||||
| 				const { data: deletedAssets } = await api.assetApi.deleteAsset({ | 				const { data: deletedAssets } = await api.assetApi.deleteAsset({ | ||||||
|  | 					deleteAssetDto: { | ||||||
| 						ids: [asset.id] | 						ids: [asset.id] | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| 				navigateAssetForward(); | 				navigateAssetForward(); | ||||||
| @@ -224,8 +229,11 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const toggleFavorite = async () => { | 	const toggleFavorite = async () => { | ||||||
| 		const { data } = await api.assetApi.updateAsset(asset.id, { | 		const { data } = await api.assetApi.updateAsset({ | ||||||
|  | 			assetId: asset.id, | ||||||
|  | 			updateAssetDto: { | ||||||
| 				isFavorite: !asset.isFavorite | 				isFavorite: !asset.isFavorite | ||||||
|  | 			} | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		asset.isFavorite = data.isFavorite; | 		asset.isFavorite = data.isFavorite; | ||||||
| @@ -241,7 +249,9 @@ | |||||||
| 		isShowAlbumPicker = false; | 		isShowAlbumPicker = false; | ||||||
|  |  | ||||||
| 		const { albumName }: { albumName: string } = event.detail; | 		const { albumName }: { albumName: string } = event.detail; | ||||||
| 		api.albumApi.createAlbum({ albumName, assetIds: [asset.id] }).then((response) => { | 		api.albumApi | ||||||
|  | 			.createAlbum({ createAlbumDto: { albumName, assetIds: [asset.id] } }) | ||||||
|  | 			.then((response) => { | ||||||
| 				const album = response.data; | 				const album = response.data; | ||||||
| 				goto('/albums/' + album.id); | 				goto('/albums/' + album.id); | ||||||
| 			}); | 			}); | ||||||
| @@ -272,8 +282,11 @@ | |||||||
|  |  | ||||||
| 	const toggleArchive = async () => { | 	const toggleArchive = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.assetApi.updateAsset(asset.id, { | 			const { data } = await api.assetApi.updateAsset({ | ||||||
|  | 				assetId: asset.id, | ||||||
|  | 				updateAssetDto: { | ||||||
| 					isArchived: !asset.isArchived | 					isArchived: !asset.isArchived | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			asset.isArchived = data.isArchived; | 			asset.isArchived = data.isArchived; | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ | |||||||
| 	$: { | 	$: { | ||||||
| 		// Get latest description from server | 		// Get latest description from server | ||||||
| 		if (asset.id) { | 		if (asset.id) { | ||||||
| 			api.assetApi.getAssetById(asset.id).then((res) => { | 			api.assetApi.getAssetById({ assetId: asset.id }).then((res) => { | ||||||
| 				people = res.data?.people || []; | 				people = res.data?.people || []; | ||||||
| 				textarea.value = res.data?.exifInfo?.description || ''; | 				textarea.value = res.data?.exifInfo?.description || ''; | ||||||
| 			}); | 			}); | ||||||
| @@ -64,8 +64,11 @@ | |||||||
| 	const handleFocusOut = async () => { | 	const handleFocusOut = async () => { | ||||||
| 		dispatch('description-focus-out'); | 		dispatch('description-focus-out'); | ||||||
| 		try { | 		try { | ||||||
| 			await api.assetApi.updateAsset(asset.id, { | 			await api.assetApi.updateAsset({ | ||||||
|  | 				assetId: asset.id, | ||||||
|  | 				updateAssetDto: { | ||||||
| 					description: description | 					description: description | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			console.error(error); | 			console.error(error); | ||||||
|   | |||||||
| @@ -26,9 +26,12 @@ | |||||||
|  |  | ||||||
| 	const loadAssetData = async () => { | 	const loadAssetData = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.assetApi.serveFile(asset.id, false, true, publicSharedKey, { | 			const { data } = await api.assetApi.serveFile( | ||||||
|  | 				{ assetId: asset.id, isThumb: false, isWeb: true, key: publicSharedKey }, | ||||||
|  | 				{ | ||||||
| 					responseType: 'blob' | 					responseType: 'blob' | ||||||
| 			}); | 				} | ||||||
|  | 			); | ||||||
|  |  | ||||||
| 			if (!(data instanceof Blob)) { | 			if (!(data instanceof Blob)) { | ||||||
| 				return; | 				return; | ||||||
|   | |||||||
| @@ -31,10 +31,12 @@ | |||||||
| 			const lastName = form.get('lastName'); | 			const lastName = form.get('lastName'); | ||||||
|  |  | ||||||
| 			const { status } = await api.authenticationApi.adminSignUp({ | 			const { status } = await api.authenticationApi.adminSignUp({ | ||||||
|  | 				signUpDto: { | ||||||
| 					email: String(email), | 					email: String(email), | ||||||
| 					password: String(password), | 					password: String(password), | ||||||
| 					firstName: String(firstName), | 					firstName: String(firstName), | ||||||
| 					lastName: String(lastName) | 					lastName: String(lastName) | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			if (status === 201) { | 			if (status === 201) { | ||||||
|   | |||||||
| @@ -29,9 +29,11 @@ | |||||||
| 			error = ''; | 			error = ''; | ||||||
|  |  | ||||||
| 			const { status } = await api.userApi.updateUser({ | 			const { status } = await api.userApi.updateUser({ | ||||||
|  | 				updateUserDto: { | ||||||
| 					id: user.id, | 					id: user.id, | ||||||
| 					password: String(password), | 					password: String(password), | ||||||
| 					shouldChangePassword: false | 					shouldChangePassword: false | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			if (status === 200) { | 			if (status === 200) { | ||||||
|   | |||||||
| @@ -46,10 +46,12 @@ | |||||||
|  |  | ||||||
| 			try { | 			try { | ||||||
| 				const { status } = await api.userApi.createUser({ | 				const { status } = await api.userApi.createUser({ | ||||||
|  | 					createUserDto: { | ||||||
| 						email: String(email), | 						email: String(email), | ||||||
| 						password: String(password), | 						password: String(password), | ||||||
| 						firstName: String(firstName), | 						firstName: String(firstName), | ||||||
| 						lastName: String(lastName) | 						lastName: String(lastName) | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| 				if (status === 201) { | 				if (status === 201) { | ||||||
|   | |||||||
| @@ -21,11 +21,13 @@ | |||||||
| 		try { | 		try { | ||||||
| 			const { id, email, firstName, lastName, storageLabel } = user; | 			const { id, email, firstName, lastName, storageLabel } = user; | ||||||
| 			const { status } = await api.userApi.updateUser({ | 			const { status } = await api.userApi.updateUser({ | ||||||
|  | 				updateUserDto: { | ||||||
| 					id, | 					id, | ||||||
| 					email, | 					email, | ||||||
| 					firstName, | 					firstName, | ||||||
| 					lastName, | 					lastName, | ||||||
| 					storageLabel: storageLabel || '' | 					storageLabel: storageLabel || '' | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			if (status === 200) { | 			if (status === 200) { | ||||||
| @@ -42,9 +44,11 @@ | |||||||
| 				const defaultPassword = 'password'; | 				const defaultPassword = 'password'; | ||||||
|  |  | ||||||
| 				const { status } = await api.userApi.updateUser({ | 				const { status } = await api.userApi.updateUser({ | ||||||
|  | 					updateUserDto: { | ||||||
| 						id: user.id, | 						id: user.id, | ||||||
| 						password: defaultPassword, | 						password: defaultPassword, | ||||||
| 						shouldChangePassword: true | 						shouldChangePassword: true | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| 				if (status == 200) { | 				if (status == 200) { | ||||||
|   | |||||||
| @@ -57,8 +57,10 @@ | |||||||
| 			loading = true; | 			loading = true; | ||||||
|  |  | ||||||
| 			const { data } = await api.authenticationApi.login({ | 			const { data } = await api.authenticationApi.login({ | ||||||
|  | 				loginCredentialDto: { | ||||||
| 					email, | 					email, | ||||||
| 					password | 					password | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			if (!data.isAdmin && data.shouldChangePassword) { | 			if (!data.isAdmin && data.shouldChangePassword) { | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ | |||||||
|  |  | ||||||
| 		const { albumName }: { albumName: string } = event.detail; | 		const { albumName }: { albumName: string } = event.detail; | ||||||
| 		const assetIds = Array.from(getAssets()).map((asset) => asset.id); | 		const assetIds = Array.from(getAssets()).map((asset) => asset.id); | ||||||
| 		api.albumApi.createAlbum({ albumName, assetIds }).then((response) => { | 		api.albumApi.createAlbum({ createAlbumDto: { albumName, assetIds } }).then((response) => { | ||||||
| 			const { id, albumName } = response.data; | 			const { id, albumName } = response.data; | ||||||
|  |  | ||||||
| 			notificationController.show({ | 			notificationController.show({ | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
|  |  | ||||||
| 		for (const asset of getAssets()) { | 		for (const asset of getAssets()) { | ||||||
| 			if (asset.isArchived !== isArchived) { | 			if (asset.isArchived !== isArchived) { | ||||||
| 				api.assetApi.updateAsset(asset.id, { isArchived }); | 				api.assetApi.updateAsset({ assetId: asset.id, updateAssetDto: { isArchived } }); | ||||||
|  |  | ||||||
| 				onAssetArchive(asset, isArchived); | 				onAssetArchive(asset, isArchived); | ||||||
| 				cnt = cnt + 1; | 				cnt = cnt + 1; | ||||||
|   | |||||||
| @@ -20,7 +20,9 @@ | |||||||
| 			let count = 0; | 			let count = 0; | ||||||
|  |  | ||||||
| 			const { data: deletedAssets } = await api.assetApi.deleteAsset({ | 			const { data: deletedAssets } = await api.assetApi.deleteAsset({ | ||||||
|  | 				deleteAssetDto: { | ||||||
| 					ids: Array.from(getAssets()).map((a) => a.id) | 					ids: Array.from(getAssets()).map((a) => a.id) | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			for (const asset of deletedAssets) { | 			for (const asset of deletedAssets) { | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
| 		let cnt = 0; | 		let cnt = 0; | ||||||
| 		for (const asset of getAssets()) { | 		for (const asset of getAssets()) { | ||||||
| 			if (asset.isFavorite !== isFavorite) { | 			if (asset.isFavorite !== isFavorite) { | ||||||
| 				api.assetApi.updateAsset(asset.id, { isFavorite }); | 				api.assetApi.updateAsset({ assetId: asset.id, updateAssetDto: { isFavorite } }); | ||||||
| 				onAssetFavorite(asset, isFavorite); | 				onAssetFavorite(asset, isFavorite); | ||||||
| 				cnt = cnt + 1; | 				cnt = cnt + 1; | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -15,8 +15,11 @@ | |||||||
| 	const handleRemoveFromAlbum = async () => { | 	const handleRemoveFromAlbum = async () => { | ||||||
| 		if (window.confirm('Do you want to remove selected assets from the album?')) { | 		if (window.confirm('Do you want to remove selected assets from the album?')) { | ||||||
| 			try { | 			try { | ||||||
| 				const { data } = await api.albumApi.removeAssetFromAlbum(album.id, { | 				const { data } = await api.albumApi.removeAssetFromAlbum({ | ||||||
|  | 					id: album.id, | ||||||
|  | 					removeAssetsDto: { | ||||||
| 						assetIds: Array.from(getAssets()).map((a) => a.id) | 						assetIds: Array.from(getAssets()).map((a) => a.id) | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| 				album = data; | 				album = data; | ||||||
|   | |||||||
| @@ -14,12 +14,12 @@ | |||||||
| 			// TODO: Rename API method or change functionality. The assetIds passed | 			// TODO: Rename API method or change functionality. The assetIds passed | ||||||
| 			// in are kept instead of removed. | 			// in are kept instead of removed. | ||||||
| 			const assetsToKeep = allAssets.filter((a) => !getAssets().has(a)); | 			const assetsToKeep = allAssets.filter((a) => !getAssets().has(a)); | ||||||
| 			await api.assetApi.removeAssetsFromSharedLink( | 			await api.assetApi.removeAssetsFromSharedLink({ | ||||||
| 				{ | 				removeAssetsDto: { | ||||||
| 					assetIds: assetsToKeep.map((a) => a.id) | 					assetIds: assetsToKeep.map((a) => a.id) | ||||||
| 				}, | 				}, | ||||||
| 				sharedLink?.key | 				key: sharedLink?.key | ||||||
| 			); | 			}); | ||||||
|  |  | ||||||
| 			sharedLink.assets = assetsToKeep; | 			sharedLink.assets = assetsToKeep; | ||||||
| 			clearSelect(); | 			clearSelect(); | ||||||
|   | |||||||
| @@ -28,8 +28,10 @@ | |||||||
|  |  | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		const { data: assetCountByTimebucket } = await api.assetApi.getAssetCountByTimeBucket({ | 		const { data: assetCountByTimebucket } = await api.assetApi.getAssetCountByTimeBucket({ | ||||||
|  | 			getAssetCountByTimeBucketDto: { | ||||||
| 				timeGroup: TimeGroupEnum.Month, | 				timeGroup: TimeGroupEnum.Month, | ||||||
| 				userId: user?.id | 				userId: user?.id | ||||||
|  | 			} | ||||||
| 		}); | 		}); | ||||||
| 		bucketInfo = assetCountByTimebucket; | 		bucketInfo = assetCountByTimebucket; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,12 +40,12 @@ | |||||||
|  |  | ||||||
| 			const assetIds = results.filter((id) => !!id) as string[]; | 			const assetIds = results.filter((id) => !!id) as string[]; | ||||||
|  |  | ||||||
| 			await api.assetApi.addAssetsToSharedLink( | 			await api.assetApi.addAssetsToSharedLink({ | ||||||
| 				{ | 				addAssetsDto: { | ||||||
| 					assetIds | 					assetIds | ||||||
| 				}, | 				}, | ||||||
| 				sharedLink?.key | 				key: sharedLink?.key | ||||||
| 			); | 			}); | ||||||
|  |  | ||||||
| 			notificationController.show({ | 			notificationController.show({ | ||||||
| 				message: `Successfully add ${assetIds.length} to the shared link`, | 				message: `Successfully add ${assetIds.length} to the shared link`, | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ | |||||||
| 	export let shared: boolean; | 	export let shared: boolean; | ||||||
|  |  | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		const { data } = await api.albumApi.getAllAlbums(shared || undefined); | 		const { data } = await api.albumApi.getAllAlbums({ shared: shared || undefined }); | ||||||
| 		albums = data; | 		albums = data; | ||||||
|  |  | ||||||
| 		recentAlbums = albums | 		recentAlbums = albums | ||||||
|   | |||||||
| @@ -10,9 +10,12 @@ | |||||||
| 	const dispatch = createEventDispatcher(); | 	const dispatch = createEventDispatcher(); | ||||||
|  |  | ||||||
| 	const getUserAvatar = async () => { | 	const getUserAvatar = async () => { | ||||||
| 		const { data } = await api.userApi.getProfileImage(user.id, { | 		const { data } = await api.userApi.getProfileImage( | ||||||
|  | 			{ userId: user.id }, | ||||||
|  | 			{ | ||||||
| 				responseType: 'blob' | 				responseType: 'blob' | ||||||
| 		}); | 			} | ||||||
|  | 		); | ||||||
|  |  | ||||||
| 		if (data instanceof Blob) { | 		if (data instanceof Blob) { | ||||||
| 			return URL.createObjectURL(data); | 			return URL.createObjectURL(data); | ||||||
|   | |||||||
| @@ -60,22 +60,26 @@ | |||||||
| 		try { | 		try { | ||||||
| 			if (shareType === SharedLinkType.Album && album) { | 			if (shareType === SharedLinkType.Album && album) { | ||||||
| 				const { data } = await api.albumApi.createAlbumSharedLink({ | 				const { data } = await api.albumApi.createAlbumSharedLink({ | ||||||
|  | 					createAlbumShareLinkDto: { | ||||||
| 						albumId: album.id, | 						albumId: album.id, | ||||||
| 						expiresAt: expirationDate, | 						expiresAt: expirationDate, | ||||||
| 						allowUpload: isAllowUpload, | 						allowUpload: isAllowUpload, | ||||||
| 						description: description, | 						description: description, | ||||||
| 						allowDownload: isAllowDownload, | 						allowDownload: isAllowDownload, | ||||||
| 						showExif: shouldShowExif | 						showExif: shouldShowExif | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
| 				buildSharedLink(data); | 				buildSharedLink(data); | ||||||
| 			} else { | 			} else { | ||||||
| 				const { data } = await api.assetApi.createAssetsSharedLink({ | 				const { data } = await api.assetApi.createAssetsSharedLink({ | ||||||
|  | 					createAssetsShareLinkDto: { | ||||||
| 						assetIds: sharedAssets.map((a) => a.id), | 						assetIds: sharedAssets.map((a) => a.id), | ||||||
| 						expiresAt: expirationDate, | 						expiresAt: expirationDate, | ||||||
| 						allowUpload: isAllowUpload, | 						allowUpload: isAllowUpload, | ||||||
| 						description: description, | 						description: description, | ||||||
| 						allowDownload: isAllowDownload, | 						allowDownload: isAllowDownload, | ||||||
| 						showExif: shouldShowExif | 						showExif: shouldShowExif | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
| 				buildSharedLink(data); | 				buildSharedLink(data); | ||||||
| 			} | 			} | ||||||
| @@ -133,12 +137,15 @@ | |||||||
| 					? new Date(currentTime + expirationTime).toISOString() | 					? new Date(currentTime + expirationTime).toISOString() | ||||||
| 					: null; | 					: null; | ||||||
|  |  | ||||||
| 				await api.shareApi.editSharedLink(editingLink.id, { | 				await api.shareApi.editSharedLink({ | ||||||
|  | 					id: editingLink.id, | ||||||
|  | 					editSharedLinkDto: { | ||||||
| 						description, | 						description, | ||||||
| 						expiresAt: shouldChangeExpirationTime ? expirationDate : undefined, | 						expiresAt: shouldChangeExpirationTime ? expirationDate : undefined, | ||||||
| 						allowUpload: isAllowUpload, | 						allowUpload: isAllowUpload, | ||||||
| 						allowDownload: isAllowDownload, | 						allowDownload: isAllowDownload, | ||||||
| 						showExif: shouldShowExif | 						showExif: shouldShowExif | ||||||
|  | 					} | ||||||
| 				}); | 				}); | ||||||
|  |  | ||||||
| 				notificationController.show({ | 				notificationController.show({ | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ | |||||||
|  |  | ||||||
| 	const getFavoriteCount = async () => { | 	const getFavoriteCount = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data: assets } = await api.assetApi.getAllAssets(undefined, true, undefined); | 			const { data: assets } = await api.assetApi.getAllAssets({ isFavorite: true }); | ||||||
|  |  | ||||||
| 			return { | 			return { | ||||||
| 				favorites: assets.length | 				favorites: assets.length | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ | |||||||
| 			assetId = link.assets[0].id; | 			assetId = link.assets[0].id; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		const { data } = await api.assetApi.getAssetById(assetId); | 		const { data } = await api.assetApi.getAssetById({ assetId }); | ||||||
|  |  | ||||||
| 		return data; | 		return data; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -17,8 +17,10 @@ | |||||||
| 	const handleChangePassword = async () => { | 	const handleChangePassword = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			await api.authenticationApi.changePassword({ | 			await api.authenticationApi.changePassword({ | ||||||
|  | 				changePasswordDto: { | ||||||
| 					password, | 					password, | ||||||
| 					newPassword | 					newPassword | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			notificationController.show({ | 			notificationController.show({ | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			await api.authenticationApi.logoutAuthDevice(deleteDevice.id); | 			await api.authenticationApi.logoutAuthDevice({ id: deleteDevice.id }); | ||||||
| 			notificationController.show({ message: `Logged out device`, type: NotificationType.Info }); | 			notificationController.show({ message: `Logged out device`, type: NotificationType.Info }); | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			handleError(error, 'Unable to log out device'); | 			handleError(error, 'Unable to log out device'); | ||||||
|   | |||||||
| @@ -15,13 +15,13 @@ | |||||||
|  |  | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		// TODO: update endpoint to have a query param for deleted users | 		// TODO: update endpoint to have a query param for deleted users | ||||||
| 		let { data: users } = await api.userApi.getAllUsers(false); | 		let { data: users } = await api.userApi.getAllUsers({ isAll: false }); | ||||||
|  |  | ||||||
| 		// remove invalid users | 		// remove invalid users | ||||||
| 		users = users.filter((_user) => !(_user.deletedAt || _user.id === user.id)); | 		users = users.filter((_user) => !(_user.deletedAt || _user.id === user.id)); | ||||||
|  |  | ||||||
| 		// exclude partners from the list of users available for selection | 		// exclude partners from the list of users available for selection | ||||||
| 		const { data: partners } = await api.partnerApi.getPartners('shared-by'); | 		const { data: partners } = await api.partnerApi.getPartners({ direction: 'shared-by' }); | ||||||
| 		const partnerIds = partners.map((partner) => partner.id); | 		const partnerIds = partners.map((partner) => partner.id); | ||||||
| 		availableUsers = users.filter((user) => !partnerIds.includes(user.id)); | 		availableUsers = users.filter((user) => !partnerIds.includes(user.id)); | ||||||
| 	}); | 	}); | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ | |||||||
| 	let removePartner: UserResponseDto | null = null; | 	let removePartner: UserResponseDto | null = null; | ||||||
|  |  | ||||||
| 	const refreshPartners = async () => { | 	const refreshPartners = async () => { | ||||||
| 		const { data } = await api.partnerApi.getPartners('shared-by'); | 		const { data } = await api.partnerApi.getPartners({ direction: 'shared-by' }); | ||||||
| 		partners = data; | 		partners = data; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| @@ -26,7 +26,7 @@ | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			await api.partnerApi.removePartner(removePartner.id); | 			await api.partnerApi.removePartner({ id: removePartner.id }); | ||||||
| 			removePartner = null; | 			removePartner = null; | ||||||
| 			await refreshPartners(); | 			await refreshPartners(); | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| @@ -37,7 +37,7 @@ | |||||||
| 	const handleCreatePartners = async (users: UserResponseDto[]) => { | 	const handleCreatePartners = async (users: UserResponseDto[]) => { | ||||||
| 		try { | 		try { | ||||||
| 			for (const user of users) { | 			for (const user of users) { | ||||||
| 				await api.partnerApi.createPartner(user.id); | 				await api.partnerApi.createPartner({ id: user.id }); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			await refreshPartners(); | 			await refreshPartners(); | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ | |||||||
| 	const handleCreate = async (event: CustomEvent<APIKeyResponseDto>) => { | 	const handleCreate = async (event: CustomEvent<APIKeyResponseDto>) => { | ||||||
| 		try { | 		try { | ||||||
| 			const dto = event.detail; | 			const dto = event.detail; | ||||||
| 			const { data } = await api.keyApi.createKey(dto); | 			const { data } = await api.keyApi.createKey({ aPIKeyCreateDto: dto }); | ||||||
| 			secret = data.secret; | 			secret = data.secret; | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			handleError(error, 'Unable to create a new API Key'); | 			handleError(error, 'Unable to create a new API Key'); | ||||||
| @@ -58,7 +58,7 @@ | |||||||
| 		const dto = event.detail; | 		const dto = event.detail; | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			await api.keyApi.updateKey(editKey.id, { name: dto.name }); | 			await api.keyApi.updateKey({ id: editKey.id, aPIKeyUpdateDto: { name: dto.name } }); | ||||||
| 			notificationController.show({ | 			notificationController.show({ | ||||||
| 				message: `Saved API Key`, | 				message: `Saved API Key`, | ||||||
| 				type: NotificationType.Info | 				type: NotificationType.Info | ||||||
| @@ -77,7 +77,7 @@ | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			await api.keyApi.deleteKey(deleteKey.id); | 			await api.keyApi.deleteKey({ id: deleteKey.id }); | ||||||
| 			notificationController.show({ | 			notificationController.show({ | ||||||
| 				message: `Removed API Key: ${deleteKey.name}`, | 				message: `Removed API Key: ${deleteKey.name}`, | ||||||
| 				type: NotificationType.Info | 				type: NotificationType.Info | ||||||
|   | |||||||
| @@ -16,10 +16,12 @@ | |||||||
| 	const handleSaveProfile = async () => { | 	const handleSaveProfile = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data } = await api.userApi.updateUser({ | 			const { data } = await api.userApi.updateUser({ | ||||||
|  | 				updateUserDto: { | ||||||
| 					id: user.id, | 					id: user.id, | ||||||
| 					email: user.email, | 					email: user.email, | ||||||
| 					firstName: user.firstName, | 					firstName: user.firstName, | ||||||
| 					lastName: user.lastName | 					lastName: user.lastName | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			Object.assign(user, data); | 			Object.assign(user, data); | ||||||
|   | |||||||
| @@ -57,7 +57,7 @@ function createAssetInteractionStore() { | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const setViewingAssetId = async (id: string) => { | 	const setViewingAssetId = async (id: string) => { | ||||||
| 		const { data } = await api.assetApi.getAssetById(id); | 		const { data } = await api.assetApi.getAssetById({ assetId: id }); | ||||||
| 		viewingAssetStoreState.set(data); | 		viewingAssetStoreState.set(data); | ||||||
| 		isViewingAssetStoreState.set(true); | 		isViewingAssetStoreState.set(true); | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -66,9 +66,11 @@ function createAssetStore() { | |||||||
| 			}); | 			}); | ||||||
| 			const { data: assets } = await api.assetApi.getAssetByTimeBucket( | 			const { data: assets } = await api.assetApi.getAssetByTimeBucket( | ||||||
| 				{ | 				{ | ||||||
|  | 					getAssetByTimeBucketDto: { | ||||||
| 						timeBucket: [bucket], | 						timeBucket: [bucket], | ||||||
| 						userId: _assetGridState.userId, | 						userId: _assetGridState.userId, | ||||||
| 						withoutThumbs: true | 						withoutThumbs: true | ||||||
|  | 					} | ||||||
| 				}, | 				}, | ||||||
| 				{ signal: currentBucketData?.cancelToken.signal } | 				{ signal: currentBucketData?.cancelToken.signal } | ||||||
| 			); | 			); | ||||||
|   | |||||||
| @@ -10,7 +10,9 @@ export const addAssetsToAlbum = async ( | |||||||
| 	assetIds: Array<string>, | 	assetIds: Array<string>, | ||||||
| 	key: string | undefined = undefined | 	key: string | undefined = undefined | ||||||
| ): Promise<AddAssetsResponseDto> => | ): Promise<AddAssetsResponseDto> => | ||||||
| 	api.albumApi.addAssetsToAlbum(albumId, { assetIds }, key).then(({ data: dto }) => { | 	api.albumApi | ||||||
|  | 		.addAssetsToAlbum({ id: albumId, addAssetsDto: { assetIds }, key }) | ||||||
|  | 		.then(({ data: dto }) => { | ||||||
| 			if (dto.successfullyAdded > 0) { | 			if (dto.successfullyAdded > 0) { | ||||||
| 				// This might be 0 if the user tries to add an asset that is already in the album | 				// This might be 0 if the user tries to add an asset that is already in the album | ||||||
| 				notificationController.show({ | 				notificationController.show({ | ||||||
| @@ -43,7 +45,9 @@ export async function bulkDownload( | |||||||
|  |  | ||||||
| 			let total = 0; | 			let total = 0; | ||||||
|  |  | ||||||
| 			const { data, status, headers } = await api.assetApi.downloadFiles({ assetIds }, key, { | 			const { data, status, headers } = await api.assetApi.downloadFiles( | ||||||
|  | 				{ downloadFilesDto: { assetIds }, key }, | ||||||
|  | 				{ | ||||||
| 					responseType: 'blob', | 					responseType: 'blob', | ||||||
| 					onDownloadProgress: function (progressEvent) { | 					onDownloadProgress: function (progressEvent) { | ||||||
| 						const request = this as XMLHttpRequest; | 						const request = this as XMLHttpRequest; | ||||||
| @@ -56,7 +60,8 @@ export async function bulkDownload( | |||||||
| 							downloadAssets.set({ [downloadFileName]: Math.floor((current / total) * 100) }); | 							downloadAssets.set({ [downloadFileName]: Math.floor((current / total) * 100) }); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 			}); | 				} | ||||||
|  | 			); | ||||||
|  |  | ||||||
| 			const isNotComplete = headers['x-immich-archive-complete'] === 'false'; | 			const isNotComplete = headers['x-immich-archive-complete'] === 'false'; | ||||||
| 			const fileCount = Number(headers['x-immich-archive-file-count']) || 0; | 			const fileCount = Number(headers['x-immich-archive-file-count']) || 0; | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export const load = (async ({ params, locals: { api, user } }) => { | |||||||
| 	const albumId = params['albumId']; | 	const albumId = params['albumId']; | ||||||
|  |  | ||||||
| 	try { | 	try { | ||||||
| 		const { data: album } = await api.albumApi.getAlbumInfo(albumId); | 		const { data: album } = await api.albumApi.getAlbumInfo({ id: albumId }); | ||||||
| 		return { | 		return { | ||||||
| 			album, | 			album, | ||||||
| 			meta: { | 			meta: { | ||||||
|   | |||||||
| @@ -90,7 +90,7 @@ describe('Albums BLoC', () => { | |||||||
| 		const newAlbum = await sut.createAlbum(); | 		const newAlbum = await sut.createAlbum(); | ||||||
|  |  | ||||||
| 		expect(apiMock.albumApi.createAlbum).toHaveBeenCalledTimes(1); | 		expect(apiMock.albumApi.createAlbum).toHaveBeenCalledTimes(1); | ||||||
| 		expect(apiMock.albumApi.createAlbum).toHaveBeenCalledWith(payload); | 		expect(apiMock.albumApi.createAlbum).toHaveBeenCalledWith({ createAlbumDto: payload }); | ||||||
| 		expect(newAlbum).toEqual(returnedAlbum); | 		expect(newAlbum).toEqual(returnedAlbum); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| @@ -130,7 +130,7 @@ describe('Albums BLoC', () => { | |||||||
| 		const updatedAlbums = get(sut.albums); | 		const updatedAlbums = get(sut.albums); | ||||||
|  |  | ||||||
| 		expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledTimes(1); | 		expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledTimes(1); | ||||||
| 		expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledWith(albumToDeleteId); | 		expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledWith({ id: albumToDeleteId }); | ||||||
| 		expect(updatedAlbums).toHaveLength(4); | 		expect(updatedAlbums).toHaveLength(4); | ||||||
| 		expect(updatedAlbums).not.toContain(albumToDelete); | 		expect(updatedAlbums).not.toContain(albumToDelete); | ||||||
| 		expect(get(sut.isShowContextMenu)).toBe(false); | 		expect(get(sut.isShowContextMenu)).toBe(false); | ||||||
|   | |||||||
| @@ -40,7 +40,9 @@ export const useAlbums = (props: AlbumsProps) => { | |||||||
| 	async function createAlbum(): Promise<AlbumResponseDto | undefined> { | 	async function createAlbum(): Promise<AlbumResponseDto | undefined> { | ||||||
| 		try { | 		try { | ||||||
| 			const { data: newAlbum } = await api.albumApi.createAlbum({ | 			const { data: newAlbum } = await api.albumApi.createAlbum({ | ||||||
|  | 				createAlbumDto: { | ||||||
| 					albumName: 'Untitled' | 					albumName: 'Untitled' | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			return newAlbum; | 			return newAlbum; | ||||||
| @@ -53,7 +55,7 @@ export const useAlbums = (props: AlbumsProps) => { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	async function deleteAlbum(album: AlbumResponseDto): Promise<void> { | 	async function deleteAlbum(album: AlbumResponseDto): Promise<void> { | ||||||
| 		await api.albumApi.deleteAlbum(album.id); | 		await api.albumApi.deleteAlbum({ id: album.id }); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	async function showAlbumContextMenu( | 	async function showAlbumContextMenu( | ||||||
| @@ -83,7 +85,7 @@ export const useAlbums = (props: AlbumsProps) => { | |||||||
| 			) | 			) | ||||||
| 		) { | 		) { | ||||||
| 			try { | 			try { | ||||||
| 				await api.albumApi.deleteAlbum(albumToDelete.id); | 				await api.albumApi.deleteAlbum({ id: albumToDelete.id }); | ||||||
| 				const _albums = get(albums); | 				const _albums = get(albums); | ||||||
| 				albums.set(_albums.filter((a) => a.id !== albumToDelete.id)); | 				albums.set(_albums.filter((a) => a.id !== albumToDelete.id)); | ||||||
| 			} catch { | 			} catch { | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ | |||||||
|  |  | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data: assets } = await api.assetApi.getAllAssets(undefined, undefined, true); | 			const { data: assets } = await api.assetApi.getAllAssets({ isArchived: true }); | ||||||
| 			$archivedAsset = assets; | 			$archivedAsset = assets; | ||||||
| 		} catch { | 		} catch { | ||||||
| 			handleError(Error, 'Unable to load archived assets'); | 			handleError(Error, 'Unable to load archived assets'); | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
|  |  | ||||||
| 	onMount(async () => { | 	onMount(async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data: assets } = await api.assetApi.getAllAssets(undefined, true, undefined); | 			const { data: assets } = await api.assetApi.getAllAssets({ isFavorite: true }); | ||||||
| 			favorites = assets; | 			favorites = assets; | ||||||
| 		} catch { | 		} catch { | ||||||
| 			handleError(Error, 'Unable to load favorites'); | 			handleError(Error, 'Unable to load favorites'); | ||||||
|   | |||||||
| @@ -48,9 +48,11 @@ | |||||||
| 		const { fileCreatedAfter, fileCreatedBefore } = getFileCreatedDates(); | 		const { fileCreatedAfter, fileCreatedBefore } = getFileCreatedDates(); | ||||||
|  |  | ||||||
| 		const { data } = await api.assetApi.getMapMarkers( | 		const { data } = await api.assetApi.getMapMarkers( | ||||||
| 			onlyFavorites || undefined, | 			{ | ||||||
|  | 				isFavorite: onlyFavorites || undefined, | ||||||
| 				fileCreatedAfter, | 				fileCreatedAfter, | ||||||
| 			fileCreatedBefore, | 				fileCreatedBefore | ||||||
|  | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				signal: abortController.signal | 				signal: abortController.signal | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export const load: PageServerLoad = async ({ params, parent, locals: { api } }) | |||||||
| 		throw redirect(302, AppRoute.AUTH_LOGIN); | 		throw redirect(302, AppRoute.AUTH_LOGIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	const { data: partner } = await api.userApi.getUserById(params['userId']); | 	const { data: partner } = await api.userApi.getUserById({ userId: params['userId'] }); | ||||||
|  |  | ||||||
| 	return { | 	return { | ||||||
| 		user, | 		user, | ||||||
|   | |||||||
| @@ -7,8 +7,8 @@ export const load = (async ({ locals, parent, params }) => { | |||||||
| 		throw redirect(302, '/auth/login'); | 		throw redirect(302, '/auth/login'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	const { data: person } = await locals.api.personApi.getPerson(params.personId); | 	const { data: person } = await locals.api.personApi.getPerson({ id: params.personId }); | ||||||
| 	const { data: assets } = await locals.api.personApi.getPersonAssets(params.personId); | 	const { data: assets } = await locals.api.personApi.getPersonAssets({ id: params.personId }); | ||||||
|  |  | ||||||
| 	return { | 	return { | ||||||
| 		user, | 		user, | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ | |||||||
| 		try { | 		try { | ||||||
| 			isEditName = false; | 			isEditName = false; | ||||||
| 			data.person.name = name; | 			data.person.name = name; | ||||||
| 			await api.personApi.updatePerson(data.person.id, { name }); | 			await api.personApi.updatePerson({ id: data.person.id, personUpdateDto: { name } }); | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			handleError(error, 'Unable to save name'); | 			handleError(error, 'Unable to save name'); | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -9,24 +9,7 @@ export const load = (async ({ locals, parent, url }) => { | |||||||
|  |  | ||||||
| 	const term = url.searchParams.get('q') || url.searchParams.get('query') || undefined; | 	const term = url.searchParams.get('q') || url.searchParams.get('query') || undefined; | ||||||
|  |  | ||||||
| 	const { data: results } = await locals.api.searchApi.search( | 	const { data: results } = await locals.api.searchApi.search({}, { params: url.searchParams }); | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		undefined, |  | ||||||
| 		{ params: url.searchParams } |  | ||||||
| 	); |  | ||||||
|  |  | ||||||
| 	return { | 	return { | ||||||
| 		user, | 		user, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ export const load = (async ({ params, locals: { api } }) => { | |||||||
| 	const { key } = params; | 	const { key } = params; | ||||||
|  |  | ||||||
| 	try { | 	try { | ||||||
| 		const { data: sharedLink } = await api.shareApi.getMySharedLink(key); | 		const { data: sharedLink } = await api.shareApi.getMySharedLink({ key }); | ||||||
|  |  | ||||||
| 		const assetCount = sharedLink.assets.length; | 		const assetCount = sharedLink.assets.length; | ||||||
| 		const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id; | 		const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id; | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ import type { PageServerLoad } from './$types'; | |||||||
| export const load = (async ({ params, locals: { api } }) => { | export const load = (async ({ params, locals: { api } }) => { | ||||||
| 	try { | 	try { | ||||||
| 		const { key, assetId } = params; | 		const { key, assetId } = params; | ||||||
| 		const { data: asset } = await api.assetApi.getAssetById(assetId, key); | 		const { data: asset } = await api.assetApi.getAssetById({ assetId, key }); | ||||||
|  |  | ||||||
| 		if (!asset) { | 		if (!asset) { | ||||||
| 			return error(404, 'Asset not found'); | 			return error(404, 'Asset not found'); | ||||||
|   | |||||||
| @@ -8,8 +8,8 @@ export const load = (async ({ locals: { api, user } }) => { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	try { | 	try { | ||||||
| 		const { data: sharedAlbums } = await api.albumApi.getAllAlbums(true); | 		const { data: sharedAlbums } = await api.albumApi.getAllAlbums({ shared: true }); | ||||||
| 		const { data: partners } = await api.partnerApi.getPartners('shared-with'); | 		const { data: partners } = await api.partnerApi.getPartners({ direction: 'shared-with' }); | ||||||
|  |  | ||||||
| 		return { | 		return { | ||||||
| 			user, | 			user, | ||||||
|   | |||||||
| @@ -21,7 +21,9 @@ | |||||||
| 	const createSharedAlbum = async () => { | 	const createSharedAlbum = async () => { | ||||||
| 		try { | 		try { | ||||||
| 			const { data: newAlbum } = await api.albumApi.createAlbum({ | 			const { data: newAlbum } = await api.albumApi.createAlbum({ | ||||||
|  | 				createAlbumDto: { | ||||||
| 					albumName: 'Untitled' | 					albumName: 'Untitled' | ||||||
|  | 				} | ||||||
| 			}); | 			}); | ||||||
|  |  | ||||||
| 			goto('/albums/' + newAlbum.id); | 			goto('/albums/' + newAlbum.id); | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ | |||||||
| 	const handleDeleteLink = async (linkId: string) => { | 	const handleDeleteLink = async (linkId: string) => { | ||||||
| 		if (window.confirm('Do you want to delete the shared link? ')) { | 		if (window.confirm('Do you want to delete the shared link? ')) { | ||||||
| 			try { | 			try { | ||||||
| 				await api.shareApi.removeSharedLink(linkId); | 				await api.shareApi.removeSharedLink({ id: linkId }); | ||||||
| 				notificationController.show({ | 				notificationController.show({ | ||||||
| 					message: 'Shared link deleted', | 					message: 'Shared link deleted', | ||||||
| 					type: NotificationType.Info | 					type: NotificationType.Info | ||||||
| @@ -47,7 +47,7 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const handleEditLink = async (id: string) => { | 	const handleEditLink = async (id: string) => { | ||||||
| 		const { data } = await api.shareApi.getSharedLinkById(id); | 		const { data } = await api.shareApi.getSharedLinkById({ id }); | ||||||
| 		editSharedLink = data; | 		editSharedLink = data; | ||||||
| 		showEditForm = true; | 		showEditForm = true; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ export const load = (async ({ parent, locals: { api } }) => { | |||||||
| 		throw redirect(302, '/photos'); | 		throw redirect(302, '/photos'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	const { data } = await api.userApi.getUserCount(true); | 	const { data } = await api.userApi.getUserCount({ admin: true }); | ||||||
|  |  | ||||||
| 	if (data.userCount > 0) { | 	if (data.userCount > 0) { | ||||||
| 		// Redirect to login page if an admin is already registered. | 		// Redirect to login page if an admin is already registered. | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export const load = (async ({ parent, locals: { api } }) => { | |||||||
| 		throw redirect(302, '/photos'); | 		throw redirect(302, '/photos'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	const { data: allUsers } = await api.userApi.getAllUsers(false); | 	const { data: allUsers } = await api.userApi.getAllUsers({ isAll: false }); | ||||||
|  |  | ||||||
| 	return { | 	return { | ||||||
| 		user, | 		user, | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onUserCreated = async () => { | 	const onUserCreated = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowCreateUserForm = false; | 		shouldShowCreateUserForm = false; | ||||||
| 	}; | 	}; | ||||||
| @@ -57,13 +57,13 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onEditUserSuccess = async () => { | 	const onEditUserSuccess = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowEditUserForm = false; | 		shouldShowEditUserForm = false; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onEditPasswordSuccess = async () => { | 	const onEditPasswordSuccess = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowEditUserForm = false; | 		shouldShowEditUserForm = false; | ||||||
| 		shouldShowInfoPanel = true; | 		shouldShowInfoPanel = true; | ||||||
| @@ -75,13 +75,13 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onUserDeleteSuccess = async () => { | 	const onUserDeleteSuccess = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowDeleteConfirmDialog = false; | 		shouldShowDeleteConfirmDialog = false; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onUserDeleteFail = async () => { | 	const onUserDeleteFail = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowDeleteConfirmDialog = false; | 		shouldShowDeleteConfirmDialog = false; | ||||||
| 	}; | 	}; | ||||||
| @@ -92,14 +92,14 @@ | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onUserRestoreSuccess = async () => { | 	const onUserRestoreSuccess = async () => { | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowRestoreDialog = false; | 		shouldShowRestoreDialog = false; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	const onUserRestoreFail = async () => { | 	const onUserRestoreFail = async () => { | ||||||
| 		// show fail dialog | 		// show fail dialog | ||||||
| 		const getAllUsersRes = await api.userApi.getAllUsers(false); | 		const getAllUsersRes = await api.userApi.getAllUsers({ isAll: false }); | ||||||
| 		allUsers = getAllUsersRes.data; | 		allUsers = getAllUsersRes.data; | ||||||
| 		shouldShowRestoreDialog = false; | 		shouldShowRestoreDialog = false; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import type { OAuthConfigResponseDto } from '@api'; | |||||||
| import type { PageServerLoad } from './$types'; | import type { PageServerLoad } from './$types'; | ||||||
|  |  | ||||||
| export const load = (async ({ locals: { api } }) => { | export const load = (async ({ locals: { api } }) => { | ||||||
| 	const { data } = await api.userApi.getUserCount(true); | 	const { data } = await api.userApi.getUserCount({ admin: true }); | ||||||
| 	if (data.userCount === 0) { | 	if (data.userCount === 0) { | ||||||
| 		// Admin not registered | 		// Admin not registered | ||||||
| 		throw redirect(302, AppRoute.AUTH_REGISTER); | 		throw redirect(302, AppRoute.AUTH_REGISTER); | ||||||
| @@ -17,7 +17,7 @@ export const load = (async ({ locals: { api } }) => { | |||||||
|  |  | ||||||
| 	try { | 	try { | ||||||
| 		// TODO: Figure out how to get correct redirect URI server-side. | 		// TODO: Figure out how to get correct redirect URI server-side. | ||||||
| 		const { data } = await api.oauthApi.generateConfig({ redirectUri: '/' }); | 		const { data } = await api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri: '/' } }); | ||||||
| 		data.url = undefined; | 		data.url = undefined; | ||||||
|  |  | ||||||
| 		authConfig = data; | 		authConfig = data; | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import { redirect } from '@sveltejs/kit'; | |||||||
| import type { PageServerLoad } from './$types'; | import type { PageServerLoad } from './$types'; | ||||||
|  |  | ||||||
| export const load = (async ({ locals: { api } }) => { | export const load = (async ({ locals: { api } }) => { | ||||||
| 	const { data } = await api.userApi.getUserCount(true); | 	const { data } = await api.userApi.getUserCount({ admin: true }); | ||||||
| 	if (data.userCount != 0) { | 	if (data.userCount != 0) { | ||||||
| 		// Admin has been registered, redirect to login | 		// Admin has been registered, redirect to login | ||||||
| 		throw redirect(302, '/auth/login'); | 		throw redirect(302, '/auth/login'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user