Skip to content

Commit

Permalink
Add anonymous_access_codes and execute its install steps (#294)
Browse files Browse the repository at this point in the history
* Add anonymous_access_codes and execute its install steps

* Fix reviewdog comments
  • Loading branch information
Robin481 authored Jun 25, 2024
1 parent f0285b5 commit 83d915f
Show file tree
Hide file tree
Showing 8 changed files with 1,022 additions and 398 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem 'decidim-initiatives', DECIDIM_VERSION
gem 'decidim-proposals', DECIDIM_VERSION
gem 'decidim-templates', DECIDIM_VERSION

gem 'decidim-anonymous_codes', github: 'openpoke/decidim-module-anonymous_codes'
gem 'decidim-antivirus', github: 'mainio/decidim-module-antivirus', branch: 'release/0.27-stable'
gem 'decidim-decidim_awesome', github: 'decidim-ice/decidim-module-decidim_awesome'
gem 'decidim-jitsi_meetings', github: 'puzzle/decidim-module-jitsi-meetings', branch: DECIDIM_VERSION
Expand Down Expand Up @@ -63,3 +64,5 @@ end
group :production do
gem 'bleib'
end

gem 'dotenv', '~> 3.1'
16 changes: 15 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ GIT
decidim-admin (~> 0.27.0)
decidim-core (~> 0.27.0)

GIT
remote: https://github.com/openpoke/decidim-module-anonymous_codes.git
revision: 1b7f6d8d73a3cb72d915445e006c8e2a88c692cb
specs:
decidim-anonymous_codes (1.0)
decidim-admin (>= 0.27.0, < 0.28)
decidim-core (>= 0.27.0, < 0.28)
decidim-forms (>= 0.27.0, < 0.28)
decidim-surveys (>= 0.27.0, < 0.28)
deface (>= 1.9.0)

GIT
remote: https://github.com/openpoke/decidim-module-participatory-documents.git
revision: 76957bf7bbceb3235eb912b64361ed4a4e521f8a
Expand Down Expand Up @@ -486,6 +497,7 @@ GEM
doorkeeper (5.6.9)
railties (>= 5)
doorkeeper-i18n (4.0.1)
dotenv (3.1.0)
dumb_delegator (1.0.0)
e2mmap (0.1.0)
erb_lint (0.0.37)
Expand Down Expand Up @@ -1002,6 +1014,7 @@ DEPENDENCIES
byebug
dalli
decidim (= 0.27.5)
decidim-anonymous_codes!
decidim-antivirus!
decidim-conferences (= 0.27.5)
decidim-decidim_awesome!
Expand All @@ -1017,6 +1030,7 @@ DEPENDENCIES
decidim-templates (= 0.27.5)
decidim-term_customizer!
delayed_job_active_record
dotenv (~> 3.1)
execjs
faker
letter_opener_web
Expand All @@ -1038,4 +1052,4 @@ RUBY VERSION
ruby 3.0.6p216

BUNDLED WITH
2.5.6
2.5.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true
# This migration comes from decidim_anonymous_codes (originally 20240403091336)

class CreateDecidimAnonymousCodesGroups < ActiveRecord::Migration[6.1]
def change
create_table :decidim_anonymous_codes_groups do |t|
t.jsonb :title

t.datetime :expires_at
t.boolean :active, default: true, null: false
t.integer :max_reuses, default: 1, null: false
t.integer :tokens_count, default: 0, null: false
t.references :resource, polymorphic: true, null: true, index: { name: "decidim_anonymous_codes_groups_on_resource" }
t.references :decidim_organization, null: false, foreign_key: true, index: { name: "decidim_anonymous_codes_groups_on_organization" }

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true
# This migration comes from decidim_anonymous_codes (originally 20240403091356)

class CreateDecidimAnonymousCodesTokens < ActiveRecord::Migration[6.1]
def change
create_table :decidim_anonymous_codes_tokens do |t|
t.string :token, null: false
t.integer :usage_count, default: 0, null: false

t.references :group, null: false, index: { name: "decidim_anonymous_codes_tokens_on_group" }
t.index [:token, :group_id], name: "index_anonymous_codes_token_group_uniqueness", unique: true
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true
# This migration comes from decidim_anonymous_codes (originally 20240403091376)

class CreateDecidimAnonymousCodesTokenResources < ActiveRecord::Migration[6.1]
def change
create_table :decidim_anonymous_codes_token_resources do |t|
t.references :token, null: false, index: { name: "decidim_anonymous_codes_token_resources_on_token" }
t.references :resource, polymorphic: true, null: false, index: { name: "decidim_anonymous_codes_token_resources_on_resource" }
t.timestamps
end
end
end
38 changes: 37 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_02_22_103255) do
ActiveRecord::Schema.define(version: 2024_06_25_091114) do

