29 lines
583 B
Ruby
29 lines
583 B
Ruby
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
class Store
|
|
module Provider
|
|
class DB < ApplicationModel
|
|
self.table_name = 'store_provider_dbs'
|
|
|
|
def self.add(data, sha)
|
|
Store::Provider::DB.create(
|
|
data: data,
|
|
sha: sha,
|
|
)
|
|
true
|
|
end
|
|
|
|
def self.get(sha)
|
|
file = Store::Provider::DB.find_by(sha: sha)
|
|
return if !file
|
|
|
|
file.data
|
|
end
|
|
|
|
def self.delete(sha)
|
|
Store::Provider::DB.where(sha: sha).destroy_all
|
|
true
|
|
end
|
|
end
|
|
end
|
|
end
|