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';
|
2025-01-11 06:04:43 +00:00
|
|
|
import { BoardRoomWrapper } from './_components/board-room-wrapper';
|
2024-02-15 02:30:10 +00:00
|
|
|
|
|
|
|
interface BoardIdPageProps {
|
2024-10-15 23:55:03 +00:00
|
|
|
params: Promise<{
|
2024-02-15 02:30:10 +00:00
|
|
|
boardId: string;
|
2024-10-15 23:55:03 +00:00
|
|
|
}>;
|
2024-02-15 02:30:10 +00:00
|
|
|
}
|
|
|
|
|
2024-10-15 23:55:03 +00:00
|
|
|
const BoardIdPage = async (props: BoardIdPageProps) => {
|
|
|
|
const params = await props.params;
|
2024-10-23 23:17:45 +00:00
|
|
|
const { orgId } = await auth();
|
2024-02-15 02:30:10 +00:00
|
|
|
|
|
|
|
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 (
|
2025-01-11 06:04:43 +00:00
|
|
|
<BoardRoomWrapper>
|
|
|
|
<div className='h-full overflow-x-auto p-4'>
|
|
|
|
<ListContainer boardId={params.boardId} data={lists} />
|
|
|
|
</div>
|
|
|
|
</BoardRoomWrapper>
|
2024-02-16 01:49:19 +00:00
|
|
|
);
|
2024-02-15 02:30:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BoardIdPage;
|