MCPcopy Create free account
hub / github.com/astercloud/aster / handleTodoListRequest

Method handleTodoListRequest

server/handlers/websocket.go:529–551  ·  view source on GitHub ↗

handleTodoListRequest handles todo list requests

(wsConn *WebSocketConnection, payload map[string]any)

Source from the content-addressed store, hash-verified

527
528// handleTodoListRequest handles todo list requests
529func (h *WebSocketHandler) handleTodoListRequest(wsConn *WebSocketConnection, payload map[string]any) {
530 listName := "default"
531 if name, ok := payload["list_name"].(string); ok && name != "" {
532 listName = name
533 }
534
535 todoList, err := h.todoManager.LoadTodoList(listName)
536 if err != nil {
537 // 如果不存在,返回空列表
538 todoList = &builtin.TodoList{
539 ID: fmt.Sprintf("list_%s_%d", listName, time.Now().UnixNano()),
540 Name: listName,
541 Todos: []builtin.TodoItem{},
542 CreatedAt: time.Now(),
543 UpdatedAt: time.Now(),
544 Metadata: make(map[string]any),
545 }
546 }
547
548 h.sendMessage(wsConn, "todo_list_response", map[string]any{
549 "todos": todoList.Todos,
550 })
551}
552
553// handleTodoCreate handles todo creation
554func (h *WebSocketHandler) handleTodoCreate(wsConn *WebSocketConnection, payload map[string]any) {

Callers 1

handleMessageMethod · 0.95

Calls 2

sendMessageMethod · 0.95
LoadTodoListMethod · 0.65

Tested by

no test coverage detected