Start a workflow from the iPhone Action button

This commit is contained in:
Ian Gulliver
2026-10-22 17:02:49 -07:00
parent f8fde62aab
commit 9df0c800dc
13 changed files with 724 additions and 370 deletions
+31
View File
@@ -41,6 +41,37 @@ func (s *Server) UpdateDefaultModel(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, u)
}
func (s *Server) UpdateQuickRun(w http.ResponseWriter, r *http.Request) {
req := api.QuickRun{}
if !readJSON(w, r, &req) {
return
}
if (req.ProjectId == "") != (req.Workflow == "") {
writeError(w, http.StatusBadRequest, errors.New("project_id and workflow are set together"))
return
}
if req.ProjectId != "" {
_, err := s.store.GetProject(r.Context(), req.ProjectId)
if err != nil {
writeStoreError(w, err)
return
}
_, err = s.store.GetWorkflow(r.Context(), req.Workflow)
if err != nil {
writeStoreError(w, err)
return
}
}
u, err := s.store.UpdateQuickRun(r.Context(), actor(r), req)
if err != nil {
writeStoreError(w, err)
return
}
writeJSON(w, http.StatusOK, u)
}
func (s *Server) UpdateAway(w http.ResponseWriter, r *http.Request) {
req := api.Away{}
if !readJSON(w, r, &req) {