# These are extensions that must be enabled in order to support this database
enable_extension "ltree"
Expand Down Expand Up @@ -135,6 +135,41 @@
t.index ["state"], name: "index_decidim_amendments_on_state"
end

create_table "decidim_anonymous_codes_groups", force: :cascade do |t|
t.jsonb "title"
t.datetime "expires_at"
t.boolean "active", default: true, null: false
t.integer "max_reuses", default: 1, null: false
t.integer "tokens_count", default: 0, null: false
t.string "resource_type"
t.bigint "resource_id"
t.bigint "decidim_organization_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["decidim_organization_id"], name: "decidim_anonymous_codes_groups_on_organization"
t.index ["resource_type", "resource_id"], name: "decidim_anonymous_codes_groups_on_resource"
end

create_table "decidim_anonymous_codes_token_resources", force: :cascade do |t|
t.bigint "token_id", null: false
t.string "resource_type", null: false
t.bigint "resource_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["resource_type", "resource_id"], name: "decidim_anonymous_codes_token_resources_on_resource"
t.index ["token_id"], name: "decidim_anonymous_codes_token_resources_on_token"
end

create_table "decidim_anonymous_codes_tokens", force: :cascade do |t|
t.string "token", null: false
t.integer "usage_count", default: 0, null: false
t.bigint "group_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["group_id"], name: "decidim_anonymous_codes_tokens_on_group"
t.index ["token", "group_id"], name: "index_anonymous_codes_token_group_uniqueness", unique: true
end

create_table "decidim_area_types", force: :cascade do |t|
t.bigint "decidim_organization_id"
t.jsonb "name", null: false
Expand Down Expand Up @@ -2242,6 +2277,7 @@

add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "decidim_anonymous_codes_groups", "decidim_organizations"
add_foreign_key "decidim_area_types", "decidim_organizations"
add_foreign_key "decidim_areas", "decidim_area_types", column: "area_type_id"
add_foreign_key "decidim_areas", "decidim_organizations"
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "app",
"private": true,
"dependencies": {
"@decidim/browserslist-config": "^0.27.5",
"@decidim/core": "^0.27.5",
"@decidim/elections": "^0.27.5",
"@decidim/webpacker": "^0.27.5",
"@geoman-io/leaflet-geoman-free": "^2.16.0",
"@decidim/browserslist-config": "^0.27.6",
"@decidim/core": "^0.27.6",
"@decidim/elections": "^0.27.6",
"@decidim/webpacker": "^0.27.6",
"@geoman-io/leaflet-geoman-free": "^2.17.0",
"codemirror": "^5.65.13",
"esri-leaflet": "^2.5.0",
"europa": "^4.0.0",
Expand All @@ -19,7 +19,7 @@
"jquery-form": "^4.3.0",
"jquery-ui": "^1.13.2",
"jsrender": "^1.0.13",
"jsviews": "^1.0.13",
"jsviews": "^1.0.14",
"leaflet": "^1.8.0",
"leaflet-svgicon": "^0.0.2",
"leaflet-tilelayer-swiss": "^2.2.1",
Expand Down Expand Up @@ -47,9 +47,9 @@
"@babel/plugin-transform-runtime": "^7.22.6",
"@babel/preset-env": "^7.22.6",
"@babel/preset-react": "^7.22.5",
"@decidim/dev": "^0.27.5",
"@decidim/eslint-config": "^0.27.5",
"@decidim/stylelint-config": "^0.27.5",
"@decidim/dev": "^0.27.6",
"@decidim/eslint-config": "^0.27.6",
"@decidim/stylelint-config": "^0.27.6",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-standard": "^11.0.0",
Expand Down
Loading

0 comments on commit 83d915f

Please sign in to comment.