docs(reference): import Dune: Awakening server-manager references
Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.
- icehunter/ dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
closest analog to our agent's Dune docker control plane (compose
lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/ Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
Hyper-V self-host path + game-config schema
See docs/reference-repos/README.md for the full index + how we use each.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
-- taxation_emit_invoices(new_tax_invoices dune.taxinvoicedata[]) -> void
|
||||
-- oid: 58602 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_emit_invoices(new_tax_invoices dune.taxinvoicedata[])
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
invoice_ids BIGINT[];
|
||||
new_invoice_id BIGINT;
|
||||
new_tax_invoice TaxInvoiceData;
|
||||
BEGIN
|
||||
IF array_length(new_tax_invoices, 1) > 0 THEN
|
||||
FOREACH new_tax_invoice IN ARRAY new_tax_invoices LOOP
|
||||
|
||||
INSERT INTO tax_invoice("totem_id", "reference_timespan", "invoice_status", "amount")
|
||||
VALUES(new_tax_invoice.totem_id, new_tax_invoice.reference_timespan, new_tax_invoice.invoice_status, new_tax_invoice.amount) RETURNING id INTO new_invoice_id;
|
||||
|
||||
invoice_ids := array_append(invoice_ids, new_invoice_id);
|
||||
END LOOP;
|
||||
|
||||
PERFORM pg_notify('taxation_notify_channel', format('emit_invoices|{"InvoiceIds" : %s, "InvoiceData" : %s}', to_json(invoice_ids)::text, to_json(new_tax_invoices)::text));
|
||||
END IF;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,16 @@
|
||||
-- taxation_get_all_invoices_for_player(in_player_id bigint) -> TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
-- oid: 58603 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_get_all_invoices_for_player(in_player_id bigint)
|
||||
RETURNS TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
RETURN QUERY SELECT tax_invoice.id, tax_invoice.totem_id, tax_invoice.reference_timespan, tax_invoice.invoice_status, tax_invoice.amount, permission_actor.actor_name
|
||||
FROM tax_invoice
|
||||
JOIN permission_actor ON permission_actor.actor_id = tax_invoice.totem_id
|
||||
JOIN permission_actor_rank ON permission_actor.actor_id = permission_actor_rank.permission_actor_id
|
||||
WHERE permission_actor_rank.player_id = in_player_id
|
||||
ORDER BY tax_invoice.reference_timespan;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,18 @@
|
||||
-- taxation_get_all_invoices_for_server(map_name text, in_dimension_index integer, in_partition_id bigint) -> TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
-- oid: 58604 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_get_all_invoices_for_server(map_name text, in_dimension_index integer, in_partition_id bigint)
|
||||
RETURNS TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
RETURN QUERY SELECT tax_invoice.id, actors.id, tax_invoice.reference_timespan, tax_invoice.invoice_status, tax_invoice.amount, permission_actor.actor_name
|
||||
FROM tax_invoice
|
||||
JOIN permission_actor ON permission_actor.actor_id = tax_invoice.totem_id
|
||||
JOIN actors ON actors.id = tax_invoice.totem_id
|
||||
WHERE actors.map = map_name
|
||||
AND actors.dimension_index = in_dimension_index
|
||||
AND ((in_partition_id = 0 AND actors.partition_id IS NULL) OR actors.partition_id = in_partition_id)
|
||||
ORDER BY tax_invoice.reference_timespan;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,16 @@
|
||||
-- taxation_get_all_invoices_for_totem(in_totem_id bigint) -> TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
-- oid: 58605 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_get_all_invoices_for_totem(in_totem_id bigint)
|
||||
RETURNS TABLE(id bigint, totem_id bigint, reference_timestamp bigint, invoice_status smallint, amount integer, actor_name text)
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
RETURN QUERY SELECT tax_invoice.id, actors.id, tax_invoice.reference_timespan, tax_invoice.invoice_status, tax_invoice.amount, permission_actor.actor_name
|
||||
FROM tax_invoice
|
||||
JOIN permission_actor ON permission_actor.actor_id = tax_invoice.totem_id
|
||||
JOIN actors ON actors.id = tax_invoice.totem_id
|
||||
WHERE actors.id = in_totem_id
|
||||
ORDER BY tax_invoice.reference_timespan;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,17 @@
|
||||
-- taxation_pay_invoice(invoice_id bigint, paid_invoice_status smallint) -> bigint
|
||||
-- oid: 58606 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_pay_invoice(invoice_id bigint, paid_invoice_status smallint)
|
||||
RETURNS bigint
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
found_invoice_id BIGINT;
|
||||
BEGIN
|
||||
UPDATE tax_invoice SET invoice_status = paid_invoice_status WHERE tax_invoice.id = invoice_id AND tax_invoice.invoice_status != paid_invoice_status RETURNING id INTO found_invoice_id;
|
||||
if found_invoice_id IS NOT NULL THEN
|
||||
PERFORM pg_notify('taxation_notify_channel', format('pay_invoice|{"InvoiceId" : %s }', invoice_id));
|
||||
END IF;
|
||||
RETURN found_invoice_id;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,12 @@
|
||||
-- taxation_remove_invoices(invoices_to_remove bigint[]) -> void
|
||||
-- oid: 58607 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_remove_invoices(invoices_to_remove bigint[])
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
DELETE FROM tax_invoice WHERE id = ANY(invoices_to_remove);
|
||||
PERFORM pg_notify('taxation_notify_channel', format('remove_invoice|{"InvoiceIds" : %s}', to_json(invoices_to_remove)::text));
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,16 @@
|
||||
-- taxation_remove_invoices_from_totem(totem_actor_id bigint) -> void
|
||||
-- oid: 58608 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_remove_invoices_from_totem(totem_actor_id bigint)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
invoice_ids BIGINT[];
|
||||
BEGIN
|
||||
SELECT array_agg(id) from tax_invoice into invoice_ids WHERE totem_id = totem_actor_id;
|
||||
|
||||
DELETE FROM tax_invoice WHERE totem_id = totem_actor_id;
|
||||
PERFORM pg_notify('taxation_notify_channel', format('remove_invoice|{"InvoiceIds" : %s}', to_json(invoice_ids)::text));
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,19 @@
|
||||
-- taxation_update_invoice_status(invoices_to_overdue bigint[], invoices_to_defaulted bigint[], overdue_invoice_status smallint, defaulted_invoice_status smallint) -> void
|
||||
-- oid: 58609 kind: FUNCTION category: taxation
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.taxation_update_invoice_status(invoices_to_overdue bigint[], invoices_to_defaulted bigint[], overdue_invoice_status smallint, defaulted_invoice_status smallint)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
IF array_length(invoices_to_overdue, 1) > 0 THEN
|
||||
UPDATE tax_invoice SET invoice_status = overdue_invoice_status WHERE id = ANY(invoices_to_overdue);
|
||||
PERFORM pg_notify('taxation_notify_channel', format('update_invoice_status|{"InvoiceStatus" : %s, "InvoiceIds" : %s}', overdue_invoice_status, to_json(invoices_to_overdue)::text));
|
||||
END IF;
|
||||
|
||||
IF array_length(invoices_to_defaulted, 1) > 0 THEN
|
||||
UPDATE tax_invoice SET invoice_status = defaulted_invoice_status WHERE id = ANY(invoices_to_defaulted);
|
||||
PERFORM pg_notify('taxation_notify_channel', format('update_invoice_status|{"InvoiceStatus" : %s, "InvoiceIds" : %s}', defaulted_invoice_status, to_json(invoices_to_defaulted)::text));
|
||||
END IF;
|
||||
END
|
||||
$function$
|
||||
Reference in New Issue
Block a user