feat: require brand description in create and update operations, add validation messages
Frontend CI / Frontend (push) Successful in 4m25s
Backend CI / Backend (push) Successful in 15m23s

This commit is contained in:
2026-06-09 14:09:05 +08:00
parent a6d203a300
commit 41f5623791
9 changed files with 148 additions and 25 deletions
+7 -3
View File
@@ -195,7 +195,7 @@ const createBrandMutation = useMutation({
brandsApi.create({
name: brandForm.name.trim(),
website: brandForm.website.trim() || null,
description: brandForm.description.trim() || null,
description: brandForm.description.trim(),
}),
onSuccess: async (brand) => {
message.success(t('brands.messages.createBrand'))
@@ -212,6 +212,10 @@ async function submitBrand(): Promise<void> {
if (!brandForm.name.trim()) {
return
}
if (!brandForm.description.trim()) {
message.warning(t('brands.messages.brandDescriptionRequired'))
return
}
await createBrandMutation.mutateAsync()
}
@@ -868,13 +872,13 @@ onBeforeUnmount(() => {
@ok="submitBrand"
>
<a-form layout="vertical">
<a-form-item :label="t('brands.form.brandName')">
<a-form-item :label="t('brands.form.brandName')" required>
<a-input v-model:value="brandForm.name" />
</a-form-item>
<a-form-item :label="t('brands.form.brandWebsite')">
<a-input v-model:value="brandForm.website" />
</a-form-item>
<a-form-item :label="t('brands.form.brandDescription')">
<a-form-item :label="t('brands.form.brandDescription')" required>
<a-textarea v-model:value="brandForm.description" :rows="4" />
</a-form-item>
</a-form>