Skip to content

Commit

Permalink
Fix missing db client in downloads service.
Browse files Browse the repository at this point in the history
  • Loading branch information
scrose committed Nov 3, 2023
1 parent d87cbba commit e3752b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
24 changes: 12 additions & 12 deletions client/src/_components/menus/viewer.menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ const ViewerPanelMenu = () => {
return <div className={'viewer-menu'}>
<div className={'h-menu'}>
<ul>
{
(nav.downloads || []).length > 0 &&
<li key={`${menuID}_menuitem_attached_downloads`}>
<Button
icon={'download'}
label={!nav.compact && 'Download Package'}
className={styles.active}
title={`Bulk download selected files.`}
onClick={() => {dialog.setCurrent({dialogID: 'bulk_download_selections'})}}
/>
</li>
}
{
isAdmin && <li className={user ? 'push' : ''}>
<Dropdown
Expand All @@ -76,18 +88,6 @@ const ViewerPanelMenu = () => {
}]} />
</li>
}
{
(nav.downloads || []).length > 0 &&
<li key={`${menuID}_menuitem_attached_downloads`}>
<Button
icon={'download'}
label={!nav.compact && 'Download Package'}
className={styles.active}
title={`Bulk download selected files.`}
onClick={() => {dialog.setCurrent({dialogID: 'bulk_download_selections'})}}
/>
</li>
}
<li className={'push'}>
<Button
icon={'sync'}
Expand Down
2 changes: 1 addition & 1 deletion client/src/_components/tools/download.tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const Downloader = ({id}) => {
*/
const _handleCallback = (err) => {
if (!id) nav.clearDownloads();
err ? setMessage(err) : dialog.cancel();
// err ? setMessage(err) : dialog.cancel();
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/controllers/files.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export default function FilesController(modelType) {

this.init = async () => {
try {
// ignore if no model type provided
if (!modelType) return;
// generate model constructor
Model = await db.model.create(modelType);
model = new Model();
mserve = new ModelServices(new Model());
} catch (err) {
console.error(err)
console.error(err);
}
};

Expand Down Expand Up @@ -522,7 +524,7 @@ export default function FilesController(modelType) {
const client = await pool.connect();

try {
await fserve.bulkDownload(req, res, next, 'raw');
await fserve.bulkDownload(req, res, next, 'raw', client);
} catch (err) {
return next(err);
} finally {
Expand Down
1 change: 1 addition & 0 deletions src/services/files.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ export const streamDownload = (res, buffer) => {
* @param res
* @param next
* @param version
* @param client
*/

export const bulkDownload = async (req, res, next, version, client) => {
Expand Down

0 comments on commit e3752b7

Please sign in to comment.