Files
meezi/src/Meezi.API/Validators/PatchCafeSettingsRequestValidator.cs
T
soroush.asadi cd1af30bbc
CI/CD / CI · API (dotnet build + test) (push) Successful in 5m50s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 32s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m3s
CI/CD / CI · Admin Web (tsc) (push) Successful in 35s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 48s
CI/CD / Deploy · all services (push) Has been cancelled
fix: sidebar accordion + koja slug + support ticket LINQ crash
Sidebar:
- All groups start collapsed on first load (v4 storage key resets old state)
- Opening one group closes all others (accordion)
- Navigating to a section opens only that section's group

Koja slug:
- SlugHelper: Persian->Latin transliteration, slug validation
- Registration accepts optional custom slug; auto-derives from cafe name
- Slug can be updated from dashboard Settings -> Profile
- Settings PATCH validates uniqueness (SLUG_TAKEN) and format (INVALID_SLUG)
- koja.meezi.ir/{slug} now redirects to /fa/cafe/{slug} (short URL support)

Bug fix:
- SupportTicketService: cafeId/status filters applied before Select() projection
  to fix EF "could not be translated" crash on the support tickets page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 22:28:25 +03:30

34 lines
1.7 KiB
C#

using FluentValidation;
using Meezi.API.Models.Cafes;
using Meezi.Core.Utilities;
namespace Meezi.API.Validators;
public class PatchCafeSettingsRequestValidator : AbstractValidator<PatchCafeSettingsRequest>
{
public PatchCafeSettingsRequestValidator()
{
RuleFor(x => x.Name).MaximumLength(200).When(x => x.Name is not null);
RuleFor(x => x.Slug)
.Must(s => s == null || SlugHelper.IsValidSlug(s))
.WithMessage("Slug must be 2-80 lowercase letters, digits, or hyphens (e.g. my-cafe).")
.When(x => x.Slug is not null);
RuleFor(x => x.Phone).MaximumLength(20).When(x => x.Phone is not null);
RuleFor(x => x.Address).MaximumLength(500).When(x => x.Address is not null);
RuleFor(x => x.City).MaximumLength(100).When(x => x.City is not null);
RuleFor(x => x.Description).MaximumLength(2000).When(x => x.Description is not null);
RuleFor(x => x.LogoUrl).MaximumLength(500).When(x => x.LogoUrl is not null);
RuleFor(x => x.CoverImageUrl).MaximumLength(500).When(x => x.CoverImageUrl is not null);
RuleFor(x => x.SnappfoodVendorId).MaximumLength(100).When(x => x.SnappfoodVendorId is not null);
When(x => x.Theme is not null, () =>
{
RuleFor(x => x.Theme!.PaletteId).NotEmpty().MaximumLength(48);
RuleFor(x => x.Theme!.PanelStyle).NotEmpty().MaximumLength(24);
RuleFor(x => x.Theme!.MenuStyle).NotEmpty().MaximumLength(24);
RuleFor(x => x.Theme!.MenuTexture).NotEmpty().MaximumLength(24);
RuleFor(x => x.Theme!.Density).NotEmpty().MaximumLength(24);
RuleFor(x => x.Theme!.Radius).NotEmpty().MaximumLength(24);
});
}
}