add: some user api and all api desc

This commit is contained in:
wwweww
2026-02-27 19:17:01 +08:00
parent a0c720eb2f
commit 5930fb0dde
156 changed files with 9457 additions and 1086 deletions
+21
View File
@@ -0,0 +1,21 @@
CREATE TABLE shop_players
(
shop_id BIGINT NOT NULL REFERENCES shops (id),
player_id BIGINT NOT NULL,
-- [新增] 标记是否为主店铺。用于个人主页展示和 players.shop_id 缓存源
is_primary BOOLEAN DEFAULT FALSE,
joined_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
left_at TIMESTAMPTZ, -- 软删除,表示已离职
PRIMARY KEY (shop_id, player_id)
);
-- 索引
CREATE INDEX idx_shop_players_player ON shop_players (player_id) WHERE left_at IS NULL;
CREATE INDEX idx_shop_players_shop_active ON shop_players (shop_id, joined_at DESC) WHERE left_at IS NULL;
-- [新增] 唯一索引:确保一个打手同一时间只能有一个主店铺
CREATE UNIQUE INDEX idx_shop_players_one_primary
ON shop_players (player_id) WHERE is_primary = TRUE AND left_at IS NULL;