فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

feat(A03): expose admin chain verification

davoodmehraban89 committed Oct 20, 2026 at 08:37 UTC 82fc1387aece96c52abc52cfdbf2fed20b8d0543
1 file changed +7
src/core/AuditService.js
+7
@@ -96,6 +96,13 @@ class AuditServiceImpl {
96 await tx.add('audit_events', copy);
97 }
98
99 + async verifyChain({ companyId, anchor = null } = {}) {
100 + if (!Auth.isAdmin()) throw new Error('بررسی زنجیره ممیزی فقط برای مدیر مجاز است');
101 + const target = companyId || await DataScope.companyId();
102 + const rows = await StorageService.getAllByIndex('audit_events', 'companyId', target);
103 + return checkAuditChain(rows.sort((a,b) => (a.chainIndex ?? 0) - (b.chainIndex ?? 0)), anchor);
104 + }
105 +
106 async list({ limit = 100 } = {}) {
107 if (!Auth.isAdmin()) throw new Error('مشاهده ردپای حسابرسی فقط برای مدیر مجاز است');
108 if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500) {