Skip to content

Commit 25d4d0b

Browse files
committed
address comments
1 parent cd9989a commit 25d4d0b

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

apps/sim/app/api/admin/mothership/route.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ export const POST = withRouteHandler(async (req: NextRequest) => {
6767
if (!queryValidation.success) return queryValidation.response
6868
const { env: environment, endpoint } = queryValidation.data
6969

70-
if (!endpoint) {
71-
return NextResponse.json({ error: 'endpoint query param required' }, { status: 400 })
72-
}
73-
7470
if (!isValidEndpoint(endpoint)) {
7571
return NextResponse.json({ error: 'invalid endpoint' }, { status: 400 })
7672
}
@@ -126,10 +122,6 @@ export const GET = withRouteHandler(async (req: NextRequest) => {
126122
if (!queryValidation.success) return queryValidation.response
127123
const { env: environment, endpoint } = queryValidation.data
128124

129-
if (!endpoint) {
130-
return NextResponse.json({ error: 'endpoint query param required' }, { status: 400 })
131-
}
132-
133125
if (!isValidEndpoint(endpoint)) {
134126
return NextResponse.json({ error: 'invalid endpoint' }, { status: 400 })
135127
}

apps/sim/app/api/auth/trello/authorize/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ const logger = createLogger('TrelloAuthorize')
1313
export const dynamic = 'force-dynamic'
1414

1515
export const GET = withRouteHandler(async (request: NextRequest) => {
16-
const parsed = await parseRequest(authorizeTrelloContract, request, {})
17-
if (!parsed.success) return parsed.response
18-
1916
try {
2017
const session = await getSession()
2118
if (!session?.user?.id) {
2219
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
2320
}
2421

22+
const parsed = await parseRequest(authorizeTrelloContract, request, {})
23+
if (!parsed.success) return parsed.response
24+
2525
const apiKey = env.TRELLO_API_KEY
2626

2727
if (!apiKey) {

apps/sim/lib/api/contracts/mothership-tasks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const adminMothershipQuerySchema = z
108108
(value) => (value === '' || value === undefined ? 'dev' : value),
109109
z.string().min(1).default('dev')
110110
),
111-
endpoint: z.preprocess((value) => (value === '' ? undefined : value), z.string().optional()),
111+
endpoint: z.string().min(1, 'endpoint query param required'),
112112
})
113113
.passthrough()
114114
export type AdminMothershipQuery = z.output<typeof adminMothershipQuerySchema>

0 commit comments

Comments
 (0)