mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-04 12:43:24 +00:00
Formated Files
This commit is contained in:
parent
d5631b309a
commit
e768d9181f
138 changed files with 1829 additions and 1851 deletions
|
@ -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',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue