MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / UpdatePrompt

Method UpdatePrompt

internal/api/user/update_prompt.go:13–45  ·  view source on GitHub ↗
(
	ctx context.Context,
	req *userv1.UpdatePromptRequest,
)

Source from the content-addressed store, hash-verified

11)
12
13func (s *UserServer) UpdatePrompt(
14 ctx context.Context,
15 req *userv1.UpdatePromptRequest,
16) (*userv1.UpdatePromptResponse, error) {
17 actor, err := contextutil.GetActor(ctx)
18 if err != nil {
19 return nil, err
20 }
21
22 if req.GetPromptId() == "" {
23 return nil, shared.ErrBadRequest("prompt_id cannot be empty")
24 }
25 if req.GetTitle() == "" {
26 return nil, shared.ErrBadRequest("title cannot be empty")
27 }
28 if req.GetContent() == "" {
29 return nil, shared.ErrBadRequest("content cannot be empty")
30 }
31
32 prompt := &models.Prompt{
33 Title: req.GetTitle(),
34 Content: req.GetContent(),
35 }
36
37 updatedPrompt, err := s.promptService.UpdatePrompt(ctx, actor.ID, req.GetPromptId(), prompt)
38 if err != nil {
39 return nil, err
40 }
41
42 return &userv1.UpdatePromptResponse{
43 Prompt: mapper.MapModelPromptToProto(updatedPrompt),
44 }, nil
45}

Callers

nothing calls this directly

Calls 6

GetActorFunction · 0.92
MapModelPromptToProtoFunction · 0.92
UpdatePromptMethod · 0.65
GetPromptIdMethod · 0.45
GetTitleMethod · 0.45
GetContentMethod · 0.45

Tested by

no test coverage detected