refactor: remove unused GET /prompts/command/{command} endpoint (#24782)
The lookup-prompt-by-command endpoint's only frontend wrapper, getPromptByCommand, is dead: nothing imports or calls it, the path is referenced nowhere else, and the route handler has no internal caller (slash-command resolution happens client-side from the loaded prompt list). Removes the route handler, its section header, and the dead wrapper. The shared Prompts.get_prompt_by_command data-layer method is kept: it is still used by create/update prompt validation (prompts.py:175, 275, 340). PromptAccessResponse and AccessGrants are untouched. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
c8f851bd2d
commit
b9911c8bc6
@@ -188,50 +188,6 @@ async def create_new_prompt(
|
||||
)
|
||||
|
||||
|
||||
############################
|
||||
# GetPromptByCommand
|
||||
############################
|
||||
|
||||
|
||||
@router.get('/command/{command}', response_model=PromptAccessResponse | None)
|
||||
async def get_prompt_by_command(
|
||||
command: str, user=Depends(get_verified_user), db: AsyncSession = Depends(get_async_session)
|
||||
):
|
||||
prompt = await Prompts.get_prompt_by_command(command, db=db)
|
||||
|
||||
if prompt:
|
||||
if (
|
||||
user.role == 'admin'
|
||||
or prompt.user_id == user.id
|
||||
or await AccessGrants.has_access(
|
||||
user_id=user.id,
|
||||
resource_type='prompt',
|
||||
resource_id=prompt.id,
|
||||
permission='read',
|
||||
db=db,
|
||||
)
|
||||
):
|
||||
return PromptAccessResponse(
|
||||
**prompt.model_dump(),
|
||||
write_access=(
|
||||
(user.role == 'admin' and BYPASS_ADMIN_ACCESS_CONTROL)
|
||||
or user.id == prompt.user_id
|
||||
or await AccessGrants.has_access(
|
||||
user_id=user.id,
|
||||
resource_type='prompt',
|
||||
resource_id=prompt.id,
|
||||
permission='write',
|
||||
db=db,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=ERROR_MESSAGES.NOT_FOUND,
|
||||
)
|
||||
|
||||
|
||||
############################
|
||||
# GetPromptById
|
||||
############################
|
||||
|
||||
Reference in New Issue
Block a user