Add title field to EmailTemplate model and update UI

This commit is contained in:
Ken Yasue
2025-03-25 11:43:47 +01:00
parent 6b9e208214
commit e1440bcea7
6 changed files with 41 additions and 13 deletions

View File

@ -55,17 +55,18 @@ export async function PUT(
}
const data = await request.json();
const { content } = data;
const { title, content } = data;
// Validate required fields
if (!content) {
if (!title || !content) {
return NextResponse.json(
{ error: 'Content is required' },
{ error: 'Title and content are required' },
{ status: 400 }
);
}
// Update email template fields
emailTemplate.title = title;
emailTemplate.content = content;
// Save the updated email template