This commit is contained in:
@@ -33,7 +33,7 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
const body = await req.json();
|
||||
const { projectId, label, email, expiresInDays = 30, password } = body;
|
||||
const { projectId, label, email, expiresInDays = 30, password, allowedEpisodes } = body;
|
||||
|
||||
if (!projectId) {
|
||||
return NextResponse.json({ error: "projectId is required" }, { status: 400 });
|
||||
@@ -49,6 +49,11 @@ export async function POST(req: NextRequest) {
|
||||
? await bcrypt.hash(password, 12)
|
||||
: null;
|
||||
|
||||
const episodeFilter =
|
||||
Array.isArray(allowedEpisodes) && allowedEpisodes.length > 0
|
||||
? (allowedEpisodes as string[]).filter((e) => typeof e === "string" && e.length > 0)
|
||||
: [];
|
||||
|
||||
const reviewSession = await db.reviewSession.create({
|
||||
data: {
|
||||
projectId,
|
||||
@@ -56,6 +61,7 @@ export async function POST(req: NextRequest) {
|
||||
email: email || null,
|
||||
passwordHash,
|
||||
expiresAt: addDays(new Date(), expiresInDays),
|
||||
allowedEpisodes: episodeFilter,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user