Formated Files

This commit is contained in:
Ahmad 2024-02-15 20:49:19 -05:00
parent d5631b309a
commit e768d9181f
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
138 changed files with 1829 additions and 1851 deletions

View file

@ -1,24 +1,24 @@
"use server";
'use server';
import { auth } from "@clerk/nextjs";
import { revalidatePath } from "next/cache";
import { auth } from '@clerk/nextjs';
import { revalidatePath } from 'next/cache';
import { db } from "@/lib/db";
import { createSafeAction } from "@/lib/create-safe-action";
import { db } from '@/lib/db';
import { createSafeAction } from '@/lib/create-safe-action';
import { InputType, ReturnType } from "./types";
import { CreateBoard } from "./schema";
import { createAuditLog } from "@/lib/create-audit-log";
import { ACTION, ENTITY_TYPE } from "@prisma/client";
import { incrementAvailableCount, hasAvailableCount } from "@/lib/org-limit";
import { checkSubscription } from "@/lib/subscription";
import { InputType, ReturnType } from './types';
import { CreateBoard } from './schema';
import { createAuditLog } from '@/lib/create-audit-log';
import { ACTION, ENTITY_TYPE } from '@prisma/client';
import { incrementAvailableCount, hasAvailableCount } from '@/lib/org-limit';
import { checkSubscription } from '@/lib/subscription';
const handler = async (data: InputType): Promise<ReturnType> => {
const { userId, orgId } = auth();
if (!userId || !orgId) {
return {
error: "Unauthorized",
error: 'Unauthorized',
};
}
@ -28,14 +28,14 @@ const handler = async (data: InputType): Promise<ReturnType> => {
if (!canCreate && !isPro) {
return {
error:
"You have reached your limit of free boards. Please upgrade to create more.",
'You have reached your limit of free boards. Please upgrade to create more.',
};
}
const { title, image } = data;
const [imageId, imageThumbUrl, imageFullUrl, imageLinkHTML, imageUserName] =
image.split("|");
image.split('|');
if (
!imageId ||
@ -45,7 +45,7 @@ const handler = async (data: InputType): Promise<ReturnType> => {
!imageLinkHTML
) {
return {
error: "Missing fields. Failed to create board.",
error: 'Missing fields. Failed to create board.',
};
}
@ -76,7 +76,7 @@ const handler = async (data: InputType): Promise<ReturnType> => {
});
} catch (error) {
return {
error: "Failed to create board",
error: 'Failed to create board',
};
}