Skip to content

Commit dd4f741

Browse files
committed
refactor: 프론트엔드 리팩토링으로 불필요한 로직 제거
1 parent ddb4a43 commit dd4f741

3 files changed

Lines changed: 1 addition & 32 deletions

File tree

app/admin_api/test/shop/categories_api_test.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
LIST_URL = reverse("v1:admin-shop-category-list")
1111
CHOICES_URL = LIST_URL + "choices/"
12-
JSON_SCHEMA_URL = LIST_URL + "json-schema/"
1312

1413

1514
@pytest.fixture
@@ -63,16 +62,6 @@ def test_category_choices_include_meta_for_event(api_client, category_fixtures):
6362
assert event_meta["started_at"] == "2026-08-01"
6463

6564

66-
@pytest.mark.django_db
67-
def test_category_json_schema_exposes_choice_meta_schema(api_client, category_fixtures):
68-
response = api_client.get(JSON_SCHEMA_URL)
69-
assert response.status_code == HTTP_200_OK
70-
ui_schema = response.json()["ui_schema"]
71-
meta_schema = ui_schema["event"]["ui:options"]["choiceMetaSchema"]
72-
assert meta_schema["organization"]["label"] == "조직"
73-
assert ui_schema["group"]["ui:options"]["choiceMetaSchema"]["priority"]["label"] == "순서"
74-
75-
7665
@pytest.mark.django_db
7766
def test_category_choices_include_audit_meta_for_event(api_client, category_fixtures):
7867
# BaseAbstractModel 의 audit 메타(created_by/updated_by/created_at/updated_at)가 자동으로 붙어야 한다.
@@ -84,15 +73,6 @@ def test_category_choices_include_audit_meta_for_event(api_client, category_fixt
8473
assert event_meta["created_at"] is not None
8574

8675

87-
@pytest.mark.django_db
88-
def test_category_json_schema_exposes_audit_meta_schema(api_client, category_fixtures):
89-
response = api_client.get(JSON_SCHEMA_URL)
90-
assert response.status_code == HTTP_200_OK
91-
meta_schema = response.json()["ui_schema"]["event"]["ui:options"]["choiceMetaSchema"]
92-
assert meta_schema["created_by"]["label"] == "생성자"
93-
assert {"created_by", "updated_by", "created_at", "updated_at"} <= set(meta_schema)
94-
95-
9676
@pytest.mark.django_db
9777
def test_category_filter_by_group(api_client, category_fixtures):
9878
response = api_client.get(LIST_URL, {"group": str(category_fixtures["g2026"].id)})

app/core/models.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313

1414
User = get_user_model()
1515

16-
AUDIT_CHOICE_META_SCHEMA: dict[str, dict[str, str]] = {
17-
"created_by": {"label": "생성자", "type": "string", "filter": "select"},
18-
"updated_by": {"label": "수정자", "type": "string", "filter": "select"},
19-
"created_at": {"label": "생성일시", "type": "string", "filter": "search"},
20-
"updated_at": {"label": "수정일시", "type": "string", "filter": "search"},
21-
}
22-
2316

2417
class BaseAbstractModelQuerySet(models.QuerySet):
2518
def create(self, **kwargs: dict) -> models.Model:

app/core/openapi/ui_hints.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from core.models import AUDIT_CHOICE_META_SCHEMA, MarkdownField
1+
from core.models import MarkdownField
22
from django.db.models.fields import TextField
33
from django.db.models.fields.files import FileField
44
from django.db.models.fields.related import ForeignKey, ManyToManyField
@@ -13,10 +13,6 @@ def ui_hints_for_model_field(model_field: object) -> dict:
1313
"choiceApp": model_field.related_model._meta.app_config.name.split(".")[0],
1414
"choiceResource": model_field.related_model._meta.model_name,
1515
}
16-
if meta_schema := getattr(model_field.related_model, "choices_meta_schema", None):
17-
if hasattr(model_field.related_model, "get_audit_choice_meta"):
18-
meta_schema = meta_schema | AUDIT_CHOICE_META_SCHEMA
19-
hints["ui:options"]["choiceMetaSchema"] = meta_schema
2016

2117
if isinstance(model_field, ManyToManyField):
2218
return hints | {"ui:field": "m2m_select"}

0 commit comments

Comments
 (0)