snf_core 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/app/controllers/concerns/common.rb +0 -0
- data/app/controllers/concerns/pagination.rb +0 -0
- data/app/controllers/snf_core/application_controller.rb +0 -0
- data/app/jobs/snf_core/application_job.rb +0 -0
- data/app/mailers/snf_core/application_mailer.rb +0 -0
- data/app/models/snf_core/address.rb +0 -0
- data/app/models/snf_core/application_record.rb +0 -0
- data/app/models/snf_core/business.rb +0 -0
- data/app/models/snf_core/business_document.rb +4 -1
- data/app/models/snf_core/category.rb +0 -0
- data/app/models/snf_core/customer_group.rb +0 -0
- data/app/models/snf_core/group.rb +0 -0
- data/app/models/snf_core/product.rb +0 -0
- data/app/models/snf_core/store.rb +0 -0
- data/app/models/snf_core/store_inventory.rb +0 -0
- data/app/models/snf_core/user.rb +0 -0
- data/app/models/snf_core/wallet.rb +0 -0
- data/config/routes.rb +0 -0
- data/db/migrate/20250226042622_create_snf_core_users.rb +0 -0
- data/db/migrate/20250226064444_create_snf_core_categories.rb +0 -0
- data/db/migrate/20250226080323_create_snf_core_businesses.rb +0 -0
- data/db/migrate/20250226102931_create_snf_core_business_documents.rb +0 -0
- data/db/migrate/20250226110217_create_snf_core_addresses.rb +0 -0
- data/db/migrate/20250226115215_create_snf_core_stores.rb +0 -0
- data/db/migrate/20250226181007_create_snf_core_products.rb +0 -0
- data/db/migrate/20250226190000_create_snf_core_store_inventories.rb +0 -0
- data/db/migrate/20250226192104_create_snf_core_groups.rb +0 -0
- data/db/migrate/20250226193938_create_snf_core_customer_groups.rb +0 -0
- data/db/migrate/20250227075048_create_snf_core_wallets.rb +0 -0
- data/db/migrate/20250227102833_modify_store_inventories.rb +0 -0
- data/lib/snf_core/engine.rb +0 -0
- data/lib/snf_core/version.rb +1 -1
- data/lib/snf_core.rb +0 -0
- data/lib/tasks/snf_core_tasks.rake +0 -0
- metadata +3 -110
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/app/jobs/application_job.rb +0 -7
- data/spec/dummy/app/mailers/application_mailer.rb +0 -4
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/dummy/bin/dev +0 -2
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -34
- data/spec/dummy/config/application.rb +0 -43
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/cable.yml +0 -10
- data/spec/dummy/config/database.yml +0 -20
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -67
- data/spec/dummy/config/environments/production.rb +0 -86
- data/spec/dummy/config/environments/test.rb +0 -53
- data/spec/dummy/config/initializers/cors.rb +0 -16
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -8
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/locales/en.yml +0 -31
- data/spec/dummy/config/puma.rb +0 -38
- data/spec/dummy/config/routes.rb +0 -3
- data/spec/dummy/config/storage.yml +0 -38
- data/spec/dummy/config.ru +0 -6
- data/spec/dummy/db/migrate/20250226123213_create_active_storage_tables.active_storage.rb +0 -57
- data/spec/dummy/db/schema.rb +0 -181
- data/spec/dummy/log/development.log +0 -901
- data/spec/dummy/log/test.log +0 -12199
- data/spec/dummy/spec/fixtures/files/sample.pdf +0 -0
- data/spec/dummy/tmp/local_secret.txt +0 -1
- data/spec/dummy/tmp/storage/13/1y/131yod70wqijazn3ix829yvuuvge +0 -0
- data/spec/dummy/tmp/storage/16/na/16na9nc1z98jt6fyn3axj3bhudes +0 -0
- data/spec/dummy/tmp/storage/1t/oy/1toyz0i6f9u5xexr4cpwttr04ood +0 -0
- data/spec/dummy/tmp/storage/1x/i3/1xi33eqr5ipoaz0upakb8yy7qc4o +0 -0
- data/spec/dummy/tmp/storage/24/69/2469t9kpepg4fd8ki960h025li0b +0 -0
- data/spec/dummy/tmp/storage/2a/0u/2a0uyihfk1wn5c1fuz09unocwy2m +0 -0
- data/spec/dummy/tmp/storage/4t/86/4t862kv9wcz0p7wgdvpmtmczdadt +0 -0
- data/spec/dummy/tmp/storage/5s/zb/5szbksq6mg3768g9vtk788gc49gw +0 -0
- data/spec/dummy/tmp/storage/6g/dc/6gdc40iivivwbln1zs4dqedt5ni7 +0 -0
- data/spec/dummy/tmp/storage/6o/7a/6o7ax3ihg25bswxp4d601mqo7tl3 +0 -0
- data/spec/dummy/tmp/storage/6z/86/6z862zpc67sikzl0otbf418t2clj +0 -0
- data/spec/dummy/tmp/storage/92/hw/92hw9u9j6728qgwpcn7oqphe9tzj +0 -0
- data/spec/dummy/tmp/storage/9a/3q/9a3qd5qc7j6dzzmg16wcpvwoowmp +0 -0
- data/spec/dummy/tmp/storage/al/8s/al8szf81ccm4ckpvxh3bv6vlgp0y +0 -0
- data/spec/dummy/tmp/storage/b8/8l/b88ln7wuq13v4akgwgc0dgac8887 +0 -0
- data/spec/dummy/tmp/storage/bs/y9/bsy9t4961ra8hwlq06wjtgrrcflp +0 -0
- data/spec/dummy/tmp/storage/cs/x9/csx9mv26ab1lm82a7itryfq4v6rq +0 -0
- data/spec/dummy/tmp/storage/dp/0f/dp0fx9ji1bqvx1najwjgns6n7fhf +0 -0
- data/spec/dummy/tmp/storage/em/kc/emkc4tc71k65mfcurv6k8z1ylswl +0 -0
- data/spec/dummy/tmp/storage/em/vx/emvx0c15o74mr0nlcvdc7m88j2gi +0 -0
- data/spec/dummy/tmp/storage/ga/7e/ga7eiyyv0llme2i4xby0kdp4a4h8 +0 -0
- data/spec/dummy/tmp/storage/h4/vg/h4vgoatz21dhjrztrrbg2hdhkwjb +0 -0
- data/spec/dummy/tmp/storage/hi/9h/hi9ho77symoy2j0ye28fxgnxw3kt +0 -0
- data/spec/dummy/tmp/storage/hl/yy/hlyyu150rt2yos1sa9ed1qw49y26 +0 -0
- data/spec/dummy/tmp/storage/j7/6x/j76x0oirv7i4t6p3blseuaknp7pw +0 -0
- data/spec/dummy/tmp/storage/jq/95/jq95rqhv5usgucn2d2mmkhjufapu +0 -0
- data/spec/dummy/tmp/storage/ky/1y/ky1ys68lmat11bxs2395dqugiyig +0 -0
- data/spec/dummy/tmp/storage/ln/0f/ln0fz4opsdycu80q7urfez9ar7kn +0 -0
- data/spec/dummy/tmp/storage/mk/4w/mk4w528bsn47ewri0odui9s40f87 +0 -0
- data/spec/dummy/tmp/storage/na/6r/na6rrohinrnjofsq27u95up5rp8k +0 -0
- data/spec/dummy/tmp/storage/oc/f8/ocf8zs18lm9fnkpqj6wpshdpyf43 +0 -0
- data/spec/dummy/tmp/storage/oe/bq/oebq593a6bpwkbxpx6segtwyy0jy +0 -0
- data/spec/dummy/tmp/storage/qs/jk/qsjkqiiarr85uobud0qsnnmpraol +0 -0
- data/spec/dummy/tmp/storage/qw/7z/qw7zsf91njf7ga6454nrjpvddjn5 +0 -0
- data/spec/dummy/tmp/storage/rh/0h/rh0h80b8er9vp1u8dcocy1u58obf +0 -0
- data/spec/dummy/tmp/storage/tc/gu/tcgurel05x9fk9ksm4hxwfla3hg3 +0 -0
- data/spec/dummy/tmp/storage/tm/ce/tmce54998rdnz191k02fzowpebvw +0 -0
- data/spec/dummy/tmp/storage/w2/3f/w23f3igzkn7bddqxry5x4wsu2ths +0 -0
- data/spec/dummy/tmp/storage/wo/81/wo813rsnwvoa55h0vq0fr79iajuw +0 -0
- data/spec/dummy/tmp/storage/wy/14/wy14megn3o5zqplv9xg6u32uwkr6 +0 -0
- data/spec/dummy/tmp/storage/xj/yy/xjyygdd3znvvpt9ufz1vv4lfsx3w +0 -0
- data/spec/dummy/tmp/storage/yf/49/yf49a4ydheqf3cqs0u49sanbl4ms +0 -0
- data/spec/dummy/tmp/storage/yh/q1/yhq1muao2dpuykmj12bxhd0x4ntk +0 -0
- data/spec/dummy/tmp/storage/yx/jp/yxjpumjyo1jysjpg20qaxgsqg4fw +0 -0
- data/spec/dummy/tmp/storage/z1/gr/z1grp34d5vw7mi4g8vw8yfu91ny2 +0 -0
- data/spec/examples.txt +0 -66
- data/spec/factories/snf_core/addresses.rb +0 -10
- data/spec/factories/snf_core/business_documents.rb +0 -18
- data/spec/factories/snf_core/businesses.rb +0 -10
- data/spec/factories/snf_core/categories.rb +0 -7
- data/spec/factories/snf_core/customer_groups.rb +0 -9
- data/spec/factories/snf_core/groups.rb +0 -6
- data/spec/factories/snf_core/products.rb +0 -9
- data/spec/factories/snf_core/store_inventories.rb +0 -8
- data/spec/factories/snf_core/stores.rb +0 -9
- data/spec/factories/snf_core/users.rb +0 -10
- data/spec/factories/snf_core/wallets.rb +0 -7
- data/spec/models/snf_core/address_spec.rb +0 -15
- data/spec/models/snf_core/business_document_spec.rb +0 -20
- data/spec/models/snf_core/business_spec.rb +0 -14
- data/spec/models/snf_core/category_spec.rb +0 -12
- data/spec/models/snf_core/customer_group_spec.rb +0 -11
- data/spec/models/snf_core/group_spec.rb +0 -11
- data/spec/models/snf_core/product_spec.rb +0 -17
- data/spec/models/snf_core/store_inventory_spec.rb +0 -24
- data/spec/models/snf_core/store_spec.rb +0 -13
- data/spec/models/snf_core/user_spec.rb +0 -23
- data/spec/models/snf_core/wallet_spec.rb +0 -28
- data/spec/rails_helper.rb +0 -46
- data/spec/sample_spec.rb +0 -5
- data/spec/spec_helper.rb +0 -36
- data/spec/support/models/shared_examples.rb +0 -49
- data/spec/support/requests/shared_requests.rb +0 -130
@@ -1,53 +0,0 @@
|
|
1
|
-
# The test environment is used exclusively to run your application's
|
2
|
-
# test suite. You never need to work with it otherwise. Remember that
|
3
|
-
# your test database is "scratch space" for the test suite and is wiped
|
4
|
-
# and recreated between test runs. Don't rely on the data there!
|
5
|
-
|
6
|
-
Rails.application.configure do
|
7
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
8
|
-
|
9
|
-
# While tests run files are not watched, reloading is not necessary.
|
10
|
-
config.enable_reloading = false
|
11
|
-
|
12
|
-
# Eager loading loads your entire application. When running a single test locally,
|
13
|
-
# this is usually not necessary, and can slow down your test suite. However, it's
|
14
|
-
# recommended that you enable it in continuous integration systems to ensure eager
|
15
|
-
# loading is working properly before deploying your code.
|
16
|
-
config.eager_load = ENV["CI"].present?
|
17
|
-
|
18
|
-
# Configure public file server for tests with cache-control for performance.
|
19
|
-
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
20
|
-
|
21
|
-
# Show full error reports.
|
22
|
-
config.consider_all_requests_local = true
|
23
|
-
config.cache_store = :null_store
|
24
|
-
|
25
|
-
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
26
|
-
config.action_dispatch.show_exceptions = :rescuable
|
27
|
-
|
28
|
-
# Disable request forgery protection in test environment.
|
29
|
-
config.action_controller.allow_forgery_protection = false
|
30
|
-
|
31
|
-
# Store uploaded files on the local file system in a temporary directory.
|
32
|
-
config.active_storage.service = :test
|
33
|
-
|
34
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
35
|
-
# The :test delivery method accumulates sent emails in the
|
36
|
-
# ActionMailer::Base.deliveries array.
|
37
|
-
config.action_mailer.delivery_method = :test
|
38
|
-
|
39
|
-
# Set host to be used by links generated in mailer templates.
|
40
|
-
config.action_mailer.default_url_options = { host: "example.com" }
|
41
|
-
|
42
|
-
# Print deprecation notices to the stderr.
|
43
|
-
config.active_support.deprecation = :stderr
|
44
|
-
|
45
|
-
# Raises error for missing translations.
|
46
|
-
# config.i18n.raise_on_missing_translations = true
|
47
|
-
|
48
|
-
# Annotate rendered view with file names.
|
49
|
-
# config.action_view.annotate_rendered_view_with_filenames = true
|
50
|
-
|
51
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
52
|
-
config.action_controller.raise_on_missing_callback_actions = true
|
53
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Avoid CORS issues when API is called from the frontend app.
|
4
|
-
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
|
5
|
-
|
6
|
-
# Read more: https://github.com/cyu/rack-cors
|
7
|
-
|
8
|
-
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
9
|
-
# allow do
|
10
|
-
# origins "example.com"
|
11
|
-
#
|
12
|
-
# resource "*",
|
13
|
-
# headers: :any,
|
14
|
-
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
15
|
-
# end
|
16
|
-
# end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
4
|
-
# Use this to limit dissemination of sensitive information.
|
5
|
-
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
6
|
-
Rails.application.config.filter_parameters += [
|
7
|
-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
8
|
-
]
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format. Inflections
|
4
|
-
# are locale specific, and you may define rules for as many different
|
5
|
-
# locales as you wish. All of these examples are active by default:
|
6
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
-
# inflect.plural /^(ox)$/i, "\\1en"
|
8
|
-
# inflect.singular /^(ox)en/i, "\\1"
|
9
|
-
# inflect.irregular "person", "people"
|
10
|
-
# inflect.uncountable %w( fish sheep )
|
11
|
-
# end
|
12
|
-
|
13
|
-
# These inflection rules are supported but not enabled by default:
|
14
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
-
# inflect.acronym "RESTful"
|
16
|
-
# end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization and
|
2
|
-
# are automatically loaded by Rails. If you want to use locales other than
|
3
|
-
# English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t "hello"
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t("hello") %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more about the API, please read the Rails Internationalization guide
|
20
|
-
# at https://guides.rubyonrails.org/i18n.html.
|
21
|
-
#
|
22
|
-
# Be aware that YAML interprets the following case-insensitive strings as
|
23
|
-
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
24
|
-
# must be quoted to be interpreted as strings. For example:
|
25
|
-
#
|
26
|
-
# en:
|
27
|
-
# "yes": yup
|
28
|
-
# enabled: "ON"
|
29
|
-
|
30
|
-
en:
|
31
|
-
hello: "Hello world"
|
data/spec/dummy/config/puma.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# This configuration file will be evaluated by Puma. The top-level methods that
|
2
|
-
# are invoked here are part of Puma's configuration DSL. For more information
|
3
|
-
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
4
|
-
#
|
5
|
-
# Puma starts a configurable number of processes (workers) and each process
|
6
|
-
# serves each request in a thread from an internal thread pool.
|
7
|
-
#
|
8
|
-
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
9
|
-
# should only set this value when you want to run 2 or more workers. The
|
10
|
-
# default is already 1.
|
11
|
-
#
|
12
|
-
# The ideal number of threads per worker depends both on how much time the
|
13
|
-
# application spends waiting for IO operations and on how much you wish to
|
14
|
-
# prioritize throughput over latency.
|
15
|
-
#
|
16
|
-
# As a rule of thumb, increasing the number of threads will increase how much
|
17
|
-
# traffic a given process can handle (throughput), but due to CRuby's
|
18
|
-
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
19
|
-
# response time (latency) of the application.
|
20
|
-
#
|
21
|
-
# The default is set to 3 threads as it's deemed a decent compromise between
|
22
|
-
# throughput and latency for the average Rails application.
|
23
|
-
#
|
24
|
-
# Any libraries that use a connection pool or another resource pool should
|
25
|
-
# be configured to provide at least as many connections as the number of
|
26
|
-
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
27
|
-
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
28
|
-
threads threads_count, threads_count
|
29
|
-
|
30
|
-
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
31
|
-
port ENV.fetch("PORT", 3000)
|
32
|
-
|
33
|
-
# Allow puma to be restarted by `bin/rails restart` command.
|
34
|
-
plugin :tmp_restart
|
35
|
-
|
36
|
-
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
37
|
-
# In other environments, only set the PID file if requested.
|
38
|
-
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
test:
|
2
|
-
service: Disk
|
3
|
-
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
-
|
5
|
-
local:
|
6
|
-
service: S3
|
7
|
-
endpoint: http://127.0.0.1:9000
|
8
|
-
access_key_id: <%= Rails.application.credentials.dig(:minio, :access_key_id) %>
|
9
|
-
secret_access_key: <%= Rails.application.credentials.dig(:minio, :secret_access_key) %>
|
10
|
-
region: eu-central-1
|
11
|
-
bucket: snf-core-<%= Rails.env %>
|
12
|
-
force_path_style: true
|
13
|
-
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
14
|
-
# amazon:
|
15
|
-
# service: S3
|
16
|
-
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
17
|
-
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
18
|
-
# region: us-east-1
|
19
|
-
# bucket: your_own_bucket-<%= Rails.env %>
|
20
|
-
|
21
|
-
# Remember not to checkin your GCS keyfile to a repository
|
22
|
-
# google:
|
23
|
-
# service: GCS
|
24
|
-
# project: your_project
|
25
|
-
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
26
|
-
# bucket: your_own_bucket-<%= Rails.env %>
|
27
|
-
|
28
|
-
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
29
|
-
# microsoft:
|
30
|
-
# service: AzureStorage
|
31
|
-
# storage_account_name: your_account_name
|
32
|
-
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
33
|
-
# container: your_container_name-<%= Rails.env %>
|
34
|
-
|
35
|
-
# mirror:
|
36
|
-
# service: Mirror
|
37
|
-
# primary: local
|
38
|
-
# mirrors: [ amazon, google, microsoft ]
|
data/spec/dummy/config.ru
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# This migration comes from active_storage (originally 20170806125915)
|
2
|
-
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
|
3
|
-
def change
|
4
|
-
# Use Active Record's configured type for primary and foreign keys
|
5
|
-
primary_key_type, foreign_key_type = primary_and_foreign_key_types
|
6
|
-
|
7
|
-
create_table :active_storage_blobs, id: primary_key_type do |t|
|
8
|
-
t.string :key, null: false
|
9
|
-
t.string :filename, null: false
|
10
|
-
t.string :content_type
|
11
|
-
t.text :metadata
|
12
|
-
t.string :service_name, null: false
|
13
|
-
t.bigint :byte_size, null: false
|
14
|
-
t.string :checksum
|
15
|
-
|
16
|
-
if connection.supports_datetime_with_precision?
|
17
|
-
t.datetime :created_at, precision: 6, null: false
|
18
|
-
else
|
19
|
-
t.datetime :created_at, null: false
|
20
|
-
end
|
21
|
-
|
22
|
-
t.index [ :key ], unique: true
|
23
|
-
end
|
24
|
-
|
25
|
-
create_table :active_storage_attachments, id: primary_key_type do |t|
|
26
|
-
t.string :name, null: false
|
27
|
-
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
|
28
|
-
t.references :blob, null: false, type: foreign_key_type
|
29
|
-
|
30
|
-
if connection.supports_datetime_with_precision?
|
31
|
-
t.datetime :created_at, precision: 6, null: false
|
32
|
-
else
|
33
|
-
t.datetime :created_at, null: false
|
34
|
-
end
|
35
|
-
|
36
|
-
t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
|
37
|
-
t.foreign_key :active_storage_blobs, column: :blob_id
|
38
|
-
end
|
39
|
-
|
40
|
-
create_table :active_storage_variant_records, id: primary_key_type do |t|
|
41
|
-
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
|
42
|
-
t.string :variation_digest, null: false
|
43
|
-
|
44
|
-
t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
|
45
|
-
t.foreign_key :active_storage_blobs, column: :blob_id
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
def primary_and_foreign_key_types
|
51
|
-
config = Rails.configuration.generators
|
52
|
-
setting = config.options[config.orm][:primary_key_type]
|
53
|
-
primary_key_type = setting || :primary_key
|
54
|
-
foreign_key_type = setting || :bigint
|
55
|
-
[ primary_key_type, foreign_key_type ]
|
56
|
-
end
|
57
|
-
end
|
data/spec/dummy/db/schema.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
-
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
-
# be faster and is potentially less error prone than running all of your
|
8
|
-
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
-
# migrations use external dependencies or application code.
|
10
|
-
#
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema[8.0].define(version: 2025_02_27_102833) do
|
14
|
-
# These are extensions that must be enabled in order to support this database
|
15
|
-
enable_extension "pg_catalog.plpgsql"
|
16
|
-
|
17
|
-
create_table "active_storage_attachments", force: :cascade do |t|
|
18
|
-
t.string "name", null: false
|
19
|
-
t.string "record_type", null: false
|
20
|
-
t.bigint "record_id", null: false
|
21
|
-
t.bigint "blob_id", null: false
|
22
|
-
t.datetime "created_at", null: false
|
23
|
-
t.index [ "blob_id" ], name: "index_active_storage_attachments_on_blob_id"
|
24
|
-
t.index [ "record_type", "record_id", "name", "blob_id" ], name: "index_active_storage_attachments_uniqueness", unique: true
|
25
|
-
end
|
26
|
-
|
27
|
-
create_table "active_storage_blobs", force: :cascade do |t|
|
28
|
-
t.string "key", null: false
|
29
|
-
t.string "filename", null: false
|
30
|
-
t.string "content_type"
|
31
|
-
t.text "metadata"
|
32
|
-
t.string "service_name", null: false
|
33
|
-
t.bigint "byte_size", null: false
|
34
|
-
t.string "checksum"
|
35
|
-
t.datetime "created_at", null: false
|
36
|
-
t.index [ "key" ], name: "index_active_storage_blobs_on_key", unique: true
|
37
|
-
end
|
38
|
-
|
39
|
-
create_table "active_storage_variant_records", force: :cascade do |t|
|
40
|
-
t.bigint "blob_id", null: false
|
41
|
-
t.string "variation_digest", null: false
|
42
|
-
t.index [ "blob_id", "variation_digest" ], name: "index_active_storage_variant_records_uniqueness", unique: true
|
43
|
-
end
|
44
|
-
|
45
|
-
create_table "snf_core_addresses", force: :cascade do |t|
|
46
|
-
t.string "address_type", null: false
|
47
|
-
t.string "city", null: false
|
48
|
-
t.string "sub_city", null: false
|
49
|
-
t.string "woreda"
|
50
|
-
t.decimal "latitude", null: false
|
51
|
-
t.decimal "longitude", null: false
|
52
|
-
t.datetime "created_at", null: false
|
53
|
-
t.datetime "updated_at", null: false
|
54
|
-
end
|
55
|
-
|
56
|
-
create_table "snf_core_business_documents", force: :cascade do |t|
|
57
|
-
t.bigint "business_id", null: false
|
58
|
-
t.integer "document_type", null: false
|
59
|
-
t.datetime "verified_at"
|
60
|
-
t.bigint "verified_by_id"
|
61
|
-
t.datetime "uploaded_at"
|
62
|
-
t.boolean "is_verified", default: false, null: false
|
63
|
-
t.datetime "created_at", null: false
|
64
|
-
t.datetime "updated_at", null: false
|
65
|
-
t.index [ "business_id" ], name: "index_snf_core_business_documents_on_business_id"
|
66
|
-
t.index [ "verified_by_id" ], name: "index_snf_core_business_documents_on_verified_by_id"
|
67
|
-
end
|
68
|
-
|
69
|
-
create_table "snf_core_businesses", force: :cascade do |t|
|
70
|
-
t.bigint "user_id", null: false
|
71
|
-
t.string "business_name", null: false
|
72
|
-
t.string "tin_number", null: false
|
73
|
-
t.integer "business_type", null: false
|
74
|
-
t.datetime "verified_at"
|
75
|
-
t.integer "verification_status", null: false
|
76
|
-
t.datetime "created_at", null: false
|
77
|
-
t.datetime "updated_at", null: false
|
78
|
-
t.index [ "user_id" ], name: "index_snf_core_businesses_on_user_id"
|
79
|
-
end
|
80
|
-
|
81
|
-
create_table "snf_core_categories", force: :cascade do |t|
|
82
|
-
t.string "name", null: false
|
83
|
-
t.string "description"
|
84
|
-
t.bigint "parent_id"
|
85
|
-
t.datetime "created_at", null: false
|
86
|
-
t.datetime "updated_at", null: false
|
87
|
-
t.index [ "parent_id" ], name: "index_snf_core_categories_on_parent_id"
|
88
|
-
end
|
89
|
-
|
90
|
-
create_table "snf_core_customer_groups", force: :cascade do |t|
|
91
|
-
t.string "discount_code"
|
92
|
-
t.datetime "expire_date"
|
93
|
-
t.boolean "is_used"
|
94
|
-
t.bigint "group_id", null: false
|
95
|
-
t.bigint "customer_id", null: false
|
96
|
-
t.datetime "created_at", null: false
|
97
|
-
t.datetime "updated_at", null: false
|
98
|
-
t.index [ "customer_id" ], name: "index_snf_core_customer_groups_on_customer_id"
|
99
|
-
t.index [ "group_id" ], name: "index_snf_core_customer_groups_on_group_id"
|
100
|
-
end
|
101
|
-
|
102
|
-
create_table "snf_core_groups", force: :cascade do |t|
|
103
|
-
t.string "name", null: false
|
104
|
-
t.bigint "business_id", null: false
|
105
|
-
t.datetime "created_at", null: false
|
106
|
-
t.datetime "updated_at", null: false
|
107
|
-
t.index [ "business_id" ], name: "index_snf_core_groups_on_business_id"
|
108
|
-
end
|
109
|
-
|
110
|
-
create_table "snf_core_products", force: :cascade do |t|
|
111
|
-
t.string "sku", null: false
|
112
|
-
t.string "name", null: false
|
113
|
-
t.string "description"
|
114
|
-
t.bigint "category_id", null: false
|
115
|
-
t.float "base_price"
|
116
|
-
t.datetime "created_at", null: false
|
117
|
-
t.datetime "updated_at", null: false
|
118
|
-
t.index [ "category_id" ], name: "index_snf_core_products_on_category_id"
|
119
|
-
end
|
120
|
-
|
121
|
-
create_table "snf_core_store_inventories", force: :cascade do |t|
|
122
|
-
t.bigint "store_id", null: false
|
123
|
-
t.bigint "product_id", null: false
|
124
|
-
t.decimal "base_price", precision: 10, scale: 2, null: false
|
125
|
-
t.datetime "created_at", null: false
|
126
|
-
t.datetime "updated_at", null: false
|
127
|
-
t.integer "status", default: 0, null: false
|
128
|
-
t.index [ "product_id" ], name: "index_snf_core_store_inventories_on_product_id"
|
129
|
-
t.index [ "store_id", "product_id" ], name: "index_snf_core_store_inventories_on_store_id_and_product_id", unique: true
|
130
|
-
end
|
131
|
-
|
132
|
-
create_table "snf_core_stores", force: :cascade do |t|
|
133
|
-
t.string "name", null: false
|
134
|
-
t.string "email"
|
135
|
-
t.integer "operational_status", default: 1, null: false
|
136
|
-
t.bigint "business_id", null: false
|
137
|
-
t.bigint "address_id", null: false
|
138
|
-
t.datetime "created_at", null: false
|
139
|
-
t.datetime "updated_at", null: false
|
140
|
-
t.index [ "address_id" ], name: "index_snf_core_stores_on_address_id"
|
141
|
-
t.index [ "business_id" ], name: "index_snf_core_stores_on_business_id"
|
142
|
-
end
|
143
|
-
|
144
|
-
create_table "snf_core_users", force: :cascade do |t|
|
145
|
-
t.string "first_name", null: false
|
146
|
-
t.string "middle_name", null: false
|
147
|
-
t.string "last_name", null: false
|
148
|
-
t.string "email"
|
149
|
-
t.string "phone_number", null: false
|
150
|
-
t.integer "role", null: false
|
151
|
-
t.datetime "created_at", null: false
|
152
|
-
t.datetime "updated_at", null: false
|
153
|
-
end
|
154
|
-
|
155
|
-
create_table "snf_core_wallets", force: :cascade do |t|
|
156
|
-
t.bigint "user_id", null: false
|
157
|
-
t.string "wallet_number", null: false
|
158
|
-
t.decimal "balance", null: false
|
159
|
-
t.boolean "is_active", default: true, null: false
|
160
|
-
t.datetime "created_at", null: false
|
161
|
-
t.datetime "updated_at", null: false
|
162
|
-
t.index [ "user_id" ], name: "index_snf_core_wallets_on_user_id"
|
163
|
-
t.index [ "wallet_number" ], name: "index_snf_core_wallets_on_wallet_number", unique: true
|
164
|
-
end
|
165
|
-
|
166
|
-
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
167
|
-
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
168
|
-
add_foreign_key "snf_core_business_documents", "snf_core_businesses", column: "business_id"
|
169
|
-
add_foreign_key "snf_core_business_documents", "snf_core_users", column: "verified_by_id"
|
170
|
-
add_foreign_key "snf_core_businesses", "snf_core_users", column: "user_id"
|
171
|
-
add_foreign_key "snf_core_categories", "snf_core_categories", column: "parent_id"
|
172
|
-
add_foreign_key "snf_core_customer_groups", "snf_core_groups", column: "group_id"
|
173
|
-
add_foreign_key "snf_core_customer_groups", "snf_core_users", column: "customer_id"
|
174
|
-
add_foreign_key "snf_core_groups", "snf_core_businesses", column: "business_id"
|
175
|
-
add_foreign_key "snf_core_products", "snf_core_categories", column: "category_id"
|
176
|
-
add_foreign_key "snf_core_store_inventories", "snf_core_products", column: "product_id"
|
177
|
-
add_foreign_key "snf_core_store_inventories", "snf_core_stores", column: "store_id"
|
178
|
-
add_foreign_key "snf_core_stores", "snf_core_addresses", column: "address_id"
|
179
|
-
add_foreign_key "snf_core_stores", "snf_core_businesses", column: "business_id"
|
180
|
-
add_foreign_key "snf_core_wallets", "snf_core_users", column: "user_id"
|
181
|
-
end
|