diff --git a/.erdconfig b/.erdconfig new file mode 100644 index 0000000..d6330e4 --- /dev/null +++ b/.erdconfig @@ -0,0 +1,11 @@ +filetype: svg +orientation: vertical +attributes: + - content + - foreign_key + - inheritance +exclude: + - ActiveRecord::InternalMetadata + - ActiveRecord::SchemaMigration + - primary::SchemaMigration + - Audited::Audit diff --git a/Gemfile b/Gemfile index 3e49b10..404f3e8 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem "pundit" group :development, :test do gem "dotenv-rails" gem "pry-byebug", platforms: [:mri, :mingw, :x64_mingw] + gem "rails-erd" gem "rspec-rails" gem "faker", "~> 2.18" diff --git a/Gemfile.lock b/Gemfile.lock index b8c4546..fc32f9f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,6 +83,7 @@ GEM msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) + choice (0.2.0) coderay (1.1.3) concurrent-ruby (1.1.9) crass (1.0.6) @@ -207,6 +208,11 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) + rails-erd (1.6.1) + activerecord (>= 4.2) + activesupport (>= 4.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (6.1.4) @@ -264,6 +270,8 @@ GEM rubocop-ast (>= 1.1.0) rubocop-shopify (2.2.0) rubocop (~> 1.18) + ruby-graphviz (1.2.5) + rexml ruby-progressbar (1.11.0) ruby-vips (2.1.2) ffi (~> 1.12) @@ -340,6 +348,7 @@ DEPENDENCIES puma (~> 5.0) pundit rails (~> 6.1.4) + rails-erd rspec-graphql_matchers (~> 1.3) rspec-rails rubocop-rails diff --git a/README.md b/README.md index 12cdd6d..da28abd 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ * Postgres 13.x * [Watchman](https://github.com/facebook/watchman) (opcional) - ## 🚀 Instalando Comandos para a instalação: @@ -42,3 +41,6 @@ yarn relay ``` yarn relay:watch // requer a instalação do watchman ``` + +## ⛳ Modelo De Domínio +![](./erd.svg) diff --git a/erd.svg b/erd.svg new file mode 100644 index 0000000..309a8a3 --- /dev/null +++ b/erd.svg @@ -0,0 +1,198 @@ + + + + + + +XStake + +XStake domain model + + +m_ActiveStorage::Attachment + +ActiveStorage::Attachment + +blob_id +integer (8) ∗ FK +name +string ∗ +record_id +integer (8) ∗ FK +record_type +string ∗ + + + +m_ActiveStorage::Blob + +ActiveStorage::Blob + +byte_size +integer (8) ∗ +checksum +string ∗ +content_type +string +filename +string ∗ +key +string ∗ +metadata +text +service_name +string ∗ + + + +m_ActiveStorage::Blob->m_ActiveStorage::Attachment + + + + +m_ActiveStorage::Blob->m_ActiveStorage::Blob + + + + +m_ActiveStorage::VariantRecord + +ActiveStorage::VariantRecord + +blob_id +integer (8) ∗ FK +variation_digest +string ∗ + + + +m_ActiveStorage::Blob->m_ActiveStorage::VariantRecord + + + + + +m_ActiveStorage::VariantRecord->m_ActiveStorage::Attachment + + + + +m_AdminUser + +AdminUser + +email +string ∗ U +encrypted_password +string ∗ +remember_created_at +datetime +reset_password_sent_at +datetime +reset_password_token +string + + + +m_Balance + +Balance + +amount +decimal (20,10) ∗ +currency_id +integer (8) ∗ FK +user_id +integer (8) ∗ FK + + + +m_Currency + +Currency + +name +string ∗ + + + +m_Currency->m_Balance + + + + + +m_FiatBalance + +FiatBalance + +amount_cents +integer ∗ +amount_currency +string ∗ +user_id +integer (8) ∗ FK + + + +m_User + +User + +email +string ∗ U +encrypted_password +string ∗ +first_name +string ∗ +last_name +string ∗ +remember_created_at +datetime +reset_password_sent_at +datetime +reset_password_token +string + + + +m_User->m_Balance + + + + +m_User->m_FiatBalance + + + + +m_UserDocument + +UserDocument + +status +string ∗ +user_id +integer (8) ∗ FK + + + +m_User->m_UserDocument + + + + + +m_UserDocument->m_ActiveStorage::Attachment + + + + +m_UserDocument->m_ActiveStorage::Blob + + + + diff --git a/lib/tasks/auto_generate_diagram.rake b/lib/tasks/auto_generate_diagram.rake new file mode 100644 index 0000000..b7be980 --- /dev/null +++ b/lib/tasks/auto_generate_diagram.rake @@ -0,0 +1,7 @@ +# frozen_string_literal: true +# NOTE: only doing this in development as some production environments (Heroku) +# NOTE: are sensitive to local FS writes, and besides -- it's just not proper +# NOTE: to have a dev-mode tool do its thing in production. +if Rails.env.development? + RailsERD.load_tasks +end