SQL-Ledger REST API: get ‘/gl/transactions

The next route we work on is get ‘/gl/transactions’. This is will be different from ‘gl/transactionslines/’, since this will be filtering out data and only returning transactions made directly through the General Ledger module. We will also be making use of the ‘header’ data that each transaction has, which comes from the ‘gl’ table.

ledger28=# \d gl;
Table "public.gl"
Column | Type | Collation | Nullable | Default
---------------+-----------------------------+-----------+----------+-------------------------
id | integer | | | nextval('id'::regclass)


reference | text | | |
description | text | | |
transdate | date | | | 'now'::text::date
employee_id | integer | | |
notes | text | | |
department_id | integer | | | 0
approved | boolean | | | true
curr | character(3) | | |
exchangerate | double precision | | |
ticket_id | integer | | |
ts | timestamp without time zone | | | now()
onhold | boolean | | |
Indexes:
"gl_description_key" btree (lower(description))
"gl_employee_id_key" btree (employee_id)
"gl_id_key" btree (id)
"gl_reference_key" btree (reference)
"gl_transdate_key" btree (transdate)

ID: Primary Key for the table
reference: Reference Number assigned for the transaction. Can be autogenerated (according to the next number in defaults) or assigned manually. Passed to acc_trans lines
description: Description entered by the user
transdate: Date for the transaction (entered by the user, default is now)
employee_id: ID for the employee making the request
notes: Note for the transaction
department_id: Department ID if there's a department associated.
approved: Boolean for if the transaction is approved or not.
curr: Curr for the transaction
exchangerate: exchange rate assigned if the transaction is a foreign exchange transaction.
ts: Timestamp for when the transaction is created
onhold: Boolean to manage on hold.

Route Code

Copyright © Hashim Saqib. All rights reserved.