trabajo-afectivo/app/models/store/provider/db.rb

30 lines
583 B
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
2015-04-27 21:44:41 +00:00
class Store
2015-04-27 22:02:11 +00:00
module Provider
2015-04-27 21:44:41 +00:00
class DB < ApplicationModel
self.table_name = 'store_provider_dbs'
2015-04-27 21:44:41 +00:00
def self.add(data, sha)
Store::Provider::DB.create(
data: data,
sha: sha,
2015-04-27 21:44:41 +00:00
)
true
end
2015-04-27 21:44:41 +00:00
def self.get(sha)
2016-02-02 12:50:49 +00:00
file = Store::Provider::DB.find_by(sha: sha)
2015-04-27 21:44:41 +00:00
return if !file
2015-04-27 21:44:41 +00:00
file.data
end
2015-04-27 21:44:41 +00:00
def self.delete(sha)
2016-02-02 12:50:49 +00:00
Store::Provider::DB.where(sha: sha).destroy_all
2015-04-27 21:44:41 +00:00
true
end
end
end
end