From 6c4e95963086a0360cfd5b61f03109e725ee0063 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 24 Jul 2019 15:29:50 +0800 Subject: [PATCH] add id response to add school and add department --- app/controllers/add_department_applies_controller.rb | 4 ++-- app/controllers/add_school_applies_controller.rb | 4 ++-- app/services/create_add_department_apply_service.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/add_department_applies_controller.rb b/app/controllers/add_department_applies_controller.rb index 644ebd87e..9d2f1df01 100644 --- a/app/controllers/add_department_applies_controller.rb +++ b/app/controllers/add_department_applies_controller.rb @@ -2,8 +2,8 @@ class AddDepartmentAppliesController < ApplicationController before_action :require_login, :check_auth def create - CreateAddDepartmentApplyService.call(current_user, create_params) - render_ok + department = CreateAddDepartmentApplyService.call(current_user, create_params) + render_ok(id: department.id) rescue CreateAddDepartmentApplyService::Error => ex render_error(ex.message) end diff --git a/app/controllers/add_school_applies_controller.rb b/app/controllers/add_school_applies_controller.rb index c868d79c9..22b3d360a 100644 --- a/app/controllers/add_school_applies_controller.rb +++ b/app/controllers/add_school_applies_controller.rb @@ -2,8 +2,8 @@ class AddSchoolAppliesController < ApplicationController before_action :require_login, :check_auth def create - CreateAddSchoolApplyService.call(current_user, create_params) - render_ok + school = CreateAddSchoolApplyService.call(current_user, create_params) + render_ok(id: school.id) rescue CreateAddSchoolApplyService::Error => ex render_error(ex.message) end diff --git a/app/services/create_add_department_apply_service.rb b/app/services/create_add_department_apply_service.rb index f1d6cf852..8c3a2127e 100644 --- a/app/services/create_add_department_apply_service.rb +++ b/app/services/create_add_department_apply_service.rb @@ -38,6 +38,6 @@ class CreateAddDepartmentApplyService < ApplicationService message.save(validate: false) end - school + department end end