Skip to content

Commit e81ecd7

Browse files
committed
feat(catalog): add ability to show catalog in help me choose
1 parent 6d367fe commit e81ecd7

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

apps/tool_picker/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class QuestionInline(admin.StackedInline): # type: ignore[reportMissingTypeArgu
3737

3838
@admin.register(Catalog)
3939
class CatalogAdmin(UserResourceAdmin, admin.ModelAdmin): # type: ignore[reportMissingTypeArgument]
40-
list_display = ["name", "question_count", "tool_count"]
40+
list_display = ["name", "question_count", "tool_count", "show_in_help_me_choose"]
4141
search_fields = ["name", "description"]
4242
inlines = [QuestionInline]
4343

apps/tool_picker/graphql/filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@strawberry_django.filters.filter(Catalog, lookups=True)
88
class CatalogFilter:
99
id: strawberry.ID | None
10+
show_in_help_me_choose: strawberry.auto
1011

1112

1213
@strawberry_django.filters.filter(Tool, lookups=True)

apps/tool_picker/graphql/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class QuestionType:
3939
class CatalogType:
4040
id: strawberry.ID
4141
name: strawberry.auto
42+
show_in_help_me_choose: strawberry.auto
4243
description: strawberry.auto
4344
questions: list[QuestionType]
4445

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.9 on 2026-01-08 06:43
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('tool_picker', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='catalog',
15+
name='show_in_help_me_choose',
16+
field=models.BooleanField(default=False),
17+
),
18+
]

apps/tool_picker/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Catalog(UserResource):
1414

1515
name = models.CharField[str, str](max_length=200)
1616
description = models.TextField[str, str]()
17+
show_in_help_me_choose = models.BooleanField[bool | None, bool | None](default=False)
1718

1819
# type hints
1920
questions: typing.ClassVar[RelatedManager["Question"]]

schema.graphql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ type AppEnumCollectionQuestionTypeEnum {
1313
label: String!
1414
}
1515

16+
input BoolBaseFilterLookup {
17+
"""Exact match. Filter will be skipped on `null` value"""
18+
exact: Boolean
19+
20+
"""Assignment test. Filter will be skipped on `null` value"""
21+
isNull: Boolean
22+
23+
"""
24+
Exact match of items in a given list. Filter will be skipped on `null` value
25+
"""
26+
inList: [Boolean!]
27+
}
28+
1629
"""Model representing case study of national society for specific tool."""
1730
input CaseStudyFilter {
1831
id: ID
@@ -48,6 +61,7 @@ type CaseStudyTypeOffsetPaginated {
4861
"""Model representing catalog where a tool belongs to."""
4962
input CatalogFilter {
5063
id: ID
64+
showInHelpMeChoose: BoolBaseFilterLookup
5165
AND: CatalogFilter
5266
OR: CatalogFilter
5367
NOT: CatalogFilter
@@ -62,6 +76,7 @@ input CatalogOrder {
6276
type CatalogType {
6377
id: ID!
6478
name: String!
79+
showInHelpMeChoose: Boolean!
6580
description: String!
6681
questions: [QuestionType!]!
6782
}

0 commit comments

Comments
 (0)