Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Introduce the gem and registries

Marcello Rocha153bfe5a484e
diff --git a/Gemfile b/Gemfile
index f4fbebf7dab..4cd461fd439 100644
--- a/Gemfile
+++ b/Gemfile
@@ -199,6 +199,9 @@ gem 'mini_magick', '~> 4.12.0', require: false
gem 'validate_url'
+# Storages support code
+gem "dry-container"
+
# ActiveRecord extension which adds typecasting to store accessors
gem "store_attribute", "~> 1.0"
diff --git a/Gemfile.lock b/Gemfile.lock
index e4601b6ef40..1a33a2d466e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -406,6 +406,8 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
+ dry-container (0.11.0)
+ concurrent-ruby (~> 1.0)
dry-core (1.0.0)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
@@ -1040,6 +1042,7 @@ DEPENDENCIES
disposable (~> 0.6.2)
doorkeeper (~> 5.6.6)
dotenv-rails
+ dry-container
email_validator (~> 2.2.3)
equivalent-xml (~> 0.6)
escape_utils (~> 1.3)
diff --git a/modules/storages/app/common/storages/peripherals/registry.rb b/modules/storages/app/common/storages/peripherals/registry.rb
new file mode 100644
index 00000000000..12ee4c8980f
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/registry.rb
@@ -0,0 +1,10 @@
+module Storages
+ module Peripherals
+ class Registry
+ extend Dry::Container::Mixin
+ end
+
+ require_relative 'storage_interaction/nextcloud'
+ require_relative 'storage_interaction/sharepoint'
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb
new file mode 100644
index 00000000000..6bb3e943488
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb
@@ -0,0 +1,20 @@
+module Storages
+ module Peripherals
+ module StorageInteraction
+ module Nextcloud
+ Queries = Dry::Container::Namespace.new('queries') do
+ namespace('nextcloud') do
+ register(:file_query, FileQuery.new)
+ register(:download_link_query) { DownloadLinkQuery }
+ register(:files_query, FilesQuery.new)
+ register(:upload_link_query) { UploadLinkQuery }
+ register(:group_users_query) { GroupUsersQuery }
+ register(:propfind_query) { PropfindQuery }
+ end
+ end
+ end
+ end
+
+ Registry.import StorageInteraction::Nextcloud::Queries
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/sharepoint.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/sharepoint.rb
new file mode 100644
index 00000000000..314b13a8a86
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/sharepoint.rb
@@ -0,0 +1,20 @@
+module Storages
+ module Peripherals
+ module StorageInteraction
+ module Sharepoint
+ Queries = Dry::Container::Namespace.new('queries') do
+ namespace('sharepoint') do
+ register(:file_query, 10)
+ # register(:download_link_query) { DownloadLinkQuery }
+ # register(:files_query) { FilesQuery }
+ # register(:upload_link_query) { UploadLinkQuery }
+ # register(:group_users_query) { GroupUsersQuery }
+ # register(:propfind_query) { PropfindQuery }
+ end
+ end
+ end
+ end
+
+ Registry.import StorageInteraction::Sharepoint::Queries
+ end
+end