Initial affiliate codes implementation (#4382)

* Initial affiliate codes implementation

* some more docs to codes

* sqlx prepare

* Address PR comments

* Address more PR comments

* fix clippy

* Switch to using Json<T> for type-safe responses
This commit is contained in:
aecsocket
2025-09-18 16:43:34 +01:00
committed by GitHub
parent 6da190ed01
commit 4def0e8407
15 changed files with 607 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
CREATE TABLE affiliate_codes (
id bigint PRIMARY KEY,
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by bigint NOT NULL REFERENCES users(id),
affiliate bigint NOT NULL REFERENCES users(id),
-- left nullable so we can explicitly set payouts if we need to,
-- and use a global default if unset
revenue_split float
);