Commit Graph
67 Commits
Author SHA1 Message Date
mohmdsdg a98fdb8d9e feat(remittance): add enable_remittance plugin setting to catalog and seeds 2026-10-27 18:07:10 +03:30
mohmdsdg f0989e03e3 added chart plugin in khanegi superadmin 2026-10-21 11:13:32 +03:30
mohmdsdg 47d210bd7d added chart plugin in khanegi superadmin 2026-10-21 11:13:24 +03:30
mohmdsdg 7521c69c11 added main page config 2026-10-13 19:28:57 +03:30
mohmdsdg 421415fc30 added main page config 2026-10-13 19:28:45 +03:30
mohmdsdg 4881ce2f30 fix landing and logo border show 2026-10-12 21:55:24 +03:30
mohmdsdgandCursor 0c29222e9d Expose the price-channel per-product message template.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-04 20:42:56 +03:30
mohmdsdg e862ffd6da chore: sync project updates 2026-09-28 14:12:22 +03:30
mohmdsdgandCopilot 233f5e7d01 chore: sync graphify and UI updates
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-22 11:36:10 +03:30
mohmdsdgandCursor e0dd53d639 Reclaim tenant aliases from every other version, not only the same product.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 18:20:07 +03:30
mohmdsdg 6ba6a9cd45 fix some extention bug 2026-09-16 13:44:58 +03:30
mohmdsdgandCursor cf92635c0e Fix plugin purchase 500 when subscription catalog columns are missing.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 10:33:48 +03:30
mohmdsdgandCursor 6cc10e3333 Fix plugin store public controller param order so nest build succeeds.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 10:24:31 +03:30
mohmdsdg a78636d32e fix super admin 2026-09-10 10:04:55 +03:30
mohmdsdgandCursor bcf4724ac4 fix plugin store remote: find tenant by admin URL and allow purchase
HMAC k.montzar.ir matches the version that uses that admin panel. Remote buy is no longer blocked by plugin_store_enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 22:17:44 +03:30
mohmdsdgandCursor 38337c62d7 test: build HMAC tenant fixtures from domain, drop product URLs
HMAC identity tests should not hardcode gholak/montzar hosts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 22:12:21 +03:30
mohmdsdgandCursor 82e74f86f0 fix remote HMAC: match tenant domain only, not shared adminUrl
k.montzar.ir on Gholaktala adminUrl was selecting tenant app.gholaktala.ir. HMAC now uses primary domain (and its subdomain), not admin/app/node URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 22:07:40 +03:30
mohmdsdgandCursor 3f0dfe448c fix remote HMAC: identify tenant by domain, not shared nodeServer
new.gholaktala.ir is the API host of many versions. Prefer subdomain of the product domain and refuse ambiguous nodeServer ties. 403 names the matched tenant.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 21:53:11 +03:30
mohmdsdg 502b0c8b24 fix pluggin bug 3 2026-09-09 20:57:14 +03:30
mohmdsdg bd12337f6e fix pluggin bug 2 2026-09-09 20:19:01 +03:30
mohmdsdg 08f648457f fix pluggin bug 2026-09-09 17:04:33 +03:30
mohmdsdg 58744d0f91 added some feature for plugin 2026-09-08 18:00:56 +03:30
mohmdsdgandCursor 67a03d9593 feat(plugins): catalog images and purchase receipt uploads
Catalog items can store up to three photos; remote tenants attach a receipt on pending requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:56:09 +03:30
mohmdsdgandCursor 18ac137e25 fix(plugins): seed all SuperAdmin khanegi setting keys into the store catalog
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:00:59 +03:30
mohmdsdgandCursor 94d79c175b fix(plugins): match remote HMAC tenants with the same host rules as get_user
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:50:40 +03:30
mohmdsdgandCursor 2d43ce6c29 Prefer exact tenant domain over shared nodeServer for remote HMAC auth.
Stops demo and shop rows that share one API URL from colliding, and skips phone-like adminUrl values when resolving X-Abshode-Domain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:47:42 +03:30
mohmdsdgandCursor dd212d01ed fix(plugins): resolve remote tenant from admin and app URLs
HMAC only matched tenant.domain, so k.montzar.ir / new.gholaktala.ir missed the row. Also return an empty store when catalog tables are missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:54:03 +03:30
mohmdsdgandCursor a7747366f9 fix(uploads): keep absolute nerkh logo URLs intact
Only resolve relative /uploads/ paths; rewriting legacy hosts to SuperAdmin broke logos that still live on nerkh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 20:10:07 +03:30
mohmdsdgandCursor 0c4f88debf fix(plugins): loosen plugin summary types for partial selects
Allow list/expiring helpers to map rows that omit store columns so nest build passes after prisma generate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 19:57:18 +03:30
mohmdsdgandCursor b3112cf032 fix(plugins): per-tenant plugin store flag and harden broken schema APIs
Store enablement is now a tenant settings row instead of a global runtime switch, and expiring/requests endpoints degrade to empty lists when store tables are missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 19:51:11 +03:30
mohmdsdgandCursor 1f776cf6e2 feat(plugins): sell khanegi plugins as priced subscriptions
Catalog prices, purchase requests, and setting-key activation live on SuperAdmin so module admins can buy add-ons. Also rewrite legacy nerkh logo hosts to the SuperAdmin upload origin.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:56:51 +03:30
mohmdsdgandCursor ccf7e90922 feat: catalog has_landing and landing_* for SuperAdmin
Expose the website landing flag and content keys in the deploy setting template.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-05 17:01:54 +03:30
mohmdsdgandCursor 09218ee1e2 Add enable_gold_credit to SuperAdmin setting catalog.
Default the per-tenant gold credit access flag to false so projects opt in explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-30 00:17:45 +03:30
mohmdsdgandCursor 93202a3c18 fix(tenants): cast Prisma unique error for TS narrowing
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 20:26:16 +03:30
mohmdsdgandCursor cea281bb3d fix(tenants): narrow Prisma unique-error type for strict build
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 20:25:59 +03:30
mohmdsdgandCursor 93a7775887 fix(tenants): remove extra brace breaking nest build
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 20:25:38 +03:30
mohmdsdgandCursor 3034c59319 fix(build): ship jalaali types with production dependencies
Move @types/jalaali-js into dependencies and add a local module declaration so nest build works when installing without devDependencies.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 18:59:38 +03:30
mohmdsdgandCursor edfbdb3469 fix(tenants): clearer duplicate slug/domain errors on create
Pre-check uniqueness and report which field conflicts with which existing version; strip primary domain from aliases.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 18:47:38 +03:30
mohmdsdg ff7e24b2c1 feat(settings): include enamad_logo in deploy setting catalog keys
Allow enamad_logo to sync through the program settings catalog.
2026-08-24 19:39:37 +03:30
mohmdsdgandCursor 83f5834aff feat(settings): add enable_automation SuperAdmin switch (default off)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 16:15:52 +03:30
mohmdsdgandCursor 8f2f27b4a1 feat(get-user): keep custom bottom-nav slot choices across tenants
Merge stored bottom items from the shared catalog so selected menus are not reset to the four defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 12:14:55 +03:30
mohmdsdgandCursor abaacf5a99 fix(get-user): apply shared khanegi nav sample to all tenants
Keep bottom menu at 4 slots so outdated per-tenant JSON cannot overflow the bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 11:42:44 +03:30
mohmdsdgandCursor 065f8af8ed setting pushed
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 10:23:31 +03:30
mohmdsdgandCursor 82d961d984 setting pushed
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-23 22:34:25 +03:30
mohmdsdgandCursor e459b3d862 fix(import): stop re-asking sms_charge and deleted fee alias
Import preview listed sms_charge_* and service_charge_percentage, but
applyImport skipped every out-of-catalog key via isSystemProgramSettingKey,
so "all projects" never persisted and the modal returned every time.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 12:32:27 +03:30
mohmdsdgandCursor c0b6ec9262 fix(settings): include all can_edit=0 keys in SuperAdmin catalog
Parse both INSERT column orders from deploy_settings_const.sql so
price_provider, zaarbox_api_url, main_product and similar keys are
in the template. Keep template values empty for tokens and per-project IDs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 21:47:43 +03:30
mohmdsdgandCursor 19d28f2ed7 chore(settings): resync superadmin template after can_edit=1 runtime keys
Remove can_edit=1 keys (Montzar runtime, fee_service_charge_percentage, etc.)
from setting-templates-from-deploy.json and editable catalog list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 19:55:43 +03:30
mohmdsdgandCursor aa44d244d2 fix(settings): list full can_edit=0 catalog on superadmin get
Merge tenant values with the deploy template catalog so every system
setting (e.g. all montzar_* can_edit=0 keys) appears like khaneghi
advanced settings, not only rows already stored for the tenant.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 18:57:39 +03:30
mohmdsdgandCursor e287f8a54f chore(settings): sync superadmin key lists to controlpanel_user
Extend template sync script to generate frontend allow/deny lists so
ProgramSettingsPage can hide can_edit=1 keys before API purge deploys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 18:49:08 +03:30
mohmdsdgandCursor 71d6f6a534 fix(settings): restrict superadmin template to can_edit=0 keys only
Superadmin was seeding all deploy_settings_const INSERT keys including
can_edit=1 entries with wrong defaults (e.g. montzar_product_id=25).
Template/catalog now follow final can_edit=0 from SQL; editable keys are
purged from setting_templates and tenant settings on boot/seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 18:40:07 +03:30
mohmdsdgandCursor 0b2e4b05f9 fix(settings): skip deploy_settings_const keys in import decision modal
Catalog keys from the SQL template write onto this tenant automatically; only extra keys need a per-key decision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 19:06:32 +03:30
mohmdsdgandCursor 71f1fa1092 feat(settings): import can_edit=0 values from khanegi settings table
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 18:52:31 +03:30
mohmdsdgandCursor c4b814727a fix(replicas): GRANT SELECT on publisher tables to repl_user
settings/setting_templates were created after replica setup, so the
subscription COPY user could not read them and tablesync looped.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 16:01:29 +03:30
mohmdsdgandCursor 810d1672a5 fix(replicas): never REFRESH with copy_data=true after a data copy
A second logical copy unique-conflicts on existing PKs and leaves
tablesync workers stuck, so live UPDATEs never apply on slaves.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 15:45:25 +03:30
mohmdsdgandCursor d055c50b94 fix(replicas): connect publisher via unix socket or postgres user
TCP 127.0.0.1:15432 is often closed; dump/count now fall back to the
cluster socket and runuser -u postgres, which already works on master.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 15:10:06 +03:30
mohmdsdgandCursor 82f63d224e fix(replicas): reach publisher via unix socket or sudo postgres
TCP 127.0.0.1:15432 is often closed; the cluster listens on a unix
socket. Fall back to /var/run/postgresql then runuser -u postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:59:45 +03:30
mohmdsdgandCursor 1cc5e09b5f fix(replicas): parse Prisma DATABASE_URL and dump tables by name
Passwords with @ broke libpq URIs; convert to keyword conninfo.
pg_dump -t public."table" produced empty dumps so replicas stayed at 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:55:39 +03:30
mohmdsdgandCursor 26630cecf6 fix(replicas): use PUBLISHER_DSN when DATABASE_URL breaks pg_dump
Prisma DATABASE_URL passwords with @ confuse libpq URI parsing (host
Montime@127.0.0.1). Repair scripts now prefer explicit PUBLISHER_DSN.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:41:23 +03:30
mohmdsdgandCursor 693b1ef93e fix(replicas): do not flock on manual repair-data
Operator --repair was blocked when pm2 watch owned /tmp lock file.
Only --repair-if-needed uses flock; lock path moved under deploy/.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:39:45 +03:30
mohmdsdgandCursor 16d562caa5 feat(replicas): auto-heal slave data drift and no-store public settings
Add sync-replica-data repair on deploy, a publisher-side replica watch
(60s + after tenant/settings writes), REFRESH PUBLICATION after migrate,
and Cache-Control no-store on program-settings and get_version.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:32:30 +03:30
mohmdsdgandCursor 668bbcc1db fix(program-settings): skip deploy_const keys in Khanegi import preview
Catalog keys are compiled into the API bundle so import no longer depends on an incomplete templates table or missing JSON on the server.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 21:51:48 +03:30
mohmdsdgandCursor 357c4fef59 fix(program-settings): log into Khanegi via /auth/login like the admin panel
Import was posting to /admin/login without provider=user, so no token came back even with valid credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 21:39:45 +03:30
mohmdsdgandCursor d57ce0a3cb feat(settings): store Khanegi keys in settings tables instead of tenant JSON
Template defaults seed from deploy_settings_const; new tenants copy them, import decides per key, and /get_settings reads the per-tenant rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 20:14:17 +03:30
mohmdsdgandCursor 8f9988eb15 feat(program-settings): expose tenant settings APIs and merge PATCH by key
Sold apps can read settings from /get_settings; Super Admin saves only changed keys so huge runtime logs are not sent in the body.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 17:07:46 +03:30
mohmdsdgandCursor 25c0a4e941 fix(api): allow nest build of program-settings and cleaner replica --check
Cast stored JSON through asSettingsArray so tsc accepts the snapshot payload, and strip Prisma ?schema= from DATABASE_URL before psql.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 16:01:55 +03:30
mohmdsdgandCursor f2cf8c9035 feat(tenants): store Khanegi deploy settings snapshot on tenants.setting
Import can_edit=0 settings via the sold version's admin login + get_settings, for Super Admin program-settings UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 15:02:22 +03:30
mohmdsdgandCursor 515e39d420 feat(deploy): sync schema to replication subscribers before migrating
Logical replication carries rows but not DDL, so a migration that adds a
column stalls every subscriber with "missing replicated columns" until the
column exists there too. _prisma_migrations is replicated, so migrate deploy
on a subscriber reports nothing pending while its tables lag behind.

sync-replica-schema.sh applies pending migrations to each subscriber first,
tracking them locally in _replica_ddl_applied, then migrates the publisher.
--check reports subscription state and columns missing on any replica.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 21:34:02 +03:30