test: add invite code validation tests and fix migration rollback

- Add TestInviteCodeSignup integration tests for valid/invalid invite codes
- Fix migration downgrade: avoid dropping trigger dependency
- Add DB CHECK constraint for invite_codes.code format
- Update runtime-route.md with invite_code documentation
- Update runtime-runbook.md with change log
This commit is contained in:
qzl
2026-02-28 10:56:09 +08:00
parent 3d6ae7695f
commit dbd3f68dd4
4 changed files with 103 additions and 3 deletions
+8 -1
View File
@@ -20,7 +20,8 @@
"username": "string (3-30 chars)",
"email": "string (email)",
"password": "string (min 6 chars)",
"redirect_to": "string? (optional)"
"redirect_to": "string? (optional)",
"invite_code": "string? (8 chars, 排除易混淆字符 0/1/I/L/O)"
}
```
@@ -31,6 +32,12 @@
}
```
**邀请码说明:**
- 可选字段,不填则注册不受影响
- 格式:8 位字母数字组合,排除易混淆字符 (0, 1, I, L, O)
- 注册时传入有效邀请码会建立邀请关系并增加邀请码使用次数
- 无效邀请码(不存在/已禁用/已过期/已达上限)不会阻断注册成功
**Errors:**
- 422: 请求参数无效
- 429: 请求过于频繁