feat(cities): cities are a tree again, as legacy's; old dashboard permissions merged (PERS-02, PERM-01)
Cities (owner: as legacy) - City.parentId (self relation) replaces the flat `province` label; the migration turns each label into a parent row («استان …») first, so nothing is lost. - Admin pickers are legacy's tree (CityTreeSelect): the top level, the country, is a heading. The city form and grid get «والد». - Restored legacy _getP: a city without its own percent takes its ancestor's. Restored the omde-customer form's city → percent autofill. - Import copies legacy parents; delete refuses a city with children; a parent loop is refused. Permissions (owner approved the deletion) - dashboard / dashboard.omde / dashboard.tak rows become dashboard.view, then are deleted. - Import maps them the same way: legacy types 102, 104, 105, 108 and 135 had lost the dashboard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fbe7b98ada
commit
fbe4f38e06
+15
-4
@@ -113,11 +113,22 @@ async function main() {
|
||||
}
|
||||
|
||||
// ── Cities ────────────────────────────────────────────────────────────
|
||||
// A tree, as legacy's: country > province > city. The country is a heading
|
||||
// in the admin pickers; provinces and cities are selectable.
|
||||
const city = (id: string, name: string, parentId: string | null) =>
|
||||
prisma.city.upsert({ where: { id }, update: {}, create: { id, name, parentId } });
|
||||
await city('city-iran', 'ایران', null);
|
||||
await Promise.all([
|
||||
city('city-prov-tehran', 'استان تهران', 'city-iran'),
|
||||
city('city-prov-khorasan-razavi', 'استان خراسان رضوی', 'city-iran'),
|
||||
city('city-prov-isfahan', 'استان اصفهان', 'city-iran'),
|
||||
city('city-prov-east-azarbaijan', 'استان آذربایجان شرقی', 'city-iran'),
|
||||
]);
|
||||
const [tehran, mashhad, isfahan, tabriz] = await Promise.all([
|
||||
prisma.city.upsert({ where: { id: 'city-tehran' }, update: {}, create: { id: 'city-tehran', name: 'تهران', province: 'تهران' } }),
|
||||
prisma.city.upsert({ where: { id: 'city-mashhad' }, update: {}, create: { id: 'city-mashhad', name: 'مشهد', province: 'خراسان رضوی' } }),
|
||||
prisma.city.upsert({ where: { id: 'city-isfahan' }, update: {}, create: { id: 'city-isfahan', name: 'اصفهان', province: 'اصفهان' } }),
|
||||
prisma.city.upsert({ where: { id: 'city-tabriz' }, update: {}, create: { id: 'city-tabriz', name: 'تبریز', province: 'آذربایجان شرقی' } }),
|
||||
city('city-tehran', 'تهران', 'city-prov-tehran'),
|
||||
city('city-mashhad', 'مشهد', 'city-prov-khorasan-razavi'),
|
||||
city('city-isfahan', 'اصفهان', 'city-prov-isfahan'),
|
||||
city('city-tabriz', 'تبریز', 'city-prov-east-azarbaijan'),
|
||||
]);
|
||||
|
||||
// ── Branches & workshop ──────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user