Skip to content

Commit

Permalink
Merge pull request #447 from mfts/fix/order
Browse files Browse the repository at this point in the history
feat(dataroom): order documents in tree and view alphabetically
  • Loading branch information
mfts authored May 31, 2024
2 parents b84753c + 012c1be commit 087872d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pages/api/links/[id]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ export default async function handle(
},
},
},
orderBy: {
document: {
name: "asc",
},
},
},
folders: {
orderBy: {
Expand Down
5 changes: 5 additions & 0 deletions pages/api/links/domains/[...domainSlug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ export default async function handle(
},
},
},
orderBy: {
document: {
name: "asc",
},
},
},
folders: {
orderBy: {
Expand Down
4 changes: 3 additions & 1 deletion pages/api/teams/[teamId]/datarooms/[id]/documents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default async function handle(
folderId: null,
},
orderBy: {
createdAt: "desc",
document: {
name: "asc",
},
},
include: {
document: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ export default async function handle(
dataroomId: dataroomId,
folderId: folder.id,
},
orderBy: {
createdAt: "desc",
},
select: {
id: true,
dataroomId: true,
Expand All @@ -85,6 +82,11 @@ export default async function handle(
},
},
},
orderBy: {
document: {
name: "asc",
},
},
});

return res.status(200).json(documents);
Expand Down
10 changes: 10 additions & 0 deletions pages/api/teams/[teamId]/datarooms/[id]/folders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export default async function handle(
},
},
},
orderBy: {
document: {
name: "asc",
},
},
},
childFolders: {
include: {
Expand All @@ -97,6 +102,11 @@ export default async function handle(
},
},
},
orderBy: {
document: {
name: "asc",
},
},
},
},
},
Expand Down

0 comments on commit 087872d

Please sign in to comment.