2024-03-21 21:15:27 +00:00
|
|
|
import { auth } from '@clerk/nextjs/server';
|
2024-02-16 01:49:19 +00:00
|
|
|
import { redirect } from 'next/navigation';
|
2024-02-15 02:30:10 +00:00
|
|
|
|
2024-02-16 01:49:19 +00:00
|
|
|
import { db } from '@/lib/db';
|
|
|
|
import { ListContainer } from './_components/list-container';
|
2024-02-15 02:30:10 +00:00
|
|
|
|
|
|
|
interface BoardIdPageProps {
|
|
|
|
params: {
|
|
|
|
boardId: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const BoardIdPage = async ({ params }: BoardIdPageProps) => {
|
|
|
|
const { orgId } = auth();
|
|
|
|
|
|
|
|
if (!orgId) {
|
2024-02-16 01:49:19 +00:00
|
|
|
redirect('/select-org');
|
2024-02-15 02:30:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const lists = await db.list.findMany({
|
|
|
|
where: {
|
|
|
|
boardId: params.boardId,
|
|
|
|
board: {
|
|
|
|
orgId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
include: {
|
|
|
|
cards: {
|
|
|
|
orderBy: {
|
2024-02-16 01:49:19 +00:00
|
|
|
order: 'asc',
|
2024-02-15 02:30:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
orderBy: {
|
2024-02-16 01:49:19 +00:00
|
|
|
order: 'asc',
|
2024-02-15 02:30:10 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
2024-02-16 01:49:19 +00:00
|
|
|
<div className='h-full overflow-x-auto p-4'>
|
2024-02-15 02:30:10 +00:00
|
|
|
<ListContainer boardId={params.boardId} data={lists} />
|
|
|
|
</div>
|
2024-02-16 01:49:19 +00:00
|
|
|
);
|
2024-02-15 02:30:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BoardIdPage;
|