Skip to content

Commit 8f1ad57

Browse files
committed
move get impl out of impl directory
1 parent ec4d21d commit 8f1ad57

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

web/src/app/api/v1/me/impl/__tests__/route.test.ts renamed to web/src/app/api/v1/me/__tests__/route.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TEST_AGENT_RUNTIME_IMPL } from '@codebuff/common/testing/impl/agent-run
22
import { describe, test, expect, beforeEach } from 'bun:test'
33
import { NextRequest } from 'next/server'
44

5-
import { meGet } from '../_get'
5+
import { getMe } from '../_get'
66

77
import type { AgentRuntimeDeps } from '@codebuff/common/types/contracts/agent-runtime'
88
import type { GetUserInfoFromApiKeyOutput } from '@codebuff/common/types/contracts/database'
@@ -49,7 +49,7 @@ describe('/api/v1/me route', () => {
4949
describe('Authentication', () => {
5050
test('returns 401 when Authorization header is missing', async () => {
5151
const req = new NextRequest('http://localhost:3000/api/v1/me')
52-
const response = await meGet({
52+
const response = await getMe({
5353
...agentRuntimeImpl,
5454
req,
5555
})
@@ -63,7 +63,7 @@ describe('/api/v1/me route', () => {
6363
const req = new NextRequest('http://localhost:3000/api/v1/me', {
6464
headers: { Authorization: 'InvalidFormat' },
6565
})
66-
const response = await meGet({
66+
const response = await getMe({
6767
...agentRuntimeImpl,
6868
req,
6969
})
@@ -79,7 +79,7 @@ describe('/api/v1/me route', () => {
7979
headers: { 'x-codebuff-api-key': apiKey },
8080
})
8181

82-
const response = await meGet({
82+
const response = await getMe({
8383
...agentRuntimeImpl,
8484
req,
8585
})
@@ -94,7 +94,7 @@ describe('/api/v1/me route', () => {
9494
headers: { Authorization: `Bearer ${apiKey}` },
9595
})
9696

97-
const response = await meGet({
97+
const response = await getMe({
9898
...agentRuntimeImpl,
9999
req,
100100
})
@@ -108,7 +108,7 @@ describe('/api/v1/me route', () => {
108108
headers: { Authorization: 'Bearer invalid-key' },
109109
})
110110

111-
const response = await meGet({
111+
const response = await getMe({
112112
...agentRuntimeImpl,
113113
req,
114114
})
@@ -124,7 +124,7 @@ describe('/api/v1/me route', () => {
124124
headers: { Authorization: 'Bearer test-api-key-123' },
125125
})
126126

127-
const response = await meGet({
127+
const response = await getMe({
128128
...agentRuntimeImpl,
129129
req,
130130
})
@@ -141,7 +141,7 @@ describe('/api/v1/me route', () => {
141141
},
142142
)
143143

144-
const response = await meGet({
144+
const response = await getMe({
145145
...agentRuntimeImpl,
146146
req,
147147
})
@@ -158,7 +158,7 @@ describe('/api/v1/me route', () => {
158158
},
159159
)
160160

161-
const response = await meGet({
161+
const response = await getMe({
162162
...agentRuntimeImpl,
163163
req,
164164
})
@@ -179,7 +179,7 @@ describe('/api/v1/me route', () => {
179179
},
180180
)
181181

182-
const response = await meGet({
182+
const response = await getMe({
183183
...agentRuntimeImpl,
184184
req,
185185
})
@@ -200,7 +200,7 @@ describe('/api/v1/me route', () => {
200200
},
201201
)
202202

203-
const response = await meGet({
203+
const response = await getMe({
204204
...agentRuntimeImpl,
205205
req,
206206
})
@@ -220,7 +220,7 @@ describe('/api/v1/me route', () => {
220220
},
221221
)
222222

223-
const response = await meGet({
223+
const response = await getMe({
224224
...agentRuntimeImpl,
225225
req,
226226
})
@@ -237,7 +237,7 @@ describe('/api/v1/me route', () => {
237237
},
238238
)
239239

240-
const response = await meGet({
240+
const response = await getMe({
241241
...agentRuntimeImpl,
242242
req,
243243
})
@@ -251,7 +251,7 @@ describe('/api/v1/me route', () => {
251251
headers: { Authorization: 'Bearer test-api-key-123' },
252252
})
253253

254-
const response = await meGet({
254+
const response = await getMe({
255255
...agentRuntimeImpl,
256256
req,
257257
})
@@ -268,7 +268,7 @@ describe('/api/v1/me route', () => {
268268
},
269269
)
270270

271-
const response = await meGet({
271+
const response = await getMe({
272272
...agentRuntimeImpl,
273273
req,
274274
})
@@ -285,7 +285,7 @@ describe('/api/v1/me route', () => {
285285
},
286286
)
287287

288-
const response = await meGet({
288+
const response = await getMe({
289289
...agentRuntimeImpl,
290290
req,
291291
})
@@ -306,7 +306,7 @@ describe('/api/v1/me route', () => {
306306
},
307307
)
308308

309-
const response = await meGet({
309+
const response = await getMe({
310310
...agentRuntimeImpl,
311311
req,
312312
})
@@ -322,7 +322,7 @@ describe('/api/v1/me route', () => {
322322
headers: { Authorization: 'Bearer test-api-key-123' },
323323
})
324324

325-
const response = await meGet({
325+
const response = await getMe({
326326
...agentRuntimeImpl,
327327
req,
328328
})
@@ -339,7 +339,7 @@ describe('/api/v1/me route', () => {
339339
},
340340
)
341341

342-
const response = await meGet({
342+
const response = await getMe({
343343
...agentRuntimeImpl,
344344
req,
345345
})
@@ -354,7 +354,7 @@ describe('/api/v1/me route', () => {
354354
},
355355
)
356356

357-
const response = await meGet({
357+
const response = await getMe({
358358
...agentRuntimeImpl,
359359
req,
360360
})

web/src/app/api/v1/me/impl/_get.ts renamed to web/src/app/api/v1/me/_get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { extractApiKeyFromHeader } from '@/util/auth'
1111

1212
type ValidField = (typeof VALID_USER_INFO_FIELDS)[number]
1313

14-
export async function meGet(params: {
14+
export async function getMe(params: {
1515
req: NextRequest
1616
getUserInfoFromApiKey: GetUserInfoFromApiKeyFn
1717
logger: Logger

web/src/app/api/v1/me/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { trackEvent } from '@codebuff/common/analytics'
22

3-
import { meGet } from './impl/_get'
3+
import { getMe } from './_get'
44

55
import type { NextRequest } from 'next/server'
66

77
import { getUserInfoFromApiKey } from '@/db/user'
88
import { logger } from '@/util/logger'
99

1010
export async function GET(req: NextRequest) {
11-
return meGet({ req, getUserInfoFromApiKey, logger, trackEvent })
11+
return getMe({ req, getUserInfoFromApiKey, logger, trackEvent })
1212
}

0 commit comments

Comments
 (0)