Return hashes from question use cases

This commit is contained in:
Karina Kwiatek 2022-07-23 15:33:28 +02:00
parent a3e030bd10
commit a8e99723cc
3 changed files with 12 additions and 3 deletions

View File

@ -32,8 +32,11 @@ module UseCase
inbox = ::Inbox.create!(user: target_user, question: question, new: true)
{
question: question,
inbox: inbox
status: 201,
resource: question,
extra: {
inbox:
}
}
end

View File

@ -23,7 +23,8 @@ module UseCase
QuestionWorker.perform_async(source_user_id, question.id)
{
question: question
status: 201,
resource: question
}
end

View File

@ -15,6 +15,11 @@ module UseCase
raise Errors::Forbidden unless current_user&.mod? || question.user == current_user
question.destroy!
{
status: 204,
resource: nil,
}
end
end
end