Skip to content

Commit e378944

Browse files
committed
feat: reference folders by their name
1 parent 6c94abc commit e378944

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/server/routes/api/server/folder.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default typedPlugin(
2020
PATH,
2121
{
2222
schema: {
23-
description: 'Fetch a folder by ID. Behavior varies based on public and allowUploads flags.',
23+
description: 'Fetch a folder by ID/name. Behavior varies based on public and allowUploads flags.',
2424
params: z.object({
2525
id: z.string(),
2626
}),
@@ -45,8 +45,10 @@ export default typedPlugin(
4545
async (req, res) => {
4646
const { id } = req.params;
4747

48-
const folder = await prisma.folder.findUnique({
49-
where: { id },
48+
const folder = await prisma.folder.findFirst({
49+
where: {
50+
OR: [{ id }, { name: id }],
51+
},
5052
include: {
5153
children: {
5254
where: { public: true },

0 commit comments

Comments
 (0)