snf_core 0.2.3 → 0.2.5

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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/lib/snf_core/engine.rb +1 -3
  3. data/lib/snf_core/version.rb +1 -1
  4. data/spec/dummy/Rakefile +6 -0
  5. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  6. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  7. data/spec/dummy/app/jobs/application_job.rb +7 -0
  8. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  9. data/spec/dummy/app/models/application_record.rb +3 -0
  10. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  11. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  12. data/spec/dummy/bin/dev +2 -0
  13. data/spec/dummy/bin/rails +4 -0
  14. data/spec/dummy/bin/rake +4 -0
  15. data/spec/dummy/bin/setup +34 -0
  16. data/spec/dummy/config/application.rb +43 -0
  17. data/spec/dummy/config/boot.rb +5 -0
  18. data/spec/dummy/config/cable.yml +10 -0
  19. data/spec/dummy/config/database.yml +20 -0
  20. data/spec/dummy/config/environment.rb +5 -0
  21. data/spec/dummy/config/environments/development.rb +67 -0
  22. data/spec/dummy/config/environments/production.rb +86 -0
  23. data/spec/dummy/config/environments/test.rb +53 -0
  24. data/spec/dummy/config/initializers/cors.rb +16 -0
  25. data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  26. data/spec/dummy/config/initializers/inflections.rb +16 -0
  27. data/spec/dummy/config/locales/en.yml +31 -0
  28. data/spec/dummy/config/puma.rb +38 -0
  29. data/spec/dummy/config/routes.rb +3 -0
  30. data/spec/dummy/config/storage.yml +38 -0
  31. data/spec/dummy/config.ru +6 -0
  32. data/spec/dummy/db/migrate/20250226123213_create_active_storage_tables.active_storage.rb +57 -0
  33. data/spec/dummy/db/schema.rb +181 -0
  34. data/spec/dummy/log/development.log +901 -0
  35. data/spec/dummy/log/test.log +12199 -0
  36. data/spec/dummy/spec/fixtures/files/sample.pdf +0 -0
  37. data/spec/dummy/tmp/local_secret.txt +1 -0
  38. data/spec/dummy/tmp/storage/13/1y/131yod70wqijazn3ix829yvuuvge +0 -0
  39. data/spec/dummy/tmp/storage/16/na/16na9nc1z98jt6fyn3axj3bhudes +0 -0
  40. data/spec/dummy/tmp/storage/1t/oy/1toyz0i6f9u5xexr4cpwttr04ood +0 -0
  41. data/spec/dummy/tmp/storage/1x/i3/1xi33eqr5ipoaz0upakb8yy7qc4o +0 -0
  42. data/spec/dummy/tmp/storage/24/69/2469t9kpepg4fd8ki960h025li0b +0 -0
  43. data/spec/dummy/tmp/storage/2a/0u/2a0uyihfk1wn5c1fuz09unocwy2m +0 -0
  44. data/spec/dummy/tmp/storage/4t/86/4t862kv9wcz0p7wgdvpmtmczdadt +0 -0
  45. data/spec/dummy/tmp/storage/5s/zb/5szbksq6mg3768g9vtk788gc49gw +0 -0
  46. data/spec/dummy/tmp/storage/6g/dc/6gdc40iivivwbln1zs4dqedt5ni7 +0 -0
  47. data/spec/dummy/tmp/storage/6o/7a/6o7ax3ihg25bswxp4d601mqo7tl3 +0 -0
  48. data/spec/dummy/tmp/storage/6z/86/6z862zpc67sikzl0otbf418t2clj +0 -0
  49. data/spec/dummy/tmp/storage/92/hw/92hw9u9j6728qgwpcn7oqphe9tzj +0 -0
  50. data/spec/dummy/tmp/storage/9a/3q/9a3qd5qc7j6dzzmg16wcpvwoowmp +0 -0
  51. data/spec/dummy/tmp/storage/al/8s/al8szf81ccm4ckpvxh3bv6vlgp0y +0 -0
  52. data/spec/dummy/tmp/storage/b8/8l/b88ln7wuq13v4akgwgc0dgac8887 +0 -0
  53. data/spec/dummy/tmp/storage/bs/y9/bsy9t4961ra8hwlq06wjtgrrcflp +0 -0
  54. data/spec/dummy/tmp/storage/cs/x9/csx9mv26ab1lm82a7itryfq4v6rq +0 -0
  55. data/spec/dummy/tmp/storage/dp/0f/dp0fx9ji1bqvx1najwjgns6n7fhf +0 -0
  56. data/spec/dummy/tmp/storage/em/kc/emkc4tc71k65mfcurv6k8z1ylswl +0 -0
  57. data/spec/dummy/tmp/storage/em/vx/emvx0c15o74mr0nlcvdc7m88j2gi +0 -0
  58. data/spec/dummy/tmp/storage/ga/7e/ga7eiyyv0llme2i4xby0kdp4a4h8 +0 -0
  59. data/spec/dummy/tmp/storage/h4/vg/h4vgoatz21dhjrztrrbg2hdhkwjb +0 -0
  60. data/spec/dummy/tmp/storage/hi/9h/hi9ho77symoy2j0ye28fxgnxw3kt +0 -0
  61. data/spec/dummy/tmp/storage/hl/yy/hlyyu150rt2yos1sa9ed1qw49y26 +0 -0
  62. data/spec/dummy/tmp/storage/j7/6x/j76x0oirv7i4t6p3blseuaknp7pw +0 -0
  63. data/spec/dummy/tmp/storage/jq/95/jq95rqhv5usgucn2d2mmkhjufapu +0 -0
  64. data/spec/dummy/tmp/storage/ky/1y/ky1ys68lmat11bxs2395dqugiyig +0 -0
  65. data/spec/dummy/tmp/storage/ln/0f/ln0fz4opsdycu80q7urfez9ar7kn +0 -0
  66. data/spec/dummy/tmp/storage/mk/4w/mk4w528bsn47ewri0odui9s40f87 +0 -0
  67. data/spec/dummy/tmp/storage/na/6r/na6rrohinrnjofsq27u95up5rp8k +0 -0
  68. data/spec/dummy/tmp/storage/oc/f8/ocf8zs18lm9fnkpqj6wpshdpyf43 +0 -0
  69. data/spec/dummy/tmp/storage/oe/bq/oebq593a6bpwkbxpx6segtwyy0jy +0 -0
  70. data/spec/dummy/tmp/storage/qs/jk/qsjkqiiarr85uobud0qsnnmpraol +0 -0
  71. data/spec/dummy/tmp/storage/qw/7z/qw7zsf91njf7ga6454nrjpvddjn5 +0 -0
  72. data/spec/dummy/tmp/storage/rh/0h/rh0h80b8er9vp1u8dcocy1u58obf +0 -0
  73. data/spec/dummy/tmp/storage/tc/gu/tcgurel05x9fk9ksm4hxwfla3hg3 +0 -0
  74. data/spec/dummy/tmp/storage/tm/ce/tmce54998rdnz191k02fzowpebvw +0 -0
  75. data/spec/dummy/tmp/storage/w2/3f/w23f3igzkn7bddqxry5x4wsu2ths +0 -0
  76. data/spec/dummy/tmp/storage/wo/81/wo813rsnwvoa55h0vq0fr79iajuw +0 -0
  77. data/spec/dummy/tmp/storage/wy/14/wy14megn3o5zqplv9xg6u32uwkr6 +0 -0
  78. data/spec/dummy/tmp/storage/xj/yy/xjyygdd3znvvpt9ufz1vv4lfsx3w +0 -0
  79. data/spec/dummy/tmp/storage/yf/49/yf49a4ydheqf3cqs0u49sanbl4ms +0 -0
  80. data/spec/dummy/tmp/storage/yh/q1/yhq1muao2dpuykmj12bxhd0x4ntk +0 -0
  81. data/spec/dummy/tmp/storage/yx/jp/yxjpumjyo1jysjpg20qaxgsqg4fw +0 -0
  82. data/spec/dummy/tmp/storage/z1/gr/z1grp34d5vw7mi4g8vw8yfu91ny2 +0 -0
  83. data/spec/examples.txt +66 -0
  84. data/spec/factories/snf_core/addresses.rb +10 -0
  85. data/spec/factories/snf_core/business_documents.rb +18 -0
  86. data/spec/factories/snf_core/businesses.rb +10 -0
  87. data/spec/factories/snf_core/categories.rb +7 -0
  88. data/spec/factories/snf_core/customer_groups.rb +9 -0
  89. data/spec/factories/snf_core/groups.rb +6 -0
  90. data/spec/factories/snf_core/products.rb +9 -0
  91. data/spec/factories/snf_core/store_inventories.rb +8 -0
  92. data/spec/factories/snf_core/stores.rb +9 -0
  93. data/spec/factories/snf_core/users.rb +10 -0
  94. data/spec/factories/snf_core/wallets.rb +7 -0
  95. data/spec/models/snf_core/address_spec.rb +15 -0
  96. data/spec/models/snf_core/business_document_spec.rb +20 -0
  97. data/spec/models/snf_core/business_spec.rb +14 -0
  98. data/spec/models/snf_core/category_spec.rb +12 -0
  99. data/spec/models/snf_core/customer_group_spec.rb +11 -0
  100. data/spec/models/snf_core/group_spec.rb +11 -0
  101. data/spec/models/snf_core/product_spec.rb +17 -0
  102. data/spec/models/snf_core/store_inventory_spec.rb +24 -0
  103. data/spec/models/snf_core/store_spec.rb +13 -0
  104. data/spec/models/snf_core/user_spec.rb +23 -0
  105. data/spec/models/snf_core/wallet_spec.rb +28 -0
  106. data/spec/rails_helper.rb +46 -0
  107. data/spec/sample_spec.rb +5 -0
  108. data/spec/spec_helper.rb +36 -0
  109. data/spec/support/models/shared_examples.rb +49 -0
  110. data/spec/support/requests/shared_requests.rb +130 -0
  111. metadata +108 -1
@@ -0,0 +1,57 @@
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
@@ -0,0 +1,181 @@
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