diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..c99d2e7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile index b9e7252..1180548 100644 --- a/Gemfile +++ b/Gemfile @@ -8,11 +8,20 @@ gem 'puma' gem 'pg' +gem "image_processing", ">= 1.2" + +gem "sprockets-rails" gem 'sprockets-rails' group :development, :test do gem 'rubocop', require: false end +group :development, :test do + gem 'rspec-rails' +end +gem 'rails-controller-testing', '~> 1.0', '>= 1.0.5' + + # Start debugger with binding.b [https://github.com/ruby/debug] # gem "debug", ">= 1.0.0" diff --git a/Gemfile.lock b/Gemfile.lock index f549c0e..a06de5c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,6 +88,7 @@ GEM connection_pool (2.4.1) crass (1.0.6) date (3.3.3) + diff-lcs (1.5.0) drb (2.1.1) ruby2_keywords erubi (1.12.0) @@ -95,6 +96,9 @@ GEM activesupport (>= 6.1) i18n (1.14.1) concurrent-ruby (~> 1.0) + image_processing (1.12.2) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) io-console (0.6.0) irb (1.8.3) rdoc @@ -110,6 +114,7 @@ GEM net-pop net-smtp marcel (1.0.2) + mini_magick (4.12.0) mini_mime (1.1.5) minitest (5.20.0) mutex_m (0.1.2) @@ -157,6 +162,10 @@ GEM activesupport (= 7.1.1) bundler (>= 1.15.0) railties (= 7.1.1) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -179,22 +188,25 @@ GEM regexp_parser (2.8.2) reline (0.3.9) io-console (~> 0.5) - rexml (3.2.6) - rubocop (1.57.1) - base64 (~> 0.1.1) - json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) - parser (>= 3.2.2.4) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - ruby-progressbar (1.13.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-rails (5.1.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.12.1) + ruby-vips (2.1.4) + ffi (~> 1.12) ruby2_keywords (0.0.5) sprockets (4.2.1) concurrent-ruby (~> 1.0) @@ -220,9 +232,12 @@ PLATFORMS DEPENDENCIES activejob-web! + image_processing (>= 1.2) pg puma rubocop + rails-controller-testing (~> 1.0, >= 1.0.5) + rspec-rails sprockets-rails BUNDLED WITH diff --git a/activejob-web.gemspec b/activejob-web.gemspec index 2db4660..fa72751 100644 --- a/activejob-web.gemspec +++ b/activejob-web.gemspec @@ -1,27 +1,27 @@ -require_relative 'lib/activejob/web/version' +require_relative "lib/activejob/web/version" Gem::Specification.new do |spec| spec.name = 'activejob-web' spec.version = Activejob::Web::VERSION - spec.authors = %w[gowtham mohammednazeer] - spec.email = %w[gowtham.kuppusamy@mallow-tech.com mohammednazeer@mallow-tech.com] - spec.homepage = 'TODO' - spec.summary = 'TODO: Summary of Activejob::Web.' - spec.description = 'TODO: Description of Activejob::Web.' - spec.license = 'MIT' + spec.authors = ["mohammednazeer"] + spec.email = ["mohammednazeer@mallow-tech.com"] + spec.homepage = 'https://example.com' + spec.summary = "Summary of Activejob::Web." + spec.description = "Description of Activejob::Web." + spec.license = "MIT" # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host" # to allow pushing to a single host or delete this section to allow pushing to any host. - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" + spec.metadata["allowed_push_host"] = 'http://mygemserver.com' - spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['source_code_uri'] = "TODO: Put your gem's public repo URL here." - spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here." + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = 'https://example.com' + spec.metadata["changelog_uri"] = 'https://example.com' spec.files = Dir.chdir(File.expand_path(__dir__)) do - Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] + Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] end - spec.required_ruby_version = '>= 3.2.2' - spec.add_dependency 'rails', '>= 7.0.8' + spec.add_dependency "rails", ">= 7.0.8" + spec.add_development_dependency 'rspec-rails' end diff --git a/app/assets/images/activejob/web/sample.png b/app/assets/images/activejob/web/sample.png new file mode 100644 index 0000000..3b5aaf2 Binary files /dev/null and b/app/assets/images/activejob/web/sample.png differ diff --git a/app/controllers/activejob_web/jobs_controller.rb b/app/controllers/activejob_web/jobs_controller.rb new file mode 100644 index 0000000..c9454f3 --- /dev/null +++ b/app/controllers/activejob_web/jobs_controller.rb @@ -0,0 +1,19 @@ +class ActivejobWeb::JobsController < ApplicationController + + def index + @jobs = ActivejobWeb::Job.all + end + + def show + @job = ActivejobWeb::Job.find(params[:id]) + end + + def download_pdf + if @job.template_file.attached? + send_file @job.template_file.download + else + flash[:error] = "Template file not found." + redirect_to @job + end + end +end diff --git a/app/helpers/activejob_web/jobs_helper.rb b/app/helpers/activejob_web/jobs_helper.rb new file mode 100644 index 0000000..1712e5b --- /dev/null +++ b/app/helpers/activejob_web/jobs_helper.rb @@ -0,0 +1,2 @@ +module ActivejobWeb::JobsHelper +end diff --git a/app/models/activejob_web.rb b/app/models/activejob_web.rb new file mode 100644 index 0000000..0dd4bde --- /dev/null +++ b/app/models/activejob_web.rb @@ -0,0 +1,5 @@ +module ActivejobWeb + def self.table_name_prefix + "activejob_web_" + end +end diff --git a/app/models/activejob_web/job.rb b/app/models/activejob_web/job.rb new file mode 100644 index 0000000..89b9b08 --- /dev/null +++ b/app/models/activejob_web/job.rb @@ -0,0 +1,16 @@ +class ActivejobWeb::Job < ApplicationRecord + self.primary_key = 'id' + # Validations + validates :title, presence: true, length: { maximum: 255 } # Maximum 255 characters for title + validates :description, presence: true, length: { maximum: 1000 } # Maximum 1000 characters for description + # The input_arguments is optional, so no validation needed + # Default value for queue + after_initialize :set_default_queue + has_one_attached :template_file + private + # Default value for queue + def set_default_queue + self.queue ||= 'default' # Set your desired default value for the queue attribute + end +end + diff --git a/app/views/activejob_web/jobs/index.html.erb b/app/views/activejob_web/jobs/index.html.erb new file mode 100644 index 0000000..5a36384 --- /dev/null +++ b/app/views/activejob_web/jobs/index.html.erb @@ -0,0 +1,24 @@ +
| Title | +Description | +ID | +queue | +Actions | +
|---|---|---|---|---|
| <%= job.title %> | +<%= job.description %> | +<%= job.id %> | +<%= job.queue %> | +<%= link_to 'Show', activejob_web_job_path(job) %> | +
Description: <%= @job.description %>
+Input Arguments: <%= @job.input_arguments %>
+Max Run Time: <%= @job.max_run_time %>
+Minimum Approvals Required: <%= @job.minimum_approvals_required %>
+Priority: <%= @job.priority %>
+Queue: <%= @job.queue %>
+<% if @job.template_file.attached? %> + <%= link_to "Download PDF", rails_blob_path(@job.template_file, disposition: "attachment"), class: "btn btn-primary" %> +<% else %> +no template available
+<% end %> +<%= link_to 'Back', activejob_web_jobs_path %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 643baa7..bc0511c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,11 @@ Rails.application.routes.draw do - # Defines the root path route ("/") + namespace :activejob_web do + root 'jobs#index' + resources :jobs do + member do + get :download_pdf + end + end + end + end diff --git a/db/migrate/20231030135059_create_activejob_web_jobs.rb b/db/migrate/20231030135059_create_activejob_web_jobs.rb new file mode 100644 index 0000000..9942f72 --- /dev/null +++ b/db/migrate/20231030135059_create_activejob_web_jobs.rb @@ -0,0 +1,14 @@ +class CreateActivejobWebJobs < ActiveRecord::Migration[7.1] + def change + create_table :activejob_web_jobs do |t| + t.string :title + t.string :description + t.json :input_arguments + t.integer :max_run_time + t.integer :minimum_approvals_required + t.integer :priority + t.string :queue + t.timestamps + end + end +end diff --git a/db/migrate/20231030135457_change_primary_key_to_uuid.rb b/db/migrate/20231030135457_change_primary_key_to_uuid.rb new file mode 100644 index 0000000..483a140 --- /dev/null +++ b/db/migrate/20231030135457_change_primary_key_to_uuid.rb @@ -0,0 +1,11 @@ +class ChangePrimaryKeyToUuid < ActiveRecord::Migration[7.1] + def up + remove_column :activejob_web_jobs, :id + add_column :activejob_web_jobs, :id, :uuid, default: 'gen_random_uuid()', primary_key: true + end + + def down + remove_column :activejob_web_jobs, :id + add_column :activejob_web_jobs, :id, :primary_key + end +end diff --git a/db/migrate/20231030145254_create_active_storage_tables.active_storage.rb b/db/migrate/20231030145254_create_active_storage_tables.active_storage.rb new file mode 100644 index 0000000..3781086 --- /dev/null +++ b/db/migrate/20231030145254_create_active_storage_tables.active_storage.rb @@ -0,0 +1,62 @@ +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[7.0] + def change + unless table_exists?(:active_storage_blobs) + create_table :active_storage_blobs, id: primary_key_type do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.string :service_name, null: false + t.bigint :byte_size, null: false + t.string :checksum + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :key ], unique: true + end + end + # Use Active Record's configured type for primary and foreign keys + primary_key_type, foreign_key_type = primary_and_foreign_key_types + + unless table_exists?(:active_storage_attachments) + create_table :active_storage_attachments, id: primary_key_type do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type + t.references :blob, null: false, type: foreign_key_type + + if connection.supports_datetime_with_precision? + t.datetime :created_at, precision: 6, null: false + else + t.datetime :created_at, null: false + end + + t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + unless table_exists?(:active_storage_variant_records) + create_table :active_storage_variant_records, id: primary_key_type do |t| + t.belongs_to :blob, null: false, index: false, type: foreign_key_type + t.string :variation_digest, null: false + + t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + end + + private + def primary_and_foreign_key_types + config = Rails.configuration.generators + setting = config.options[config.orm][:primary_key_type] + primary_key_type = setting || :primary_key + foreign_key_type = setting || :bigint + [primary_key_type, foreign_key_type] + end +end diff --git a/lib/activejob/web.rb b/lib/activejob/web.rb index cb94080..e651731 100644 --- a/lib/activejob/web.rb +++ b/lib/activejob/web.rb @@ -3,6 +3,5 @@ module Activejob module Web - # Your code goes here... end end diff --git a/spec/helpers/activejob_web/jobs_helper_spec.rb b/spec/helpers/activejob_web/jobs_helper_spec.rb new file mode 100644 index 0000000..3764efc --- /dev/null +++ b/spec/helpers/activejob_web/jobs_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the ActivejobWeb::JobsHelper. For example: +# +# describe ActivejobWeb::JobsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe ActivejobWeb::JobsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/activejob_web/job_spec.rb b/spec/models/activejob_web/job_spec.rb new file mode 100644 index 0000000..3efaa53 --- /dev/null +++ b/spec/models/activejob_web/job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ActivejobWeb::Job, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..3ba12de --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,64 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +require 'spec_helper' +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../test/dummy/config/environment', __FILE__) +# Prevent database truncation if the environment is production +abort("The Rails environment is running in production mode!") if Rails.env.production? +require 'rspec/rails' +# Add additional requires below this line. Rails is not loaded until this point! + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +# +# The following line is provided for convenience purposes. It has the downside +# of increasing the boot-up time by auto-requiring all files in the support +# directory. Alternatively, in the individual `*_spec.rb` files, manually +# require only the support files necessary. +# +# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } + +# Checks for pending migrations and applies them before tests are run. +# If you are not using ActiveRecord, you can remove these lines. +begin + ActiveRecord::Migration.maintain_test_schema! +rescue ActiveRecord::PendingMigrationError => e + puts e.to_s.strip + exit 1 +end +RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # You can uncomment this line to turn off ActiveRecord support entirely. + # config.use_active_record = false + + # RSpec Rails can automatically mix in different behaviours to your tests + # based on their file location, for example enabling you to call `get` and + # `post` in specs under `spec/controllers`. + # + # You can disable this behaviour by removing the line below, and instead + # explicitly tag your specs with their type, e.g.: + # + # RSpec.describe UsersController, type: :controller do + # # ... + # end + # + # The different available types are documented in the features, such as in + # https://relishapp.com/rspec/rspec-rails/docs + config.infer_spec_type_from_file_location! + + # Filter lines from Rails gems in backtraces. + config.filter_rails_from_backtrace! + # arbitrary gems may also be filtered via: + # config.filter_gems_from_backtrace("gem name") +end diff --git a/spec/requests/activejob_web/jobs_spec.rb b/spec/requests/activejob_web/jobs_spec.rb new file mode 100644 index 0000000..08b6e1f --- /dev/null +++ b/spec/requests/activejob_web/jobs_spec.rb @@ -0,0 +1,23 @@ +require 'rails_helper' + +RSpec.describe "ActivejobWeb::Jobs", type: :request do + describe "GET /index" do + context 'returns a successful response' do + it 'Valid index' do + get activejob_web_jobs_path + expect(response).to render_template('index') + expect(response).to have_http_status 200 + end + end + end + describe 'GET #show' do + context 'returns a successful response' do + it 'Valid show' do + data = ActivejobWeb::Job.create(title: "Test1", description: "Test description") + get activejob_web_job_path(data.id) + expect(response).to render_template('show') + expect(response).to have_http_status 200 + end + end + end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..327b58e --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,94 @@ +# This file was generated by the `rails generate rspec:install` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # This allows you to limit a spec run to individual examples or groups + # you care about by tagging them with `:focus` metadata. When nothing + # is tagged with `:focus`, all examples get run. RSpec also provides + # aliases for `it`, `describe`, and `context` that include `:focus` + # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + config.filter_run_when_matching :focus + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ + config.disable_monkey_patching! + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = "doc" + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end diff --git a/test/controllers/activejob_web_jobs_controller_test.rb b/test/controllers/activejob_web_jobs_controller_test.rb new file mode 100644 index 0000000..767bfce --- /dev/null +++ b/test/controllers/activejob_web_jobs_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ActivejobWebJobsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml index e188530..f01a924 100644 --- a/test/dummy/config/database.yml +++ b/test/dummy/config/database.yml @@ -11,14 +11,14 @@ default: &default development: <<: *default - database: activejob_web_development + database: activejob_web_dev # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: activejob_web_test + database: activejob_web_testing production: <<: *default diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb new file mode 100644 index 0000000..c037468 --- /dev/null +++ b/test/dummy/db/schema.rb @@ -0,0 +1,59 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema[7.1].define(version: 2023_10_30_145254) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "active_storage_attachments", force: :cascade do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", force: :cascade do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.string "service_name", null: false + t.bigint "byte_size", null: false + t.string "checksum" + t.datetime "created_at", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + + create_table "active_storage_variant_records", force: :cascade do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + + create_table "activejob_web_jobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "title" + t.string "description" + t.json "input_arguments" + t.integer "max_run_time" + t.integer "minimum_approvals_required" + t.integer "priority" + t.string "queue" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + 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" +end diff --git a/test/dummy/db/seeds.rb b/test/dummy/db/seeds.rb new file mode 100644 index 0000000..ee11ad0 --- /dev/null +++ b/test/dummy/db/seeds.rb @@ -0,0 +1,49 @@ +10.times do |i| + job = ActivejobWeb::Job.new( + title: "Job Title #{i + 1}", + description: "Job Description #{i + 1}", + input_arguments: [ + { + "name": "File", + "type": "File", + "allowed_characters": "