Skip to content

Commit

Permalink
Chore/refactor (#44)
Browse files Browse the repository at this point in the history
* rubric dev deps

* rubric tailwind

* rubric prettier

* clean next

* rubric tsconfig

* rubric eslint

* update env.mjs

* update env imports

* move components and styles to lib

* update alias imports

* add bleed, format, lint and prisma utils to pkg.json

* run bleed

* strip package.json

* ran lint:fix and format

* add vscode settings

* stripe bump

* github bump

* seperate tools

* tests folder

* more aliasing of imports

* build warnings
  • Loading branch information
DexterStorey authored Nov 17, 2023
1 parent 2e66bc7 commit 46ca232
Show file tree
Hide file tree
Showing 52 changed files with 1,510 additions and 1,618 deletions.
10 changes: 6 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ GITHUB_CLIENT_SECRET="abc123"
GITHUB_APP_ID="123456"

# GitHub App > Webhook > Webhook secret
# Generate this with `openssl rand -hex 64`
GITHUB_WEBHOOK_SECRET="abc123"

# GitHub App > Private keys > Generate
# This will download a .pem file. Open it in an editor and copy its contents here.
GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
abcdef=
-----END RSA PRIVATE KEY-----"
# This will download a .pem file. You must convert it from PKCS#1 to PKCS#8 following this:
# https://github.com/gr2m/universal-github-app-jwt#readme
GITHUB_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----

-----END PRIVATE KEY-----"

# OpenAI
OPENAI_API_KEY="sk-abc"
Expand Down
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: ['@rubriclab/eslint-config'],
root: true
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json"
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
49 changes: 24 additions & 25 deletions app/api/stripe/generate-payment-link/route.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import { stripe } from "lib/stripe";
import { createPaymentLink } from "lib/utils/payment";
import {stripe} from '~/stripe'
import {createPaymentLink} from '~/utils/payment'

/**
* Generate a Stripe payment URL for a customer.
*/
export const POST = async (req: Request) => {
const { tier, email, customerId } = (await req.json()) as any;
const {tier, email, customerId} = (await req.json()) as any

if (!customerId) {
return Response.json(
{
message: "Missing customer ID",
},
{ status: 400 }
);
}
if (!customerId)
return Response.json(
{
message: 'Missing customer ID'
},
{status: 400}
)

try {
const url = await createPaymentLink(stripe, customerId, tier, email);
try {
const url = await createPaymentLink(stripe, customerId, tier, email)

return Response.json({
url,
});
} catch {
return Response.json(
{
message: "Failed to create Stripe session",
},
{ status: 500 }
);
}
};
return Response.json({
url
})
} catch {
return Response.json(
{
message: 'Failed to create Stripe session'
},
{status: 500}
)
}
}
Loading

1 comment on commit 46ca232

@vercel
Copy link

@vercel vercel bot commented on 46ca232 Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.