7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/podrb/commands/delete/runner.rb', line 7
def call(podcast_id)
db = Infrastructure::Storage::SQL.new(db: podrb_db_dir)
if db.query("select id from podcasts where id = #{podcast_id}").empty?
return build_failure_response(details: :not_found)
end
sql_code = " delete from episodes\n where podcast_id = \#{podcast_id};\n SQL\n db.execute(sql_code)\n\n sql_code = <<~SQL\n delete from podcasts\n where id = \#{podcast_id};\n SQL\n db.execute(sql_code)\n\n build_success_response(details: :podcast_deleted)\nend\n"
|