Skip to content

Add double-entry resources: chart-of-accounts (read) + journal-entry (CRUD) #5

Description

@AsyncAlchemist

Summary

The Akaunting Double-Entry module (v4.2.11) is now installed on our instance and exposes a REST API that akt doesn't wrap yet. Add first-class resources so the CLI can drive the general ledger (read the chart of accounts, post/read journal entries). This unblocks materializing a real chart of accounts and importing transactions as balanced journal entries from the CLI instead of akt raw.

Endpoints observed

From modules/DoubleEntry/Routes/api.php:

Route::apiResource('journal-entry', 'JournalEntry');                 // full CRUD
Route::apiResource('chart-of-accounts', 'ChartOfAccount')->only(['index', 'show']); // READ ONLY

Both verified live: GET /api/chart-of-accounts and GET /api/journal-entry return data (200).

Requested resources

1. chart-of-accounts (read: list, show)

Account fields (from the API + Http/Requests/Account.php):

  • id, type_id (int), code (int, unique per company), name (string), description, account_id (parent, nullable), enabled (bool)

2. journal-entry (full CRUD: list, show, create, update, delete)

POST/PUT body (from Http/Requests/Journal.php):

  • paid_at (date, required), description (required), journal_number (required), basis (required — cash|accrual), reference (nullable), currency_code (required), currency_rate (required, >0)
  • items[] — required array, min 2, each { account_id (int), debit (amount), credit (amount) }; must balance (debits == credits)
  • attachment (optional)

Known limitation to capture

The module's API exposes chart-of-accounts as read-only (->only(['index','show'])) — there is no API route to create/update/delete accounts (only the web CRUD double-entry.chart-of-accounts.store|update|destroy behind session/CSRF). So a CLI chart-of-accounts create can't hit a JSON API today.

Please advise on the intended path for programmatic account creation — options:

  1. akt drives the web CRUD route (form POST w/ session + CSRF), or
  2. upstream request to widen the module's apiResource to include store/update/destroy, or
  3. direct DB insert (least preferred).

Meanwhile journal-entry (full CRUD) + chart-of-accounts (read) are straightforward API wraps and would deliver most of the value.

Context

Driving a live Akaunting double-entry GL for accounting.marketdata.app; building the chart of accounts as code (see our tools/coa.toml) and importing PayPro/vendor/payroll history as journal entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions