Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.open-next/

# TypeScript
*.tsbuildinfo
Expand Down
5 changes: 5 additions & 0 deletions claim-db-worker/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
8 changes: 5 additions & 3 deletions create-db-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Env {
export { DeleteDbWorkflow };

export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
async fetch(request: Request, env: Env): Promise<Response> {
// --- Rate limiting ---
const { success } = await env.CREATE_DB_RATE_LIMITER.limit({ key: request.url });

Expand Down Expand Up @@ -70,14 +70,16 @@ export default {
return new Response('Missing region or name in request body', { status: 400 });
}

const payload = JSON.stringify({ region, name });
const prismaResponse = await fetch('https://api.prisma.io/v1/projects', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.INTEGRATION_TOKEN}`,
},
body: payload,
body: JSON.stringify({
region,
name,
}),
});

const prismaText = await prismaResponse.text();
Expand Down
Loading