summaryrefslogtreecommitdiff
path: root/app/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/api')
-rw-r--r--app/api/admin/clear-test-data/route.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/api/admin/clear-test-data/route.ts b/app/api/admin/clear-test-data/route.ts
index 8442e5de..b54adf34 100644
--- a/app/api/admin/clear-test-data/route.ts
+++ b/app/api/admin/clear-test-data/route.ts
@@ -1,9 +1,9 @@
// app/api/admin/clear-test-data/route.ts
import db from '@/db/db'
-import {
- formEntries,
- forms,
- formMetas,
+import {
+ formEntries,
+ forms,
+ formMetas,
tags,
tagTypes,
tagSubfields,
@@ -19,7 +19,7 @@ export async function DELETE(request: NextRequest) {
try {
// 외래키 참조 순서를 고려하여 삭제 (자식 테이블부터 부모 테이블 순)
console.log('Clearing all test data...')
-
+
const deletedCounts = {
tagClassAttributes: 0,
tagClasses: 0,
@@ -28,6 +28,7 @@ export async function DELETE(request: NextRequest) {
tagTypes: 0,
tagTypeClassFormMappings: 0,
vendorDataReportTemps: 0,
+ templateItems:0,
formEntries: 0,
tags: 0,
forms: 0,
@@ -59,6 +60,10 @@ export async function DELETE(request: NextRequest) {
deletedCounts.tagTypes = deletedTagTypes.rowCount || 0
console.log('Deleted tag types:', deletedCounts.tagTypes)
+ const deletedTemplateItems = await db.delete(templateItems);
+ deletedCounts.templateItems = deletedTemplateItems.rowCount || 0;
+ console.log('Deleted template items:', deletedCounts.templateItems);
+
// 6. tagTypeClassFormMappings 삭제
const deletedMappings = await db.delete(tagTypeClassFormMappings)
deletedCounts.tagTypeClassFormMappings = deletedMappings.rowCount || 0
@@ -121,7 +126,7 @@ export async function GET() {
method: 'DELETE',
tables: [
'tagClassAttributes',
- 'tagClasses',
+ 'tagClasses',
'tagSubfieldOptions',
'tagSubfields',
'tagTypes',