Skip to main content
#P1628

DELETE /v2/redis-accounting/delete-document

Delete Document

این اندپوینت یک سند حسابداری را از هسته Redis حذف می‌کند. عملیات شامل حذف Hash سند، حذف شناسه از تمامی ایندکس‌ها، و پاک‌سازی کامل کلیدهای بالانس مرتبط با گروه/کل/معین/تفضیلی است. توجه: در منطق فعلی سیستم، بالانس‌ها recalculate نمی‌شوند و به‌جای آن حذف کامل می‌گردند.

Request Overview

URL: /v2/redis-accounting/delete-document
Method: DELETE
Auth: Bearer Token (Required)
Content-Type: application/json

Request Body Schema

Field Type Required Description
id integer yes شناسه سندی که باید حذف شود

Request Example

{
  "id": 934221
}
  

Response (Success)

Field Type Description
success boolean وضعیت نهایی حذف سند
message string پیام موفقیت‌آمیز
{
  "success": true,
  "message": "سند با موفقیت حذف شد"
}
  

Response (Validation Error)

{
  "success": false,
  "message": "خطا در اعتبارسنجی",
  "errors": {
    "id": [
      "The id field is required."
    ]
  }
}
  

Response (Server Error)

{
  "success": false,
  "message": "خطا در حذف سند: Internal server error message..."
}
  

Internal Redis Architecture

Key Type Description
accounting:doc:{id} Hash سند ذخیره‌شده که باید حذف شود
accounting:docs:by_date SortedSet حذف شناسه از ایندکس تاریخ میلادی
accounting:docs:by_jalali_date SortedSet حذف شناسه از ایندکس تاریخ شمسی
accounting:docs:group:{groupId} Set ایندکس سطح گروه — حذف شناسه
accounting:docs:general:{generalId} Set ایندکس سطح کل — حذف شناسه
accounting:docs:account:{accountId} Set ایندکس سطح معین — حذف شناسه
accounting:docs:subsidiary:{subsidiaryId} Set ایندکس سطح تفضیلی — حذف شناسه
balance:group:{groupId} Hash حذف کامل مانده سطح گروه
balance:general:{generalId} Hash حذف کامل مانده سطح کل
balance:account:{accountId} Hash حذف کامل مانده سطح معین
balance:subsidiary:{subsidiaryId} Hash حذف کامل مانده سطح تفضیلی

Process Flow

Receive Request
Validate Input (id Required)