feat(backend): add is_regex to dictionary API routes
Add is_regex field to list, add, and edit dictionary entry API responses, and pass is_regex through to DictionaryEntryCRUD methods.
This commit is contained in:
@@ -202,6 +202,7 @@ async def list_dictionary_entries(
|
||||
"context_data": e.context_data,
|
||||
"usage_notes": e.usage_notes,
|
||||
"has_context": e.has_context,
|
||||
"is_regex": e.is_regex,
|
||||
"context_source": e.context_source,
|
||||
"origin_source_language": e.origin_source_language,
|
||||
"created_at": e.created_at,
|
||||
@@ -239,6 +240,7 @@ async def add_dictionary_entry(
|
||||
context_notes=payload.context_notes,
|
||||
source_language=payload.source_language,
|
||||
target_language=payload.target_language,
|
||||
is_regex=payload.is_regex,
|
||||
)
|
||||
logger.reflect("Entry added", {"entry_id": entry.id})
|
||||
return {
|
||||
@@ -253,6 +255,7 @@ async def add_dictionary_entry(
|
||||
"context_data": entry.context_data,
|
||||
"usage_notes": entry.usage_notes,
|
||||
"has_context": entry.has_context,
|
||||
"is_regex": entry.is_regex,
|
||||
"context_source": entry.context_source,
|
||||
"origin_source_language": entry.origin_source_language,
|
||||
"created_at": entry.created_at,
|
||||
@@ -289,6 +292,7 @@ async def edit_dictionary_entry(
|
||||
context_notes=payload.context_notes,
|
||||
source_language=payload.source_language,
|
||||
target_language=payload.target_language,
|
||||
is_regex=payload.is_regex,
|
||||
)
|
||||
logger.reflect("Entry updated", {"entry_id": entry_id})
|
||||
return {
|
||||
@@ -303,6 +307,7 @@ async def edit_dictionary_entry(
|
||||
"context_data": entry.context_data,
|
||||
"usage_notes": entry.usage_notes,
|
||||
"has_context": entry.has_context,
|
||||
"is_regex": entry.is_regex,
|
||||
"context_source": entry.context_source,
|
||||
"origin_source_language": entry.origin_source_language,
|
||||
"created_at": entry.created_at,
|
||||
@@ -343,7 +348,6 @@ async def delete_dictionary_entry(
|
||||
# @BRIEF Import entries into a terminology dictionary from CSV/TSV content.
|
||||
# @PRE User has translate.dictionary.edit permission.
|
||||
# @POST Entries are imported per conflict mode.
|
||||
# @COMPLEXITY 4
|
||||
|
||||
@router.post("/dictionaries/{dictionary_id}/import")
|
||||
async def import_dictionary_entries(
|
||||
|
||||
Reference in New Issue
Block a user