Skip to content

Commit

Permalink
Merge pull request #28 from ful1e5/dev
Browse files Browse the repository at this point in the history
fix(db): Counts Download entries instead of rely on `index` .
  • Loading branch information
ful1e5 authored Feb 24, 2024
2 parents ce77ba3 + 84b1aa5 commit 4d4c6a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixes breakage on `PRO` account link downloads
- Fixed width and font size of `ToolTip` component in mobile devices
- Fixed Download counts bug

## [v1.0.1] - 12 January 2024

Expand Down
8 changes: 3 additions & 5 deletions src/services/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ export type AddDownloadData = {
};

export const getIndex = async (id?: AddDownloadData['id']) => {
const maxIndex = await prisma.download.findFirst({
where: { userId: id },
select: { index: true },
orderBy: { index: 'desc' }
const maxIndex = await prisma.download.findMany({
where: { userId: id }
});

return maxIndex?.index || 0;
return maxIndex?.length || 0;
};

export const addDownload = async ({ id, data }: AddDownloadData) => {
Expand Down

0 comments on commit 4d4c6a9

Please sign in to comment.