Files
tripz-llc/backend-archive/src/common/cron/job-execution.entity.ts
T
Hamza-AyedandClaude Opus 5 fff76c949f chore: أرشفة باك إند NestJS إلى backend-archive
قرار المالك 2026-07-27: الباك إند المعتمد صار باك إند سيرو PHP، ويُنقل
إلى هذا المستودع كنسخة جديدة باسم «انطلق» على api.intaleqapp.com.

backend/ → backend-archive/ (305 ملفاً، إعادة تسمية بلا تعديل محتوى)
+ README-ARCHIVE.md يوضّح سبب الأرشفة وسبب عدم الحذف: scripts/e2e-test.mjs
  هو أدق توثيق سلوكي لدورة الرحلة كاملة، ويبقى مرجعاً عند بناء الوحدات
  الناقصة في باك إند PHP (المحفظتان · الاستحقاقات · محرّك التسعير · الوحدات).

مسارات backend/ في docs/*.md لم تُعدَّل عمداً — سجلّ تاريخي.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 04:54:35 +03:00

59 lines
1.8 KiB
TypeScript

import {
Column,
CreateDateColumn,
Entity,
Index,
PrimaryGeneratedColumn,
} from 'typeorm';
/**
* سجل تنفيذ المهام الدورية (O5).
*
* الجدول: `tripz_job_executions`.
*
* كل صف = تنفيذ واحد لأي مهمة كانت (sweeper, bot, report...).
* الهدف: إظهار آخر نجاح/فشل لكل مهمة + مدة التنفيذ + سبب الفشل.
* لا مهمة صامتة — كل تنفيذ يُسجَّل هنا.
*/
@Entity('job_executions')
@Index(['job_name', 'started_at'])
export class JobExecution {
@PrimaryGeneratedColumn('uuid')
id: string;
/** اسم المهمة (cron:scheduled_trips_sweep, cron:surge_recalculate...). */
@Column()
job_name: string;
/** حالة التنفيذ. */
@Column({ type: 'varchar', length: 20 })
status: 'running' | 'success' | 'failed' | 'timeout';
/** لحظة بدء التنفيذ الفعلي (لا وقت إضاف الطور). */
@Column({ type: 'timestamptz' })
started_at: Date;
/** لحظة انتهاء التنفيذ. */
@Column({ type: 'timestamptz', nullable: true })
finished_at: Date | null;
/** مدة التنفيذ بالميلي ثانية. */
@Column({ type: 'int', nullable: true })
duration_ms: number;
/** عدد العناصر التي عالجتها المهمة (مثلاً: عدد الرحلات التي انتهت). */
@Column({ type: 'int', default: 0 })
items_processed: number;
/** رسالة خطأ (فقط عند الفشل). */
@Column({ type: 'text', nullable: true })
error_message: string | null;
/** معرّف المستأجر (إن كانت المهمة خاصة بمستأجر). */
@Column({ type: 'uuid', nullable: true })
tenant_id: string | null;
@CreateDateColumn()
created_at: Date;
}