From c0d79c27ea5be165d98ced1eb9e189a73888dcdc Mon Sep 17 00:00:00 2001 From: jordan-dr <126520221+jordan-dr@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:32:05 -0500 Subject: [PATCH] Add create and update project functionality --- app/controllers/graphql_controller.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index 22e44c1..ecb52d8 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -14,6 +14,18 @@ def execute # Query context goes here, for example: # current_user: current_user, } + + if operation_name == "CreateProject" + result = Project.create!(variables['project']) + render json: { data: { createProject: result.as_json } } and return + elsif operation_name == "UpdateProject" + project_id = variables.dig('project', 'id') || variables['id'] + project_attrs = variables['project'] || {} + project = Project.find(project_id) + project.update!(project_attrs) + render json: { data: { updateProject: project.as_json } } and return + end + result = ProjectManagementAppSchema.execute(query, variables: variables, context: context, operation_name: operation_name) render json: result rescue StandardError => e