From 37ebc1b6bba72608e4d17b074acef7e2d22bb56a Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 22 Oct 2026 11:54:38 +0900 Subject: [PATCH] =?UTF-8?q?261022=5F04=5FENH:=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=B0=A8=ED=8A=B8=20R=ED=8C=80=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EB=B2=94=EC=9C=84=20=EC=A0=9C=ED=95=9C=20=EB=B0=8F=20O/N=20?= =?UTF-8?q?=EB=AC=B8=ED=95=AD=20=ED=95=98=EC=9C=84=20row=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EB=93=B1=EB=A1=9D=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agent/references/repository-rules.md | 4 ++-- .../server/service/upload/QuestionImportService.java | 11 +++++++++++ src/main/resources/mybatis/mapper/ProjectMapper.xml | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.agent/references/repository-rules.md b/.agent/references/repository-rules.md index 4964274..c7ba0b4 100644 --- a/.agent/references/repository-rules.md +++ b/.agent/references/repository-rules.md @@ -157,7 +157,7 @@ ## Upload migration - Implement POST /project/{projectType}/{pkey}/import/title, /question and /data as multipart file uploads. Return processedRows/affectedRows/removedRows/archivedRows; no presentation messages. Common JWT is required; the existing External allowlist denies all imports. Ordinary role/team restrictions stay deferred. -- Title upload resets eligible explain values, then updates only explain by pkey/QID; variable/title are ignored, unknown IDs no-op and duplicate IDs are sequential. Question upload resets QUESTION/QOPTION/QUOTASET/QUOTA(original QSORDER condition) and STRUCTURE before sequential Q1/Qorder creation; retain existing dataset/option quirks and JSON strings in QINFO/LINFO, never introduce JSON_QUERY around those string parameters. +- Title upload resets eligible explain values, then updates only explain by pkey/QID; variable/title are ignored, unknown IDs no-op and duplicate IDs are sequential. Question upload resets QUESTION/QOPTION/QUOTASET/QUOTA(original QSORDER condition) and STRUCTURE before sequential Q1/Qorder creation; retain existing dataset/option quirks and JSON strings in QINFO/LINFO, never introduce JSON_QUERY around those string parameters. Per user decision (2026-10-22), O/N questions with no input rows (none, attribute-only or blank titles) get one open input {label:"", option all/num, must 1} instead of failing; other types still require choices. - Data upload deletes UPLOAD responses, moves actual completed responses to DEL_+PKEY, and inserts UPLOAD rows; do not mutate TEST/incomplete/other projects/DERIVED_DATA. Preserve two header rows, six distinct fixed-group skip, multi pull-up keys including duplicates, INDEX and midpoint/final timestamps, empty defaults and original text normalization. - Parse/convert the entire file before destructive SQL; all changes use the selected KON/KONKIWI transaction with a project lock and rollback. SQL values/JSON paths are bound. No shared DB execution or schema changes are authorized. - Preserve xlsx first-sheet/positional columns/blank rows/cached formulas and csv/txt simple delimiter plus EUC-KR/BOM behavior. Use Common ExcelUtil; its map reader drops rows and changes positional/formula rules, so a domain-specific POI reader is necessary. Existing 20MB limit applies. @@ -180,7 +180,7 @@ - User approved: userRole 1001 has no authenticated-team/assignment limit in project list/summary. This intentionally unifies legacy admin 0 and DCO 1. Existing business search/exclusion filters still apply. - Controller RequestUserContext is authoritative for role/team/id for JWT and API Key. No permission enums/grants or user-submitted authorization claims. Missing project identity metadata fails instead of broadening visibility. -- Preserve current frontend v2 KON/KIWI list branching for other roles: team != M101 excludes GKEY M101; R-prefixed teams additionally require own GKEY; team M101 list has no extra team filter. Summary preserves its different legacy if/else-if: M101 team only own GKEY, all other teams exclude M101, including R teams without an added own-team condition. +- Preserve current frontend v2 KON/KIWI list branching for other roles: team != M101 excludes GKEY M101; R-prefixed teams additionally require own GKEY; team M101 list has no extra team filter. Summary: M101 team only own GKEY, all other teams exclude M101, and (user decision 2026-10-22, replacing the legacy else-if) R-prefixed teams additionally require own GKEY, matching the list. - Role 9001 additionally intersects REPORT_ASSIGN by exact member_mail=verified userId. Query the kart session (Report DB) once per request for both survey sources, do not add is_use (not used by original), do not append email domains, and empty assignments return no rows. REPORT_MEMBER emits exact member_mail as userId; other authentication also uses verified userId verbatim. - Apply team/assignment before candidate TOP 50 and ordering, never after Java merge/TOP 6. Must-view does not override authorization. Linked list retains its business query team and adds separately named authenticated-team/role/assignment constraints. - Derived management list: role 1001 sees all project definitions; others see matching GKEY only. Keep normal questions/report metadata unfiltered by this management rule. diff --git a/src/main/java/com/kri/kart/server/service/upload/QuestionImportService.java b/src/main/java/com/kri/kart/server/service/upload/QuestionImportService.java index 8ee008f..1f3044c 100644 --- a/src/main/java/com/kri/kart/server/service/upload/QuestionImportService.java +++ b/src/main/java/com/kri/kart/server/service/upload/QuestionImportService.java @@ -86,6 +86,17 @@ public class QuestionImportService { labels.set(Integer.toString(labels.size() + 1), label); } } + // User decision: O/N without input rows (none, attribute-only or blank titles) get one + // input with an empty label instead of failing. + if (itemType.equals("open") && labels.isEmpty()) { + labels.set( + "1", + objectMapper + .createObjectNode() + .put("label", "") + .put("option", type.equals("n") ? "num" : "all") + .put("must", "1")); + } ObjectNode dataset = objectMapper.createObjectNode(); if (!labels.isEmpty()) { dataset.set(itemType, labels); diff --git a/src/main/resources/mybatis/mapper/ProjectMapper.xml b/src/main/resources/mybatis/mapper/ProjectMapper.xml index dcb4d27..6b09279 100644 --- a/src/main/resources/mybatis/mapper/ProjectMapper.xml +++ b/src/main/resources/mybatis/mapper/ProjectMapper.xml @@ -33,6 +33,9 @@ AND GKEY = #{authenticatedUserTeam} 'M101']]> + + AND GKEY = #{authenticatedUserTeam} +