feat(api): .NET 10 multi-tenant REST API

Full backend implementation:
- Multi-tenant cafe/restaurant management (menus, orders, tables, staff)
- POS order flow with ZarinPal and Snappfood payment integration
- OTP authentication via Kavenegar SMS
- QR digital menu with public discover/finder endpoints
- Customer loyalty, coupons, CRM
- PostgreSQL via EF Core, Redis for caching/sessions
- Background jobs, webhook handlers
- Full migration history

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-27 21:33:48 +03:30
parent 03376b3ea1
commit ef15fd6247
472 changed files with 120358 additions and 0 deletions
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Meezi.Infrastructure\Meezi.Infrastructure.csproj" />
</ItemGroup>
</Project>
+73
View File
@@ -0,0 +1,73 @@
using System.Text.Json;
using Meezi.Infrastructure.Data;
/// <summary>
/// One-time importer: copies Food-101 JPEGs into uploads/{cafeId}/ and updates menu-image-manifest paths.
/// Usage: dotnet run --project tools/MenuImageImporter -- --food101 "C:\data\food-101\images" --cafe cafe_demo_001 --out uploads
/// </summary>
var argsList = args.ToList();
string? food101Root = GetArg("--food101");
var cafeId = GetArg("--cafe") ?? "cafe_demo_001";
var outRoot = GetArg("--out") ?? "uploads";
var manifestPath = GetArg("--manifest")
?? Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "data", "menu-image-manifest.json"));
var defaultClassMap = DemoMenuCatalog.Items
.ToDictionary(i => i.Id, i => i.Food101Class, StringComparer.Ordinal);
if (string.IsNullOrEmpty(food101Root) || !Directory.Exists(food101Root))
{
Console.WriteLine("Food-101 image root not found. Pass --food101 <path-to-food-101/images>.");
Console.WriteLine("Mapping (demo item id → Food-101 class folder):");
foreach (var (id, cls) in defaultClassMap)
Console.WriteLine($" {id} → {cls}");
return 1;
}
if (!File.Exists(manifestPath))
{
Console.WriteLine($"Manifest not found: {manifestPath}");
return 1;
}
var manifestJson = await File.ReadAllTextAsync(manifestPath);
using var doc = JsonDocument.Parse(manifestJson);
var root = doc.RootElement.Clone();
var items = root.GetProperty("items");
var cafeDir = Path.Combine(outRoot, cafeId);
Directory.CreateDirectory(cafeDir);
var updated = 0;
foreach (var (itemId, className) in defaultClassMap)
{
var classDir = Path.Combine(food101Root, className);
if (!Directory.Exists(classDir))
{
Console.WriteLine($"Skip {itemId}: class folder missing {className}");
continue;
}
var source = Directory.GetFiles(classDir, "*.jpg").Concat(Directory.GetFiles(classDir, "*.jpeg")).FirstOrDefault();
if (source is null) continue;
var destName = $"{itemId}.jpg";
var destPath = Path.Combine(cafeDir, destName);
File.Copy(source, destPath, overwrite: true);
if (items.TryGetProperty(itemId, out var entry) && entry.ValueKind == JsonValueKind.Object)
{
var rel = $"/uploads/{cafeId}/{destName}";
Console.WriteLine($"Copied {itemId} → {destPath} (set imageUrl: {rel})");
updated++;
}
}
Console.WriteLine($"Done. {updated} images copied to {cafeDir}. Re-run API seeder or PATCH menu items with /uploads paths.");
return 0;
string? GetArg(string name)
{
var i = argsList.IndexOf(name);
return i >= 0 && i + 1 < argsList.Count ? argsList[i + 1] : null;
}
+73
View File
@@ -0,0 +1,73 @@
using System.Text.Json;
using Meezi.Infrastructure.Data;
static string FindRepoRoot()
{
var dir = new DirectoryInfo(AppContext.BaseDirectory);
while (dir is not null)
{
if (File.Exists(Path.Combine(dir.FullName, "MEEZI_PRD.md"))
|| Directory.Exists(Path.Combine(dir.FullName, "data")))
return dir.FullName;
dir = dir.Parent;
}
return Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", ".."));
}
var repoRoot = FindRepoRoot();
var manifestPath = Path.Combine(repoRoot, "data", "menu-image-manifest.json");
var demoMenuPath = Path.Combine(repoRoot, "data", "demo-menu-food101.json");
var items = new Dictionary<string, object>(StringComparer.Ordinal);
foreach (var item in DemoMenuCatalog.Items)
{
items[item.Id] = new
{
food101Class = item.Food101Class,
imageUrl = Food101ImageFallbacks.Resolve(
item.Food101Class,
MenuItemImageDefaults.InferKind(item.CategoryId)),
nameEn = item.NameEn,
categoryId = item.CategoryId
};
}
var manifest = new
{
version = 2,
source = "Food-101 class mapping (Unsplash fallbacks until Kaggle JPEG import)",
defaults = new
{
drink = MenuImageManifest.GetDefaultDrinkImageUrl(),
food = MenuImageManifest.GetDefaultFoodImageUrl()
},
items
};
var options = new JsonSerializerOptions { WriteIndented = true };
await File.WriteAllTextAsync(manifestPath, JsonSerializer.Serialize(manifest, options) + Environment.NewLine);
var demoExport = new
{
version = 1,
cafeId = "cafe_demo_001",
categories = DemoMenuCatalog.Categories,
items = DemoMenuCatalog.Items.Select(i => new
{
i.Id,
i.CategoryId,
i.Name,
i.NameEn,
i.NameAr,
i.Description,
priceToman = i.PriceToman,
i.DiscountPercent,
i.Food101Class,
imageUrl = DemoMenuCatalog.ResolveItemImageUrl(i)
})
};
await File.WriteAllTextAsync(demoMenuPath, JsonSerializer.Serialize(demoExport, options) + Environment.NewLine);
Console.WriteLine($"Wrote {items.Count} items → {manifestPath}");
Console.WriteLine($"Wrote demo menu export → {demoMenuPath}");
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Meezi.Infrastructure\Meezi.Infrastructure.csproj" />
</ItemGroup>
</Project>