Files
rails-solicitudes/app/controllers/notification_controller.rb
2026-04-06 22:13:54 +00:00

15 lines
914 B
Ruby

class NotificationController < ApplicationController
# POST /api/notification
def create
puts "Se ha creado una notificación, se va a crear una solicitud"
# se recibe: {"id" => 1, "user_id" => 2, "book_id" => 1, "returned" => 1, "created_at" => "2025-12-30T23:43:23.170Z", "updated_at" => "2026-03-23T21:43:39.950Z", "notification" => {"id" => 1, "user_id" => 2, "book_id" => 1, "returned" => 1, "created_at" => "2025-12-30T23:43:23.170Z", "updated_at" => "2026-03-23T21:43:39.950Z"}}
Solicitud.new(nombre: "User_id #{params["user_id"]}", email: "draft@draft.com", ciudad: "remota", estado: "remoto", direccion: "127.0.0.1", detalles: "Lend", presupuesto: "1.00", tiempo_de_entrega: "inmediato", telefono: "ninguno", contacto_de_preferencia_id: 1, categoria_id: 1, status_id: 1, notas: "Remote call", verificado: "" ).save
render json: {message: "created"}, status: :created
end
end