discourse_subscription_client 0.1.0.pre3 → 0.1.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/jobs/regular/{discourse_subscription_client/find_resources.rb → discourse_subscription_client_find_resources.rb} +1 -1
- data/app/jobs/scheduled/{discourse_subscription_client/update_notices.rb → discourse_subscription_client_update_notices.rb} +1 -1
- data/app/jobs/scheduled/{discourse_subscription_client/update_subscriptions.rb → discourse_subscription_client_update_subscriptions.rb} +1 -1
- data/app/models/subscription_client_notice.rb +1 -2
- data/app/models/subscription_client_supplier.rb +1 -1
- data/db/migrate/{20220318160955_create_subscription_client_suppliers.rb → 20230221100514_create_subscription_client_suppliers.rb} +3 -3
- data/db/migrate/{20220318181029_create_subscription_client_resources.rb → 20230221100524_create_subscription_client_resources.rb} +3 -3
- data/db/migrate/{20220318181054_create_subscription_client_notices.rb → 20230221100529_create_subscription_client_notices.rb} +3 -3
- data/db/migrate/{20220318181140_create_subscription_client_subscriptions.rb → 20230221100535_create_subscription_client_subscriptions.rb} +4 -3
- data/db/migrate/{20230220130259_create_subscription_client_requests.rb → 20230221100540_create_subscription_client_requests.rb} +1 -1
- data/lib/discourse_subscription_client/engine.rb +5 -5
- data/lib/discourse_subscription_client/version.rb +1 -1
- metadata +26 -13
- data/Rakefile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3754b250f1d7f886ad692fbca23aaf8d8201e392634d21c408574064022d521
|
4
|
+
data.tar.gz: bb5cd215e0d40c5b8f9f384731c63b181373ec105dbc603d139e921a59c775c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38b5f3b3202db51457f94c192e0067bd110605ea67f5f5655b5f17e1e7fad7935eab9175ef94a580e2141a83fd1b389e72a656ff2a10593f4d2ee61507f7ee47
|
7
|
+
data.tar.gz: 28b45aff5ff1a80bcd1d10e22d1424ad9bbd43645e00368af653221760b53c74a10c059bc787d3ee5d61c065847a38b6da369589310c83e04727a3aeb67d01b5
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Jobs
|
4
|
-
class
|
4
|
+
class DiscourseSubscriptionClientFindResources < ::Jobs::Base
|
5
5
|
def execute(_args = {})
|
6
6
|
::DiscourseSubscriptionClient::Resources.find_all unless Rails.env.test?
|
7
7
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class SubscriptionClientNotice < ActiveRecord::Base
|
4
|
-
belongs_to :notice_subject, polymorphic: true
|
5
|
-
delegate :name, to: :subject
|
4
|
+
belongs_to :notice_subject, polymorphic: true, optional: true
|
6
5
|
|
7
6
|
scope :warnings, -> { where(notice_type: SubscriptionClientNotice.types[:warning]) }
|
8
7
|
scope :hidden, -> { where("hidden_at IS NOT NULL AND dismissed_at IS NULL AND expired_at IS NULL") }
|
@@ -5,7 +5,7 @@ class SubscriptionClientSupplier < ActiveRecord::Base
|
|
5
5
|
has_many :subscriptions, through: :resources
|
6
6
|
has_many :notices, class_name: "SubscriptionClientNotice", as: :notice_subject, dependent: :destroy
|
7
7
|
|
8
|
-
belongs_to :user
|
8
|
+
belongs_to :user, optional: true
|
9
9
|
|
10
10
|
scope :authorized, -> { where("api_key IS NOT NULL") }
|
11
11
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
|
-
create_table :subscription_client_suppliers do |t|
|
5
|
+
create_table :subscription_client_suppliers, if_not_exists: true do |t|
|
6
6
|
t.string :name
|
7
7
|
t.string :url, null: false
|
8
8
|
t.string :api_key
|
@@ -12,6 +12,6 @@ class CreateSubscriptionClientSuppliers < ActiveRecord::Migration[6.1]
|
|
12
12
|
t.timestamps
|
13
13
|
end
|
14
14
|
|
15
|
-
add_index :subscription_client_suppliers, [:url], unique: true
|
15
|
+
add_index :subscription_client_suppliers, [:url], unique: true, if_not_exists: true
|
16
16
|
end
|
17
17
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientResources < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientResources < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
|
-
create_table :subscription_client_resources do |t|
|
5
|
+
create_table :subscription_client_resources, if_not_exists: true do |t|
|
6
6
|
t.references :supplier, foreign_key: { to_table: :subscription_client_suppliers }
|
7
7
|
t.string :name, null: false
|
8
8
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
11
11
|
|
12
|
-
add_index :subscription_client_resources, %i[supplier_id name], unique: true
|
12
|
+
add_index :subscription_client_resources, %i[supplier_id name], unique: true, if_not_exists: true
|
13
13
|
end
|
14
14
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientNotices < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientNotices < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
|
-
create_table :subscription_client_notices do |t|
|
5
|
+
create_table :subscription_client_notices, if_not_exists: true do |t|
|
6
6
|
t.string :title, null: false
|
7
7
|
t.string :message
|
8
8
|
t.integer :notice_type, null: false
|
@@ -17,6 +17,6 @@ class CreateSubscriptionClientNotices < ActiveRecord::Migration[6.1]
|
|
17
17
|
end
|
18
18
|
|
19
19
|
add_index :subscription_client_notices, %i[notice_type notice_subject_type notice_subject_id changed_at],
|
20
|
-
unique: true, name: "sc_unique_notices"
|
20
|
+
unique: true, name: "sc_unique_notices", if_not_exists: true
|
21
21
|
end
|
22
22
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[
|
3
|
+
class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
|
-
create_table :subscription_client_subscriptions do |t|
|
5
|
+
create_table :subscription_client_subscriptions, if_not_exists: true do |t|
|
6
6
|
t.references :resource, foreign_key: { to_table: :subscription_client_resources }
|
7
7
|
t.string :product_id, null: false
|
8
8
|
t.string :product_name
|
@@ -14,6 +14,7 @@ class CreateSubscriptionClientSubscriptions < ActiveRecord::Migration[6.1]
|
|
14
14
|
end
|
15
15
|
|
16
16
|
add_index :subscription_client_subscriptions, %i[resource_id product_id price_id], unique: true,
|
17
|
-
name: "sc_unique_subscriptions"
|
17
|
+
name: "sc_unique_subscriptions",
|
18
|
+
if_not_exists: true
|
18
19
|
end
|
19
20
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class CreateSubscriptionClientRequests < ActiveRecord::Migration[7.0]
|
4
4
|
def change
|
5
|
-
create_table :subscription_client_requests do |t|
|
5
|
+
create_table :subscription_client_requests, if_not_exists: true do |t|
|
6
6
|
t.bigint :request_id
|
7
7
|
t.string :request_type
|
8
8
|
t.datetime :expired_at
|
@@ -14,7 +14,7 @@ module DiscourseSubscriptionClient
|
|
14
14
|
config.after_initialize do
|
15
15
|
gem_root = File.expand_path("../..", __dir__)
|
16
16
|
|
17
|
-
ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate"
|
17
|
+
ActiveRecord::Tasks::DatabaseTasks.migrations_paths << "#{gem_root}/db/migrate" unless Rails.env.test?
|
18
18
|
|
19
19
|
%w[
|
20
20
|
./request
|
@@ -35,16 +35,16 @@ module DiscourseSubscriptionClient
|
|
35
35
|
../../app/serializers/discourse_subscription_client/resource_serializer
|
36
36
|
../../app/serializers/discourse_subscription_client/notice_serializer
|
37
37
|
../../app/serializers/discourse_subscription_client/subscription_serializer
|
38
|
-
../../app/jobs/regular/
|
39
|
-
../../app/jobs/scheduled/
|
40
|
-
../../app/jobs/scheduled/
|
38
|
+
../../app/jobs/regular/discourse_subscription_client_find_resources
|
39
|
+
../../app/jobs/scheduled/discourse_subscription_client_update_subscriptions
|
40
|
+
../../app/jobs/scheduled/discourse_subscription_client_update_notices
|
41
41
|
../../extensions/discourse_subscription_client/current_user
|
42
42
|
../../extensions/discourse_subscription_client/guardian
|
43
43
|
].each do |path|
|
44
44
|
require_relative path
|
45
45
|
end
|
46
46
|
|
47
|
-
Jobs.enqueue(:
|
47
|
+
Jobs.enqueue(:discourse_subscription_client_find_resources) if DiscourseSubscriptionClient.database_exists? && !Rails.env.test?
|
48
48
|
|
49
49
|
Rails.application.routes.append do
|
50
50
|
mount DiscourseSubscriptionClient::Engine, at: "/admin/plugins/subscription-client"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_subscription_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angus McLeod
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pg
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rails
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +179,7 @@ dependencies:
|
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
182
|
+
name: sprockets-rails
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - ">="
|
@@ -179,7 +193,7 @@ dependencies:
|
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
196
|
+
name: webmock
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - ">="
|
@@ -202,16 +216,15 @@ files:
|
|
202
216
|
- COPYRIGHT.txt
|
203
217
|
- LICENSE.txt
|
204
218
|
- README.md
|
205
|
-
- Rakefile
|
206
219
|
- app/assets/config/discourse_subscription_client_manifest.js
|
207
220
|
- app/assets/stylesheets/discourse_subscription_client/application.css
|
208
221
|
- app/controllers/discourse_subscription_client/admin_controller.rb
|
209
222
|
- app/controllers/discourse_subscription_client/notices_controller.rb
|
210
223
|
- app/controllers/discourse_subscription_client/subscriptions_controller.rb
|
211
224
|
- app/controllers/discourse_subscription_client/suppliers_controller.rb
|
212
|
-
- app/jobs/regular/
|
213
|
-
- app/jobs/scheduled/
|
214
|
-
- app/jobs/scheduled/
|
225
|
+
- app/jobs/regular/discourse_subscription_client_find_resources.rb
|
226
|
+
- app/jobs/scheduled/discourse_subscription_client_update_notices.rb
|
227
|
+
- app/jobs/scheduled/discourse_subscription_client_update_subscriptions.rb
|
215
228
|
- app/models/subscription_client_notice.rb
|
216
229
|
- app/models/subscription_client_request.rb
|
217
230
|
- app/models/subscription_client_resource.rb
|
@@ -224,11 +237,11 @@ files:
|
|
224
237
|
- config/locales/server.en.yml
|
225
238
|
- config/routes.rb
|
226
239
|
- config/settings.yml
|
227
|
-
- db/migrate/
|
228
|
-
- db/migrate/
|
229
|
-
- db/migrate/
|
230
|
-
- db/migrate/
|
231
|
-
- db/migrate/
|
240
|
+
- db/migrate/20230221100514_create_subscription_client_suppliers.rb
|
241
|
+
- db/migrate/20230221100524_create_subscription_client_resources.rb
|
242
|
+
- db/migrate/20230221100529_create_subscription_client_notices.rb
|
243
|
+
- db/migrate/20230221100535_create_subscription_client_subscriptions.rb
|
244
|
+
- db/migrate/20230221100540_create_subscription_client_requests.rb
|
232
245
|
- extensions/discourse_subscription_client/current_user.rb
|
233
246
|
- extensions/discourse_subscription_client/guardian.rb
|
234
247
|
- lib/discourse_subscription_client.rb
|
data/Rakefile
DELETED