Skip to content

Commit 297d1ce

Browse files
committed
feat(db): add banned column to user table for blocking users
- Add banned boolean column to user schema (default false) - Update getUserInfoFromApiKey to support banned field - Refactor chat completions to check banned from DB instead of hardcoded list - Update type definitions and test fixtures
1 parent ad2bbe4 commit 297d1ce

File tree

13 files changed

+2648
-17
lines changed

13 files changed

+2648
-17
lines changed

common/src/testing/fixtures/agent-runtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const TEST_AGENT_RUNTIME_IMPL = Object.freeze<
6161
email: 'test-email',
6262
discord_id: 'test-discord-id',
6363
referral_code: 'ref-test-code',
64+
banned: false,
6465
}),
6566
fetchAgentFromDatabase: async () => null,
6667
startAgentRun: async () => 'test-agent-run-id',

common/src/types/contracts/database.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ type User = {
66
email: string
77
discord_id: string | null
88
referral_code: string | null
9+
banned: boolean
910
}
10-
export const userColumns = ['id', 'email', 'discord_id', 'referral_code'] as const
11+
export const userColumns = ['id', 'email', 'discord_id', 'referral_code', 'banned'] as const
1112
export type UserColumn = keyof User
1213
export type GetUserInfoFromApiKeyInput<T extends UserColumn> = {
1314
apiKey: string

evals/impl/agent-runtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const EVALS_AGENT_RUNTIME_IMPL = Object.freeze<AgentRuntimeDeps>({
3737
email: 'test-email',
3838
discord_id: 'test-discord-id',
3939
referral_code: 'ref-test-code',
40+
banned: false,
4041
}),
4142
fetchAgentFromDatabase: async () => null,
4243
startAgentRun: async () => 'test-agent-run-id',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "user" ADD COLUMN "banned" boolean DEFAULT false NOT NULL;

0 commit comments

Comments
 (0)