feat(tahesab): add manual sync to refresh linked customer profiles

Expose sync/customers-now and a settings button so existing linked people get national id, address, city, and rasteh without waiting for the schedule.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-11 18:54:59 +03:30
co-authored by Cursor
parent d23dd20237
commit de77066cb0
4 changed files with 74 additions and 6 deletions
@@ -969,6 +969,7 @@ export class TahesabPersonLinkService {
...(duplicate ? [`${duplicate} شماره تکراری`] : []),
`${failed} خطا`,
].join('، ');
const error = errors.length ? errors.join('؛ ') : null;
await this.prisma.accountingSyncJob.create({
data: {
organizationId,
@@ -978,6 +979,14 @@ export class TahesabPersonLinkService {
result: { imported, updated, duplicate, failed, pages: page - 1 } as Prisma.InputJsonValue,
},
});
await this.prisma.accountingConnection.update({
where: { id: connectionId },
data: {
customerSyncLastRunAt: new Date(),
customerSyncLastSummary: summary,
customerSyncLastError: error,
},
});
this.logger.log(`همگام‌سازی مشتریان ته‌حساب ${connectionId}: ${summary}`);
return {
imported,
@@ -985,7 +994,7 @@ export class TahesabPersonLinkService {
duplicate,
failed,
summary,
error: errors.length ? errors.join('؛ ') : null,
error,
};
}