mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-01 11:19:34 +00:00
Formated Files
This commit is contained in:
parent
d5631b309a
commit
e768d9181f
138 changed files with 1829 additions and 1851 deletions
|
@ -1,8 +1,8 @@
|
|||
import { auth } from "@clerk/nextjs";
|
||||
import { ENTITY_TYPE } from "@prisma/client";
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from '@clerk/nextjs';
|
||||
import { ENTITY_TYPE } from '@prisma/client';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { db } from "@/lib/db";
|
||||
import { db } from '@/lib/db';
|
||||
|
||||
export async function GET(
|
||||
req: Request,
|
||||
|
@ -12,7 +12,7 @@ export async function GET(
|
|||
const { orgId, userId } = auth();
|
||||
|
||||
if (!orgId || !userId)
|
||||
return new NextResponse(JSON.stringify({ error: "Unauthorized" }), {
|
||||
return new NextResponse(JSON.stringify({ error: 'Unauthorized' }), {
|
||||
status: 401,
|
||||
});
|
||||
|
||||
|
@ -23,7 +23,7 @@ export async function GET(
|
|||
entityType: ENTITY_TYPE.CARD,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
createdAt: 'desc',
|
||||
},
|
||||
take: 3,
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { auth } from "@clerk/nextjs";
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from '@clerk/nextjs';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { db } from "@/lib/db";
|
||||
import { db } from '@/lib/db';
|
||||
|
||||
export async function GET(
|
||||
req: Request,
|
||||
|
@ -11,7 +11,7 @@ export async function GET(
|
|||
const { orgId, userId } = auth();
|
||||
|
||||
if (!orgId || !userId)
|
||||
return new NextResponse(JSON.stringify({ error: "Unauthorized" }), {
|
||||
return new NextResponse(JSON.stringify({ error: 'Unauthorized' }), {
|
||||
status: 401,
|
||||
});
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import Stripe from "stripe";
|
||||
import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import Stripe from 'stripe';
|
||||
import { headers } from 'next/headers';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { db } from "@/lib/db";
|
||||
import { stripe } from "@/lib/stripe";
|
||||
import { db } from '@/lib/db';
|
||||
import { stripe } from '@/lib/stripe';
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const body = await req.text();
|
||||
const signature = headers().get("Stripe-Signature") as string;
|
||||
const signature = headers().get('Stripe-Signature') as string;
|
||||
|
||||
let event: Stripe.Event;
|
||||
|
||||
|
@ -23,13 +23,13 @@ export async function POST(req: Request) {
|
|||
|
||||
const session = event.data.object as Stripe.Checkout.Session;
|
||||
|
||||
if (event.type === "checkout.session.completed") {
|
||||
if (event.type === 'checkout.session.completed') {
|
||||
const subscription = await stripe.subscriptions.retrieve(
|
||||
session.subscription as string
|
||||
);
|
||||
|
||||
if (!session?.metadata?.orgId) {
|
||||
return new NextResponse(JSON.stringify({ error: "Missing orgId" }), {
|
||||
return new NextResponse(JSON.stringify({ error: 'Missing orgId' }), {
|
||||
status: 400,
|
||||
});
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export async function POST(req: Request) {
|
|||
});
|
||||
}
|
||||
|
||||
if (event.type === "invoice.payment_succeeded") {
|
||||
if (event.type === 'invoice.payment_succeeded') {
|
||||
const subscription = await stripe.subscriptions.retrieve(
|
||||
session.subscription as string
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue