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

30 lines
582 B
Ruby
Raw Permalink Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://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