-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite SelectOwner, SelectUser, SelectGroup
- Loading branch information
Showing
9 changed files
with
217 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { NextRequest } from "next/server"; | ||
import { z } from "zod"; | ||
|
||
import { findOwnersForSelect } from "@/server/owners/data"; | ||
|
||
// We're not calling this as a server actions because it'd be too slow (server actions are sequential). | ||
// TODO: it'd be good to use tRPC for this. | ||
export async function GET(request: NextRequest) { | ||
const { searchParams } = new URL(request.url); | ||
|
||
const { search, mode } = z | ||
.object({ | ||
search: z.string(), | ||
mode: z.enum(["all", "all-users", "all-groups", "my", "my-groups"]), | ||
}) | ||
.parse(Object.fromEntries(searchParams.entries())); | ||
|
||
return Response.json( | ||
await findOwnersForSelect({ | ||
search, | ||
mode, | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.