-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEOS-337: postgres connection name validation (#603)
- Loading branch information
1 parent
1655dad
commit e3eca4f
Showing
7 changed files
with
319 additions
and
62 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
frontend/app/api/connections/is-connection-name-available/route.ts
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,21 @@ | ||
import { withNeosyncContext } from '@/api-only/neosync-context'; | ||
import { IsConnectionNameAvailableRequest } from '@/neosync-api-client/mgmt/v1alpha1/connection_pb'; | ||
import { RequestContext } from '@/shared'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
export async function GET( | ||
req: NextRequest, | ||
_: RequestContext | ||
): Promise<NextResponse> { | ||
const { searchParams } = new URL(req.url); | ||
const name = searchParams.get('connectionName') ?? ''; | ||
const accountId = searchParams.get('accountId') ?? ''; | ||
return withNeosyncContext(async (ctx) => { | ||
return ctx.connectionClient.isConnectionNameAvailable( | ||
new IsConnectionNameAvailableRequest({ | ||
connectionName: name, | ||
accountId: accountId, | ||
}) | ||
); | ||
})(req); | ||
} |
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.