نبذة سريعة: هذا المستند يقدّم توثيقًا عمليًا لكل واجهات TenantAccounts (حسابات المستأجر) داخل نظام Genius Link. ستجد فيه وصف المسارات، مخططات المدخلات/المخرجات، أمثلة طلب/استجابة جاهزة، وأخطاء قياسية. المصدر هو ملف tenant_account.openapi.json. يفيد مطوري الـBackend/Frontend وفرق الاختبار والتكامل.الأما ن: في ملف المصدر الحالي security: [](غير مفعّل). في بيئة الإنتاج غالبًا ستستخدم Bearer JWT مع رؤوس:Authorization: Bearer <JWT>.
| المسار | Method | الوصف | الجسم المطلوب | 200 Response |
|---|---|---|---|---|
/TenantAccounts | GET | استرجاع حسابات المستأجر حسب مرشّحات | SelectTenantAccountRequestModel | SelectTenantAccountResult[] |
/TenantAccounts | POST | إنشاء حساب مستأجر | InsertTenantAccountRequestModel | InsertTenantAccountResult |
/TenantAccounts | PUT | تحديث حساب مستأجر | UpdateTenantAccount | UpdateTenantAccountResult |
/TenantAccounts | DELETE | حذف حساب مستأجر (نهائي/حالة حالة) | TenantAccountKey | UpdateTenantAccountStatusResult |
/TenantAccounts/One | GET | استرجاع حساب محدد بالمفتاح | TenantAccountKey | SelectOneTenantAccountResult |
/TenantAccounts/default-tree | POST | إنشاء شجرة الحسابات الافتراضية للمستأجر الحالي | — | CreateDefaultTenantAccountTreeResult[] |
/TenantAccounts/active | PUT | تفعيل حساب مستأجر | TenantAccountKey | UpdateTenantAccountStatusResult |
/TenantAccounts/block | PUT | حظر حساب مستأجر | TenantAccountKey | UpdateTenantAccountStatusResult |
/TenantAccounts/soft | DELETE | حذف ناعم (إخفاء بدون إزالة فعلية) | SoftDeleteTenantAccountRequestModel | SoftDeleteTenantAccountResult |
/TenantAccounts/restore | POST | استعادة حساب تم حذفه حذفًا ناعمًا | RestoreTenantAccountRequestModel | RestoreTenantAccountResult |
ملاحظات عامة: الحقول الزمنية بصيغة ISO‑8601. قيود الطول للأسماء: names.arوnames.enبين 6..50. الحقول المطلوبة مبيّنة أسفل كل مخطط.
/TenantAccounts — استرجاع حسابات المستأجرTenantAccount_GetAccept: application/jsonContent-Type: application/jsonSelectTenantAccountRequestModel (اختياري){
"idSet": [1001, 1002],
"idNotSet": [4, 5],
"idStartWithSet": ["ACC", "CASH"],
"idNotStartWithSet": ["TEMP"],
"upIdSet": [1, 2],
"typeIdSet": [1, 2],
"groupIdSet": [10],
"isMain": true,
"isCredit": false,
"isAutomatic": true,
"relatedUserIdSet": [123],
"text": "cash account",
"status": 20,
"createdAfter": "2024-01-01",
"createdBefore": "2024-12-31",
"updatedAfter": "2024-06-01",
"offset": 0,
"limit": 100,
"requestorDeviceId": "123e4567-e89b-12d3-a456-426614174000",
"serviceId": 1,
"relationshipTypes": "[1, 2, 3]"
}SelectTenantAccountResult[][
{
"id": 1001,
"status": 1,
"description": "حساب النقدية | Cash Account",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-06-10T12:30:00Z"
}
]CustomErrorResponse{
"errorCode": "ERR_VALIDATION",
"category": "validation",
"severity": "error",
"serviceId": 101,
"verbId": "select",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"field\":\"limit\",\"min\":1}",
"message": "قيمة limit يجب أن تكون بين 1 و 1000."
}/TenantAccounts — إنشاء حساب مستأجرTenantAccount_PosttypeId, description.names.Accept: application/jsonContent-Type: application/jsonInsertTenantAccountRequestModel{
"upId": 1000,
"typeId": 1,
"groupId": 10,
"isMain": true,
"description": {
"names": {
"ar": "حساب النقدية",
"en": "Cash Account"
},
"note": "Account for petty cash and on‑hand cash operations"
},
"relatedUserId": 123,
"relationshipTypeId": 2
}InsertTenantAccountResult{
"tenantId": 1,
"id": 1001,
"upId": 1000,
"typeId": 1,
"groupId": 10,
"isMain": true,
"isAutomatic": false,
"relatedUserId": 123,
"description": "حساب النقدية | Cash Account",
"status": 1,
"creatorUserId": 501,
"createdAt": "2024-01-15T10:00:00Z",
"updatorUserId": 501,
"updatedAt": "2024-01-15T10:00:00Z",
"balances": "{}",
"tenantLog": "{}"
}CustomErrorResponse{
"errorCode": "ERR_VALIDATION",
"category": "validation",
"severity": "error",
"serviceId": 101,
"verbId": "create",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"field\":\"description.names.ar\",\"minLength\":6}",
"message": "الاسم العربي يجب ألا يقل عن 6 أحرف."
}/TenantAccounts — تحديث حساب مستأجرTenantAccount_Putid, description.Accept: application/jsonContent-Type: application/jsonUpdateTenantAccount{
"id": 1001,
"groupId": 10,
"description": {
"names": {
"ar": "حساب النقدية الرئيسي",
"en": "Main Cash Account"
},
"note": "Updated note for the cash account"
}
}UpdateTenantAccountResult{
"tenantId": 1,
"id": 1001,
"upId": 1000,
"typeId": 1,
"groupId": 10,
"isMain": true,
"isAutomatic": false,
"relatedUserId": 123,
"description": "حساب النقدية الرئيسي | Main Cash Account",
"status": 1,
"creatorUserId": 501,
"createdAt": "2024-01-15T10:00:00Z",
"updatorUserId": 777,
"updatedAt": "2024-07-01T09:20:00Z",
"balances": "{}"
}CustomErrorResponse{
"errorCode": "ERR_NOT_FOUND",
"category": "business",
"severity": "error",
"serviceId": 101,
"verbId": "update",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"id\":1001}",
"message": "لا يوجد حساب مطابق للتحديث."
}/TenantAccounts — حذف حساب مستأجر (نهائي)TenantAccount_DeleteAccept: application/jsonContent-Type: application/jsonTenantAccountKey{
"id": 1001
}UpdateTenantAccountStatusResult{
"id": 1001,
"status": 1,
"description": "حُذف الحساب",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-07-10T08:00:00Z"
}CustomErrorResponse{
"errorCode": "ERR_CONFLICT",
"category": "business",
"severity": "error",
"serviceId": 101,
"verbId": "delete",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"id\":1001}",
"message": "لا يمكن حذف الحساب لوجود أرصدة/حركات مرتبطة."
}/TenantAccounts/One — استرجاع حساب محدّدTenantAccount_GetAccept: application/jsonContent-Type: application/jsonTenantAccountKey{
"id": 1001
}SelectOneTenantAccountResult{
"rowNo": 1,
"tenantId": 1,
"id": 1001,
"upId": 1000,
"typeId": 1,
"groupId": 10,
"isMain": true,
"isAutomatic": false,
"relatedUserId": 123,
"description": "حساب النقدية | Cash Account",
"status": 1,
"creatorUserId": 501,
"createdAt": "2024-01-15T10:00:00Z",
"updatorUserId": 777,
"updatedAt": "2024-07-01T09:20:00Z"
}CustomErrorResponse{
"errorCode": "ERR_NOT_FOUND",
"category": "business",
"severity": "error",
"serviceId": 101,
"verbId": "select",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"id\":1001}",
"message": "السجل غير موجود."
}/TenantAccounts/default-tree — إنشاء شجرة الحسابات الافتراضيةTenantAccount_CreateDefaultTreeCreateDefaultTenantAccountTreeResult[][
{
"tenantId": 1,
"id": 1100,
"upId": null,
"typeId": 1,
"groupId": 1,
"isMain": true,
"isAutomatic": true,
"relatedUserId": null,
"description": "الأصول",
"status": 1,
"creatorUserId": 501,
"createdAt": "2024-01-01T00:00:00Z",
"updatorUserId": 501,
"updatedAt": "2024-01-01T00:00:00Z"
},
{
"tenantId": 1,
"id": 1200,
"upId": null,
"typeId": 2,
"groupId": 2,
"isMain": true,
"isAutomatic": true,
"relatedUserId": null,
"description": "الخصوم",
"status": 1,
"creatorUserId": 501,
"createdAt": "2024-01-01T00:00:00Z",
"updatorUserId": 501,
"updatedAt": "2024-01-01T00:00:00Z"
}
]CustomErrorResponse{
"errorCode": "ERR_ALREADY_EXISTS",
"category": "business",
"severity": "warning",
"serviceId": 101,
"verbId": "seed",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"tenantId\":1}",
"message": "تم إنشاء شجرة الحسابات مسبقًا."
}/TenantAccounts/active — تفعيل حسابTenantAccount_ActiveTenantAccountKey{
"id": 1001
}UpdateTenantAccountStatusResult{
"id": 1001,
"status": 1,
"description": "تم التفعيل",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-07-10T08:10:00Z"
}/TenantAccounts/block — حظر حسابTenantAccount_BlockTenantAccountKey{
"id": 1001
}UpdateTenantAccountStatusResult{
"id": 1001,
"status": 0,
"description": "تم الحظر",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-07-10T08:15:00Z"
}/TenantAccounts/soft — حذف ناعمTenantAccount_SoftDeleteAccept: application/jsonContent-Type: application/jsonSoftDeleteTenantAccountRequestModel{
"accountId": 1001,
"updatorDeviceId": "123e4567-e89b-12d3-a456-426614174000"
}SoftDeleteTenantAccountResult{
"id": 1001,
"status": 1,
"description": "Soft deleted",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-07-10T08:05:00Z"
}CustomErrorResponse{
"errorCode": "ERR_INVALID_STATE",
"category": "business",
"severity": "error",
"serviceId": 101,
"verbId": "soft_delete",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"accountId\":1001}",
"message": "لا يمكن الحذف الناعم لهذا الحساب في حالته الحالية."
}/TenantAccounts/restore — استعادة حذف ناعمTenantAccount_RestoreAccept: application/jsonContent-Type: application/jsonRestoreTenantAccountRequestModel{
"accountId": 1001,
"updatorDeviceId": "123e4567-e89b-12d3-a456-426614174000"
}RestoreTenantAccountResult{
"id": 1001,
"status": 1,
"description": "Restored",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-07-10T08:20:00Z"
}CustomErrorResponse{
"errorCode": "ERR_NOT_SOFT_DELETED",
"category": "business",
"severity": "error",
"serviceId": 101,
"verbId": "restore",
"tableName": "TenantAccount",
"timestamp": "2025-09-05T18:00:00Z",
"context": "{\"accountId\":1001}",
"message": "لا يمكن الاستعادة لأن الحساب ليس محذوفًا حذفًا ناعمًا."
}names.ar/names.en بين 6..50، وnote حتى 500.offset/limit لتقسيم النتائج، وتأكد أن limit ≤ 1000.Authorization: Bearer <JWT> ويفضل إضافة X-Request-Id للتتبّع.