Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0f63789
create Account create/1 function and compare it with existing create/…
jeryldev Dec 2, 2023
84de9af
optimize create/1 and add typedocs
jeryldev Dec 3, 2023
b0b3a64
add validate account benchmark
jeryldev Dec 3, 2023
0b2cb23
optimize account validate/1
jeryldev Dec 3, 2023
31beba0
create a sample self restoring ets
jeryldev Dec 4, 2023
539858c
rename the type to classification
jeryldev Dec 4, 2023
32b6b98
create coa server 2 with benchmark
jeryldev Dec 4, 2023
19797f9
add benchmark when importing a file
jeryldev Dec 4, 2023
cc4e258
recreate chart of accounts boundary using GenServer ETS solution
jeryldev Dec 4, 2023
0b9060b
remove server2
jeryldev Dec 4, 2023
aa0ce25
replace the Account update/2 based on the benchmark
jeryldev Dec 5, 2023
e728cd5
add benchmarks for worker update
jeryldev Dec 5, 2023
e1fe164
updated the benchmarks, move the classify function within the classif…
jeryldev Dec 6, 2023
3a5a7f6
arrange account tests
jeryldev Dec 6, 2023
d198f0c
updated the csv files
jeryldev Dec 8, 2023
ce1bd38
fix the chart of accounts v2 and write tests
jeryldev Dec 8, 2023
dd035da
rework the chart of account and its tests
jeryldev Dec 9, 2023
21eedb2
rename line account description
jeryldev Dec 9, 2023
aac226f
update the chart of accounts worker and its test
jeryldev Dec 20, 2023
79f76f6
fix account and its test
jeryldev Dec 20, 2023
fab6767
add tests to chart of accounts
jeryldev Dec 21, 2023
8fad1ef
rename the account type to classification
jeryldev Dec 21, 2023
c968a00
update the bookkeeping and its tests
jeryldev Dec 21, 2023
4b96ee1
rework the audit_log core
jeryldev Dec 21, 2023
1ac66f6
rework line_item core and rename validate_create_params to validate_p…
jeryldev Dec 21, 2023
4d58a35
rename attributes
jeryldev Dec 21, 2023
b3cb99d
remove bookkeeping journal entry
jeryldev Dec 21, 2023
ea33fda
remove uuid dependency
jeryldev Dec 21, 2023
fa8272a
updated the account core and its test
jeryldev Dec 22, 2023
d5c7dae
rework on line item and audit log
jeryldev Dec 22, 2023
3eca4ee
fix the issues on the chart of accounts
jeryldev Dec 24, 2023
d8ec1b0
updated the line item and journal entry features
jeryldev Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
595 changes: 327 additions & 268 deletions lib/bookkeeping.ex

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/bookkeeping/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ defmodule Bookkeeping.Application do

use Application

alias Bookkeeping.Boundary.AccountingJournal.Supervisor, as: AccountingJournalSupervisor
# alias Bookkeeping.Boundary.AccountingJournal.Supervisor, as: AccountingJournalSupervisor
alias Bookkeeping.Boundary.ChartOfAccounts.Supervisor, as: ChartOfAccountsSupervisor

@impl true
def start(_type, _args) do
children = [
# Starts a worker by calling: Bookkeeping.Worker.start_link(arg)
# {Bookkeeping.Worker, arg}
{ChartOfAccountsSupervisor, [name: ChartOfAccountsSupervisor]},
{AccountingJournalSupervisor, [name: AccountingJournalSupervisor]}
{ChartOfAccountsSupervisor, [name: ChartOfAccountsSupervisor]}
# {AccountingJournalSupervisor, [name: AccountingJournalSupervisor]}
]

# See https://hexdocs.pm/elixir/Supervisor.html
Expand Down
1,698 changes: 849 additions & 849 deletions lib/bookkeeping/boundary/accounting_journal/server.ex

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions lib/bookkeeping/boundary/chart_of_accounts/backup.ex

This file was deleted.

70 changes: 70 additions & 0 deletions lib/bookkeeping/boundary/chart_of_accounts/manager.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
defmodule Bookkeeping.Boundary.ChartOfAccounts.Manager do
use GenServer

alias Bookkeeping.Boundary.ChartOfAccounts.Worker

@spec start_link(any()) :: :ignore | {:error, any()} | {:ok, any()}
def start_link(_) do
case GenServer.start_link(__MODULE__, :ok, name: __MODULE__) do
{:ok, pid} -> {:ok, pid}
{:error, {:already_started, pid}} -> {:ok, pid}
error -> error
end
end

@spec init(any()) :: {:ok, atom() | :ets.tid()}
@impl true
def init(_) do
Process.flag(:trap_exit, true)
setup_table()
end

@impl true
def handle_info({:EXIT, _from, _reason}, table) do
{:noreply, table}
end

@impl true
def handle_info({:"ETS-TRANSFER", table, _pid, data}, _table) do
worker = wait_for_worker()
Process.link(worker)
:ets.give_away(table, worker, data)
{:noreply, table}
end

defp wait_for_worker do
case Process.whereis(Worker) do
nil ->
Process.sleep(1)
wait_for_worker()

pid ->
pid
end
end

defp setup_table do
case Process.whereis(Worker) do
nil ->
Process.sleep(1)
setup_table()

worker ->
Process.link(worker)

table =
:ets.new(:chart_of_accounts, [
:ordered_set,
:private,
write_concurrency: true,
read_concurrency: true
])

data = {:count, 0}
:ets.insert(table, data)
:ets.setopts(table, {:heir, self(), data})
:ets.give_away(table, worker, data)
{:ok, table}
end
end
end
Loading