# 保証会社のモデル ## 審査情報登録 ### 保証会社(商品)選択ページ ```ruby current_user = OperationCorporationStaff.find(:id) operation_corporation = current_user.operation_corporation guarantee_corporation = operation_corporation.partner_guarantee_corporations.first #> 提携している保証会社 plans = guarantee_corporation.plans #> 保証会社が持つ、標準保証プラン(学生向け) ``` Graphql保証会社とプランを全部持ってきて選択した保証会社によって、表示するプランを変える。 ### 必要事項登録ページ - 支店・営業社名は本店固定にする(最初のフェーズでは管理画面に表示しなくても良い。) - 既に存在するプラン(もしくは同じ保証会社)に対する審査(guarantee)作成はできない様にする。 - 審査のプランによって入れる内容は一緒。 - 審査内容を出したらGuaranteeのステータスは審査中(Enumで定義されてる) - その他固定費は名前と金額を入れさせる(guarantee_other_fixed_feesテーブル)。※その他固定費は画面にも出さなくて良い。 ```ruby throw BadRequest if entry.status includes %s(status_ok status_ng ...etc) #> 項目は要確認 transaction do guarantee_corporation = GuaranteeCorporation.find(params[guarantee_corporation_id]) entry = Entry.find(params[entry_id]) guarantee = Guarantiee.new guarantee.guarantee_corporation = guarantee_corporation guarantee.entry = entry guarantee.attributes = { } guarantee.save! entry.status = "審査中" entry.update end ``` ### 登録内容確認ページ Guaranteeに登録する内容を表示する ## 申込詳細画面(保証会社審査) ```ruby ``` ## 関連テーブル - guarantee: 審査(審査項目を持つテーブル) - guarantee_plan: 保証会社の商品プラン - guarantee_corporation: 保証会社 - peration_corporation_branch: 管理会社の支店 - partner_operation_corporation_branches_guarantee_corporations: 管理会社の支店と保証会社の中間テーブル - guarantee_other_fixed_fee: その他固定費 - guarantee_original_question_answer: 保証会社独自質問(ex. エポスカード持ってますか?はい。) - guarantee_result_image: 保証会社がアップロードする審査結果画像 ## 参考資料 - https://docs.google.com/spreadsheets/d/1n_RYuIqN-yXgFP76xBrvLG6fz01ysqArKnjMdWs7LU8/edit#gid=1003466238