Added receipts list

This commit is contained in:
alexey
2025-02-20 23:56:47 +03:00
parent 895fb918b5
commit 0e894fafd6
7 changed files with 101 additions and 4 deletions

View File

@@ -6,6 +6,12 @@ Sequel.connect(cfg_internal.get_db)
class Repos < Sequel::Model(:repos)
end
class Recips < Sequel::Model(:recips)
end
class RepocRecips < Sequel::Model(:repos_recips)
end
class DBase
attr :error, :last_id
@@ -24,4 +30,11 @@ class DBase
def get_repo_info_by_name(repo_name)
Repos.where(reponame: repo_name)
end
def get_recips()
result = []
Recips.order(:id).map do |item|
{ :fname => item[:filepath], :descr => item[:descr], :id => item[:id] }
end
end
end

View File

@@ -138,4 +138,14 @@ class GitRepo
info[:error] = @error
info
end
def delete_repo(reponame)
git_path = File.expand_path(reponame + ".git", @path)
File.open("locks/gitcreate", "r") do |f|
f.flock(File::LOCK_EX)
if File.exist?(git_path)
FileUtils.rm_rf(git_path, secure: true)
end
end
end
end