diff --git a/.annotaterb.yml b/.annotaterb.yml new file mode 100644 index 000000000..53ef9dc77 --- /dev/null +++ b/.annotaterb.yml @@ -0,0 +1,58 @@ +--- +:position: before +:position_in_additional_file_patterns: before +:position_in_class: before +:position_in_factory: before +:position_in_fixture: before +:position_in_routes: before +:position_in_serializer: before +:position_in_test: before +:classified_sort: true +:exclude_controllers: true +:exclude_factories: false +:exclude_fixtures: false +:exclude_helpers: true +:exclude_scaffolds: true +:exclude_serializers: false +:exclude_sti_subclasses: false +:exclude_tests: false +:force: false +:format_markdown: false +:format_rdoc: false +:format_yard: false +:frozen: false +:ignore_model_sub_dir: false +:ignore_unknown_models: false +:include_version: false +:show_check_constraints: false +:show_complete_foreign_keys: false +:show_foreign_keys: false +:show_indexes: false +:simple_indexes: false +:sort: false +:timestamp: false +:trace: false +:with_comment: true +:with_column_comments: true +:with_table_comments: true +:active_admin: false +:command: +:debug: false +:hide_default_column_types: '' +:hide_limit_column_types: '' +:ignore_columns: +:ignore_routes: +:models: true +:routes: false +:skip_on_db_migrate: false +:target_action: :do_annotations +:wrapper: +:wrapper_close: +:wrapper_open: +:classes_default_to_s: [] +:additional_file_patterns: [] +:model_dir: +- app/models +:require: [] +:root_dir: +- '' diff --git a/.dockerignore b/.dockerignore index 0a9ca6639..51709e0e0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,16 +1,60 @@ -.env -.env.test -.erb-lint.yml -.git/ +# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. + +# Ignore git directory. +/.git/ +/.gitignore .gitattributes -.github/ -.gitignore -.gitlab-ci.yml + +# Ignore bundler config. +/.bundle + +# Ignore all environment files. +/.env* + +# Ignore all default key files. +/config/master.key +/config/credentials/*.key + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +# Ignore pidfiles, but keep the directory. +/tmp/pids/* +!/tmp/pids/.keep + +# Ignore storage (uploaded files in development and any SQLite databases). +/storage/* +!/storage/.keep +/tmp/storage/* +!/tmp/storage/.keep + +# Ignore assets. +/node_modules/ +/app/assets/builds/* +!/app/assets/builds/.keep +/public/assets + +# Ignore CI service files. +/.github .gitlab/ +.gitlab-ci.yml +chart/ + +# Ignore development files +/.devcontainer + +# Ignore Docker-related files +/.dockerignore +/Dockerfile* + + +.erb-lint.yml .rubocop.yml .ruby-lsp .vscode/ -chart/ Procfile Procfile.debug Procfile.dev diff --git a/.gitlab/auto-deploy-values.yaml b/.gitlab/auto-deploy-values.yaml index 4cdf3888d..bc93bbed8 100644 --- a/.gitlab/auto-deploy-values.yaml +++ b/.gitlab/auto-deploy-values.yaml @@ -1,11 +1,11 @@ timeout: 120 service: - externalPort: 3000 - internalPort: 3000 + externalPort: 5000 + internalPort: 5000 image: secrets: - name: skdigital-bonet-registry -application.migrateCommand: ["bundle", "exec", "rails", "db:migrate"] +application.migrateCommand: ["bin/rails", "db:migrate"] ingress: annotations: nginx.ingress.kubernetes.io/proxy-body-size: 256m @@ -29,7 +29,7 @@ persistence: volumes: - name: govbox-pro-storage mount: - path: /app/storage + path: /rails/storage claim: accessMode: ReadWriteMany size: 10Gi @@ -37,7 +37,7 @@ persistence: workers: worker: replicaCount: "1" - command: ["bundle", "exec", "good_job", "start"] + command: ["bundle", "exec", "good_job", "start", "--probe-port=5000"] startupProbe: probeType: "httpGet" path: "/status/started" diff --git a/.gitlab/prod-auto-deploy-values.yaml b/.gitlab/prod-auto-deploy-values.yaml index 5656977e3..8ed3e4060 100644 --- a/.gitlab/prod-auto-deploy-values.yaml +++ b/.gitlab/prod-auto-deploy-values.yaml @@ -1,11 +1,11 @@ timeout: 120 service: - externalPort: 3000 - internalPort: 3000 + externalPort: 5000 + internalPort: 5000 image: secrets: - name: skdigital-bonet-registry -application.migrateCommand: ["bundle", "exec", "rails", "db:migrate"] +application.migrateCommand: ["bin/rails", "db:migrate"] ingress: annotations: nginx.ingress.kubernetes.io/proxy-body-size: 256m @@ -14,7 +14,7 @@ livenessProbe: timeoutSeconds: 5 probeType: "httpGet" path: "/health" -eadinessProbe: +readinessProbe: initialDelaySeconds: 5 timeoutSeconds: 10 probeType: "httpGet" @@ -29,7 +29,7 @@ persistence: volumes: - name: govbox-pro-storage mount: - path: /app/storage + path: /rails/storage claim: accessMode: ReadWriteMany size: 10Gi @@ -37,7 +37,7 @@ persistence: workers: worker: replicaCount: "1" - command: ["bundle", "exec", "good_job", "start"] + command: ["bundle", "exec", "good_job", "start", "--probe-port=5000"] startupProbe: probeType: "httpGet" path: "/status/started" diff --git a/.ruby-version b/.ruby-version index 15a279981..9c25013db 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.0 +3.3.6 diff --git a/.tool-versions b/.tool-versions index 02c5ae8a5..50fa0015f 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 3.3.0 +ruby 3.3.6 nodejs 20.10.0 diff --git a/Dockerfile b/Dockerfile index f81a91736..2743fc791 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,99 @@ -FROM ruby:3.3.0 +# syntax=docker/dockerfile:1 +# check=error=true -# Install packages -RUN apt-get update && apt-get install -y build-essential nodejs libpq-dev npm fop=1:2.* libsaxon-java libsaxonb-java chromium \ +# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand: +# docker build -t govbox-pro . +# docker run -d -p 80:80 -e RAILS_MASTER_KEY= --name govbox-pro govbox-pro + +# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html + +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version +ARG RUBY_VERSION=3.3.6 +FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base + +# Rails app lives here +WORKDIR /rails + +# Install base packages +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# > CUSTOM +# Install FOP and other packages +RUN apt-get update && apt-get install -y fop=1:2.* libsaxon-java libsaxonb-java chromium \ && apt-get -y install libx11-xcb1 libxcomposite1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 # Setup FOP to use saxon xslt parser RUN sed -i '/find_jars/i \ find_jars saxon saxonb' /usr/bin/fop RUN sed -i 's/^run_java /run_java -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl /' /usr/bin/fop +# < CUSTOM + +# Set production environment +ENV RAILS_ENV="production" \ + BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" \ + BUNDLE_WITHOUT="development" + +# Throw-away build stage to reduce size of final image +FROM base AS build + +# Install packages needed to build gems and node modules +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential git libpq-dev node-gyp pkg-config python-is-python3 && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives -# Set working directory -RUN mkdir /app -WORKDIR /app +# Install JavaScript dependencies +ARG NODE_VERSION=22.11.0 +ARG YARN_VERSION=1.22.22 +ENV PATH=/usr/local/node/bin:$PATH +RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ + /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ + npm install -g yarn@$YARN_VERSION && \ + rm -rf /tmp/node-build-master -RUN npm i -g yarn -RUN npm i npx +# Install application gems +COPY Gemfile Gemfile.lock ./ +RUN bundle install && \ + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ + bundle exec bootsnap precompile --gemfile -# Bundle and cache Ruby gems -COPY Gemfile* ./ -RUN bundle config set deployment true -RUN bundle config set without development:test -RUN bundle install +# Install node modules +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile -# Cache everything +# Copy application code COPY . . -RUN SECRET_KEY_BASE=NONE RAILS_ENV=production bundle exec rails assets:precompile +# Precompile bootsnap code for faster boot times +RUN bundle exec bootsnap precompile app/ lib/ + +# Precompiling assets for production without requiring secret RAILS_MASTER_KEY +RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails tailwindcss:build +RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile + + +RUN rm -rf node_modules + + +# Final stage for app image +FROM base + +# Copy built artifacts: gems, application +COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" +COPY --from=build /rails /rails + +# Run and own only the runtime files as a non-root user for security +RUN groupadd --system --gid 1000 rails && \ + useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \ + chown -R rails:rails db log storage tmp +USER 1000:1000 + +# Entrypoint prepares the database. +ENTRYPOINT ["/rails/bin/docker-entrypoint"] -# Run application by default -CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"] +# Start server via Thruster by default, this can be overwritten at runtime +EXPOSE 5000 +ENV HTTP_PORT=5000 +CMD ["./bin/thrust", "./bin/rails", "server"] diff --git a/Gemfile b/Gemfile index 0101fe068..57fdc19da 100644 --- a/Gemfile +++ b/Gemfile @@ -1,20 +1,23 @@ source 'https://rubygems.org' -ruby '3.3.0' +ruby '3.3.6' -gem 'rails', '~> 7.1' +gem 'rails', '~> 8.0' gem 'rails-i18n' -gem 'pg', '~> 1.5' +gem 'pg' gem 'with_advisory_lock' -gem 'puma', '~> 6.4' +gem 'puma' + +# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/] +gem "thruster", require: false gem 'turbo-rails' # Styles -gem 'sprockets-rails' gem 'importmap-rails' +gem 'sprockets-rails' gem 'tailwindcss-rails' gem 'view_component' @@ -22,11 +25,11 @@ gem 'view_component' gem 'clockwork' # Workers -gem 'good_job' +gem 'good_job', '3.99' # intermediate version to avoid breaking changes # Auth gem 'omniauth-google-oauth2' -gem 'omniauth-saml', '~> 2.2.1' +gem 'omniauth-saml' gem 'omniauth-rails_csrf_protection' gem 'pundit' @@ -59,7 +62,7 @@ group :development, :test do end group :development do - gem 'annotate' + gem 'annotaterb' gem 'listen' gem 'web-console' gem 'solargraph' diff --git a/Gemfile.lock b/Gemfile.lock index 4362ba58e..fa9bd314d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,105 +1,100 @@ GEM remote: https://rubygems.org/ specs: - Ascii85 (1.1.0) - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + Ascii85 (2.0.1) + actioncable (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) + mail (>= 2.8.0) + actionmailer (8.0.0) + actionpack (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activesupport (= 8.0.0) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (8.0.0) + actionview (= 8.0.0) + activesupport (= 8.0.0) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + useragent (~> 0.16) + actiontext (8.0.0) + actionpack (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (8.0.0) + activesupport (= 8.0.0) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (8.0.0) + activesupport (= 8.0.0) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (8.0.0) + activesupport (= 8.0.0) + activerecord (8.0.0) + activemodel (= 8.0.0) + activesupport (= 8.0.0) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (8.0.0) + actionpack (= 8.0.0) + activejob (= 8.0.0) + activerecord (= 8.0.0) + activesupport (= 8.0.0) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (8.0.0) base64 + benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) afm (0.2.2) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) + annotaterb (4.13.0) ast (2.4.2) backport (1.2.0) base64 (0.2.0) - benchmark (0.3.0) - better_html (2.0.2) + benchmark (0.4.0) + better_html (2.1.1) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) erubi (~> 1.4) parser (>= 2.4) smart_properties - bigdecimal (3.1.6) + bigdecimal (3.1.8) bindex (0.8.1) - bootsnap (1.18.3) + bootsnap (1.18.4) msgpack (~> 1.2) - brakeman (6.1.2) + brakeman (6.2.2) racc - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) capybara (3.40.0) addressable @@ -113,100 +108,106 @@ GEM capybara-screenshot (1.0.26) capybara (>= 1.0, < 4) launchy + childprocess (5.1.0) + logger (~> 1.5) clockwork (3.0.2) activesupport tzinfo coderay (1.1.3) - combine_pdf (1.0.26) - matrix - ruby-rc4 (>= 0.1.5) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crack (1.0.0) bigdecimal rexml crass (1.0.6) - date (3.3.4) - debug (1.9.1) + date (3.4.0) + debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.5.1) - docile (1.4.0) + docile (1.4.1) domain_name (0.6.20240107) - dotenv (3.1.0) - dotenv-rails (3.1.0) - dotenv (= 3.1.0) + dotenv (3.1.4) + dotenv-rails (3.1.4) + dotenv (= 3.1.4) railties (>= 6.1) drb (2.2.1) e2mmap (0.1.0) - erb_lint (0.5.0) + erb_lint (0.7.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) rainbow - rubocop + rubocop (>= 1) smart_properties - erubi (1.12.0) - et-orbi (1.2.7) + erubi (1.13.0) + et-orbi (1.2.11) tzinfo - faraday (2.9.0) - faraday-net_http (>= 2.0, < 3.2) - faraday-net_http (3.1.0) - net-http - ffi (1.16.3) - foreman (0.87.2) - fugit (1.9.0) - et-orbi (~> 1, >= 1.2.7) + faraday (2.12.1) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.0) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + foreman (0.88.1) + fugit (1.11.1) + et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) - good_job (3.24.0) + good_job (3.99.0) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) fugit (>= 1.1) railties (>= 6.0.0) thor (>= 0.14.1) - grover (1.1.11) - combine_pdf (~> 1.0) - nokogiri (~> 1.0) - hashdiff (1.1.0) + grover (1.2.0) + nokogiri (~> 1) + hashdiff (1.1.2) hashery (2.1.2) hashie (5.0.0) - htmlbeautifier (1.4.2) + htmlbeautifier (1.4.3) http-accept (1.7.0) - http-cookie (1.0.5) + http-cookie (1.0.7) domain_name (~> 0.5) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) - importmap-rails (2.0.1) + importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.11.2) - rdoc + irb (1.14.1) + rdoc (>= 4.0.0) reline (>= 0.4.2) - jaro_winkler (1.5.6) - jbuilder (2.11.5) + jaro_winkler (1.6.0) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - jsbundling-rails (1.3.0) + jsbundling-rails (1.3.1) railties (>= 6.0.0) - json (2.7.1) - jwt (2.8.1) + json (2.8.2) + jwt (2.9.3) base64 - kramdown (2.4.0) - rexml + kramdown (2.5.1) + rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) language_server-protocol (3.17.0.3) - launchy (2.5.2) + launchy (3.0.1) addressable (~> 2.8) - listen (3.8.0) + childprocess (~> 5.0) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.22.0) + logger (1.6.1) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -214,41 +215,42 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) - mime-types (3.5.2) + method_source (1.1.0) + mime-types (3.6.0) + logger mime-types-data (~> 3.2015) - mime-types-data (3.2024.0206) + mime-types-data (3.2024.1105) mini_mime (1.1.5) - mini_portile2 (2.8.6) - minitest (5.22.2) - msgpack (1.7.2) - multi_xml (0.6.0) - mutex_m (0.2.0) - net-http (0.4.1) + mini_portile2 (2.8.8) + minitest (5.25.2) + msgpack (1.7.5) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + net-http (0.5.0) uri - net-imap (0.4.10) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol netrc (0.11.0) - nio4r (2.7.0) - nokogiri (1.16.2) + nio4r (2.7.4) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.2-aarch64-linux) + nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.2-arm64-darwin) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-darwin) + nokogiri (1.16.7-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-linux) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -261,79 +263,79 @@ GEM hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection - omniauth-google-oauth2 (1.1.1) - jwt (>= 2.0) - oauth2 (~> 2.0.6) + omniauth-google-oauth2 (1.2.0) + jwt (>= 2.9) + oauth2 (~> 2.0) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.8.0) + omniauth-oauth2 (~> 1.8) omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) omniauth-saml (2.2.1) omniauth (~> 2.1) ruby-saml (~> 1.17) - parallel (1.24.0) - parser (3.3.0.5) + parallel (1.26.3) + parser (3.3.6.0) ast (~> 2.4.1) racc - pdf-reader (2.12.0) - Ascii85 (~> 1.0) + pdf-reader (2.13.0) + Ascii85 (>= 1.0, < 3.0, != 2.0.0) afm (~> 0.2.1) hashery (~> 2.0) ruby-rc4 ttfunk - pg (1.5.6) - pg_search (2.3.6) - activerecord (>= 5.2) - activesupport (>= 5.2) - prism (0.19.0) + pg (1.5.9) + pg_search (2.3.7) + activerecord (>= 6.1) + activesupport (>= 6.1) + prism (0.29.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - pry-rails (0.3.9) - pry (>= 0.10.4) - psych (5.1.2) + pry-rails (0.3.11) + pry (>= 0.13.0) + psych (5.2.0) stringio - public_suffix (5.0.4) - puma (6.4.2) + public_suffix (6.0.1) + puma (6.5.0) nio4r (~> 2.0) - pundit (2.3.1) + pundit (2.4.0) activesupport (>= 3.0.0) raabro (1.4.0) - racc (1.7.3) - rack (3.0.9.1) + racc (1.8.1) + rack (3.1.8) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-protection (4.0.0) + rack-protection (4.1.1) base64 (>= 0.1.0) + logger (>= 1.6.0) rack (>= 3.0.0, < 4) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (8.0.0) + actioncable (= 8.0.0) + actionmailbox (= 8.0.0) + actionmailer (= 8.0.0) + actionpack (= 8.0.0) + actiontext (= 8.0.0) + actionview (= 8.0.0) + activejob (= 8.0.0) + activemodel (= 8.0.0) + activerecord (= 8.0.0) + activestorage (= 8.0.0) + activesupport (= 8.0.0) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 8.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -341,29 +343,29 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (7.0.8) + rails-i18n (8.0.1) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 8) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) - irb + railties (>= 8.0.0, < 9) + railties (8.0.0) + actionpack (= 8.0.0) + activesupport (= 8.0.0) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) rbs (2.8.4) rdbg (0.1.0) debug (>= 1.2.2) - rdoc (6.6.2) + rdoc (6.8.1) psych (>= 4.0.0) - regexp_parser (2.9.0) - reline (0.4.3) + regexp_parser (2.9.2) + reline (0.5.11) io-console (~> 0.5) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) @@ -372,44 +374,41 @@ GEM netrc (~> 0.8) reverse_markdown (2.1.1) nokogiri - rexml (3.2.6) - rollbar (3.5.1) - rubocop (1.60.2) + rexml (3.3.9) + rollbar (3.6.0) + rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.30.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-rails (2.23.1) + rubocop-ast (1.36.1) + parser (>= 3.3.1.0) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - ruby-lsp (0.13.4) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-lsp (0.17.2) language_server-protocol (~> 3.17.0) - prism (>= 0.19.0, < 0.20) + prism (>= 0.29.0, < 0.30) sorbet-runtime (>= 0.5.10782) - ruby-lsp-rails (0.2.9) - actionpack (>= 6.0) - activerecord (>= 6.0) - railties (>= 6.0) - ruby-lsp (>= 0.13.0, < 0.14.0) - sorbet-runtime (>= 0.5.9897) + ruby-lsp-rails (0.3.11) + ruby-lsp (>= 0.17.2, < 0.18.0) ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby-saml (1.17.0) nokogiri (>= 1.13.10) rexml rubyzip (2.3.2) - selenium-webdriver (4.18.1) + securerandom (0.3.2) + selenium-webdriver (4.27.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -417,7 +416,7 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) smart_properties (1.17.0) snaky_hash (2.0.1) @@ -439,42 +438,46 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) - sorbet-runtime (0.5.11247) + sorbet-runtime (0.5.11663) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - stimulus-rails (1.3.3) - railties (>= 6.0.0) - stringio (3.1.0) - tailwindcss-rails (2.3.0) - railties (>= 6.0.0) - tailwindcss-rails (2.3.0-aarch64-linux) + stimulus-rails (1.3.4) railties (>= 6.0.0) - tailwindcss-rails (2.3.0-arm64-darwin) - railties (>= 6.0.0) - tailwindcss-rails (2.3.0-x86_64-darwin) - railties (>= 6.0.0) - tailwindcss-rails (2.3.0-x86_64-linux) - railties (>= 6.0.0) - thor (1.3.1) - tilt (2.3.0) - timeout (0.4.1) - ttfunk (1.7.0) - turbo-rails (2.0.2) + stringio (3.1.2) + tailwindcss-rails (3.0.0) + railties (>= 7.0.0) + tailwindcss-ruby + tailwindcss-ruby (3.4.15) + tailwindcss-ruby (3.4.15-aarch64-linux) + tailwindcss-ruby (3.4.15-arm64-darwin) + tailwindcss-ruby (3.4.15-x86_64-darwin) + tailwindcss-ruby (3.4.15-x86_64-linux) + thor (1.3.2) + thruster (0.1.9) + thruster (0.1.9-aarch64-linux) + thruster (0.1.9-arm64-darwin) + thruster (0.1.9-x86_64-darwin) + thruster (0.1.9-x86_64-linux) + tilt (2.4.0) + timeout (0.4.2) + ttfunk (1.8.0) + bigdecimal (~> 3.1) + turbo-rails (2.0.11) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) - uri (0.13.0) - version_gem (1.1.3) - view_component (3.10.0) - activesupport (>= 5.2.0, < 8.0) + unicode-display_width (2.6.0) + uri (1.0.2) + useragent (0.16.10) + version_gem (1.1.4) + view_component (3.20.0) + activesupport (>= 5.2.0, < 8.1) concurrent-ruby (~> 1.0) method_source (~> 1.0) web-console (4.2.1) @@ -482,12 +485,11 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.20.0) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) - websocket (1.2.10) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -496,8 +498,8 @@ GEM zeitwerk (>= 2.6) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.34) - zeitwerk (2.6.13) + yard (0.9.37) + zeitwerk (2.7.1) PLATFORMS aarch64-linux @@ -508,7 +510,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - annotate + annotaterb bootsnap (>= 1.4.4) brakeman capybara @@ -517,7 +519,7 @@ DEPENDENCIES dotenv-rails erb_lint foreman - good_job + good_job (= 3.99) grover htmlbeautifier importmap-rails @@ -527,16 +529,16 @@ DEPENDENCIES listen omniauth-google-oauth2 omniauth-rails_csrf_protection - omniauth-saml (~> 2.2.1) + omniauth-saml pdf-reader - pg (~> 1.5) + pg pg_search pry-byebug pry-rails - puma (~> 6.4) + puma pundit rack-attack - rails (~> 7.1) + rails (~> 8.0) rails-i18n rdbg rest-client @@ -551,6 +553,7 @@ DEPENDENCIES sprockets-rails stimulus-rails tailwindcss-rails + thruster turbo-rails view_component web-console @@ -558,7 +561,7 @@ DEPENDENCIES with_advisory_lock RUBY VERSION - ruby 3.3.0p0 + ruby 3.3.6p108 BUNDLED WITH 2.4.12 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 9ea9309f5..f41a4bc79 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,5 @@ //= link_tree ../images //= link_directory ../stylesheets .css -//= link_tree ../builds //= link tailwind.css +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js diff --git a/app/models/filter_subscription.rb b/app/models/filter_subscription.rb index 4360ad256..b8cbcec7b 100644 --- a/app/models/filter_subscription.rb +++ b/app/models/filter_subscription.rb @@ -56,7 +56,7 @@ def scope_searchable(searchable) scope = searchable .where(tenant_id: tenant) - .where("tag_ids && ARRAY[?]", tag_ids) + .where("tag_ids && ARRAY[?]::integer[]", tag_ids) query = Searchable::MessageThreadQuery.labels_to_ids( Searchable::MessageThreadQuery.parse(filter.query), @@ -66,10 +66,10 @@ def scope_searchable(searchable) if query[:filter_tag_ids].present? return scope.none if query[:filter_tag_ids] == :missing_tag - scope = scope.where("tag_ids @> ARRAY[?]", query[:filter_tag_ids]) + scope = scope.where("tag_ids @> ARRAY[?]::integer[]", query[:filter_tag_ids]) end - scope = scope.where.not("tag_ids && ARRAY[?]", query[:filter_out_tag_ids]) if query[:filter_out_tag_ids].present? + scope = scope.where.not("tag_ids && ARRAY[?]::integer[]", query[:filter_out_tag_ids]) if query[:filter_out_tag_ids].present? scope = scope.fulltext_search(query[:fulltext], prefix_search: query[:prefix_search]) if query[:fulltext].present? scope diff --git a/app/models/message_drafts_import.rb b/app/models/message_drafts_import.rb index de9aaf1f0..7637c5d3b 100644 --- a/app/models/message_drafts_import.rb +++ b/app/models/message_drafts_import.rb @@ -16,7 +16,7 @@ class MessageDraftsImport < ApplicationRecord validates_with MessageDraftsImportValidator, if: :unzipped? - enum status: { uploaded: 0, unzipped: 1, parsed: 2 } + enum :status, { uploaded: 0, unzipped: 1, parsed: 2 } def base_name name.split('_', 2).last diff --git a/app/models/searchable/message_thread.rb b/app/models/searchable/message_thread.rb index 0867c8906..059b51501 100644 --- a/app/models/searchable/message_thread.rb +++ b/app/models/searchable/message_thread.rb @@ -19,7 +19,7 @@ class Searchable::MessageThread < ApplicationRecord belongs_to :message_thread, class_name: '::MessageThread' belongs_to :tenant, class_name: '::Tenant' - scope :with_tag_id, ->(tag_id) { where("tag_ids && ARRAY[?]", [tag_id]) } + scope :with_tag_id, ->(tag_id) { where("tag_ids && ARRAY[?]::integer[]", [tag_id]) } include PgSearch::Model @@ -68,7 +68,7 @@ def self.search_ids(query_filter, search_permissions:, cursor:, per_page:, direc if search_permissions[:tag_ids] if search_permissions[:tag_ids].any? - scope = scope.where("tag_ids && ARRAY[?]", search_permissions[:tag_ids]) + scope = scope.where("tag_ids && ARRAY[?]::integer[]", search_permissions[:tag_ids]) end end @@ -76,10 +76,10 @@ def self.search_ids(query_filter, search_permissions:, cursor:, per_page:, direc if query_filter[:filter_tag_ids] == :missing_tag scope = scope.none else - scope = scope.where("tag_ids @> ARRAY[?]", query_filter[:filter_tag_ids]) + scope = scope.where("tag_ids @> ARRAY[?]::integer[]", query_filter[:filter_tag_ids]) end end - scope = scope.where.not("tag_ids && ARRAY[?]", query_filter[:filter_out_tag_ids]) if query_filter[:filter_out_tag_ids].present? + scope = scope.where.not("tag_ids && ARRAY[?]::integer[]", query_filter[:filter_out_tag_ids]) if query_filter[:filter_out_tag_ids].present? scope = scope.fulltext_search(query_filter[:fulltext], prefix_search: query_filter[:prefix_search]).with_pg_search_highlight if query_filter[:fulltext].present? scope = scope.select(:message_thread_id, :last_message_delivered_at) @@ -113,7 +113,7 @@ def self.search_ids(query_filter, search_permissions:, cursor:, per_page:, direc end def self.reindex_with_tag_id(tag_id) - Searchable::MessageThread.select(:id, :message_thread_id).where("tag_ids && ARRAY[?]", [tag_id]).find_each do |searchable_mt| + Searchable::MessageThread.select(:id, :message_thread_id).where("tag_ids && ARRAY[?]::integer[]", [tag_id]).find_each do |searchable_mt| Searchable::ReindexMessageThreadJob.perform_later(searchable_mt.message_thread_id) end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 27b4bdbda..9d7183982 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,7 @@ <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> + <%= javascript_importmap_tags %> <%= favicon_link_tag 'SD_icon_square_white.png', type: "image/png" %> diff --git a/bin/brakeman b/bin/brakeman new file mode 100755 index 000000000..ace1c9ba0 --- /dev/null +++ b/bin/brakeman @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +ARGV.unshift("--ensure-latest") + +load Gem.bin_path("brakeman", "brakeman") diff --git a/bin/bundle b/bin/bundle index 374a0a1fa..50da5fdf9 100755 --- a/bin/bundle +++ b/bin/bundle @@ -27,7 +27,7 @@ m = Module.new do bundler_version = nil update_index = nil ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN) bundler_version = a end next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ @@ -41,13 +41,13 @@ m = Module.new do gemfile = ENV["BUNDLE_GEMFILE"] return gemfile if gemfile && !gemfile.empty? - File.expand_path("../../Gemfile", __FILE__) + File.expand_path("../Gemfile", __dir__) end def lockfile lockfile = case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") else "#{gemfile}.lock" end File.expand_path(lockfile) @@ -62,8 +62,9 @@ m = Module.new do def bundler_requirement @bundler_requirement ||= - env_var_version || cli_arg_version || - bundler_requirement_for(lockfile_version) + env_var_version || + cli_arg_version || + bundler_requirement_for(lockfile_version) end def bundler_requirement_for(version) @@ -71,13 +72,7 @@ m = Module.new do bundler_gem_version = Gem::Version.new(version) - requirement = bundler_gem_version.approximate_recommendation - - return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") - - requirement += ".a" if bundler_gem_version.prerelease? - - requirement + bundler_gem_version.approximate_recommendation end def load_bundler! diff --git a/bin/debug b/bin/debug deleted file mode 100755 index da445ee26..000000000 --- a/bin/debug +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh - -if ! gem list foreman -i --silent; then - echo "Installing foreman..." - gem install foreman -fi - -exec foreman start -f Procfile.debug --env=/dev/null "$@" diff --git a/bin/dev b/bin/dev index 7ca58603a..d80a02dbc 100755 --- a/bin/dev +++ b/bin/dev @@ -1,8 +1,11 @@ #!/usr/bin/env sh -if ! gem list foreman -i --silent; then +if gem list --no-installed --exact --silent foreman; then echo "Installing foreman..." gem install foreman fi -exec foreman start -f Procfile.dev -e foreman.env "$@" +# Default to port 3000 if not specified +export PORT="${PORT:-3000}" + +exec foreman start -f Procfile.dev --env /dev/null "$@" diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint new file mode 100755 index 000000000..57567d69b --- /dev/null +++ b/bin/docker-entrypoint @@ -0,0 +1,14 @@ +#!/bin/bash -e + +# Enable jemalloc for reduced memory usage and latency. +if [ -z "${LD_PRELOAD+x}" ]; then + LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit) + export LD_PRELOAD +fi + +# If running the rails server then create or migrate existing database +if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then + ./bin/rails db:prepare +fi + +exec "${@}" diff --git a/bin/kamal b/bin/kamal new file mode 100755 index 000000000..cbe59b95e --- /dev/null +++ b/bin/kamal @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'kamal' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("kamal", "kamal") diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 000000000..40330c0ff --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +# explicit rubocop config increases performance slightly while avoiding config confusion. +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/setup b/bin/setup index 3cd5a9d78..6b62a3231 100755 --- a/bin/setup +++ b/bin/setup @@ -1,7 +1,6 @@ #!/usr/bin/env ruby require "fileutils" -# path to your application root. APP_ROOT = File.expand_path("..", __dir__) def system!(*args) @@ -14,9 +13,11 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") + # Install JavaScript dependencies + system("yarn install --check-files") + # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") # FileUtils.cp "config/database.yml.sample", "config/database.yml" @@ -28,6 +29,9 @@ FileUtils.chdir APP_ROOT do puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system! "bin/rails restart" + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end end diff --git a/bin/spring b/bin/spring deleted file mode 100755 index b4147e843..000000000 --- a/bin/spring +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) - gem "bundler" - require "bundler" - - # Load Spring without loading other gems in the Gemfile, for speed. - Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring| - Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem "spring", spring.version - require "spring/binstub" - rescue Gem::LoadError - # Ignore when Spring is not installed. - end -end diff --git a/bin/thrust b/bin/thrust new file mode 100755 index 000000000..36bde2d83 --- /dev/null +++ b/bin/thrust @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("thruster", "thrust") diff --git a/config/importmap.rb b/config/importmap.rb index 0b3d1eafe..0086a327b 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,4 +1,3 @@ -pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true -pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true -pin_all_from "app/javascript/controllers", under: "controllers" -pin_all_from "app/javascript/custom", under: "custom" +# Pin npm packages by running ./bin/importmap + +pin "application" diff --git a/db/migrate/20241125070056_create_good_job_execution_error_backtrace.rb b/db/migrate/20241125070056_create_good_job_execution_error_backtrace.rb new file mode 100644 index 000000000..c6d3f64c7 --- /dev/null +++ b/db/migrate/20241125070056_create_good_job_execution_error_backtrace.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateGoodJobExecutionErrorBacktrace < ActiveRecord::Migration[7.2] + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.column_exists?(:good_job_executions, :error_backtrace) + end + end + + add_column :good_job_executions, :error_backtrace, :text, array: true + end +end diff --git a/db/migrate/20241125070057_create_good_job_process_lock_ids.rb b/db/migrate/20241125070057_create_good_job_process_lock_ids.rb new file mode 100644 index 000000000..94b8b674e --- /dev/null +++ b/db/migrate/20241125070057_create_good_job_process_lock_ids.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateGoodJobProcessLockIds < ActiveRecord::Migration[7.2] + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.column_exists?(:good_jobs, :locked_by_id) + end + end + + add_column :good_jobs, :locked_by_id, :uuid + add_column :good_jobs, :locked_at, :datetime + add_column :good_job_executions, :process_id, :uuid + add_column :good_job_processes, :lock_type, :integer, limit: 2 + end +end diff --git a/db/migrate/20241125070058_create_good_job_process_lock_indexes.rb b/db/migrate/20241125070058_create_good_job_process_lock_indexes.rb new file mode 100644 index 000000000..11b045385 --- /dev/null +++ b/db/migrate/20241125070058_create_good_job_process_lock_indexes.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class CreateGoodJobProcessLockIndexes < ActiveRecord::Migration[7.2] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) + add_index :good_jobs, [:priority, :scheduled_at], + order: { priority: "ASC NULLS LAST", scheduled_at: :asc }, + where: "finished_at IS NULL AND locked_by_id IS NULL", + name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked, + algorithm: :concurrently + end + + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id) + add_index :good_jobs, :locked_by_id, + where: "locked_by_id IS NOT NULL", + name: :index_good_jobs_on_locked_by_id, + algorithm: :concurrently + end + + unless connection.index_name_exists?(:good_job_executions, :index_good_job_executions_on_process_id_and_created_at) + add_index :good_job_executions, [:process_id, :created_at], + name: :index_good_job_executions_on_process_id_and_created_at, + algorithm: :concurrently + end + end + + dir.down do + remove_index(:good_jobs, name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked) + remove_index(:good_jobs, name: :index_good_jobs_on_locked_by_id) if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_locked_by_id) + remove_index(:good_job_executions, name: :index_good_job_executions_on_process_id_and_created_at) if connection.index_name_exists?(:good_job_executions, :index_good_job_executions_on_process_id_and_created_at) + end + end + end +end diff --git a/db/migrate/20241125070059_create_good_job_execution_duration.rb b/db/migrate/20241125070059_create_good_job_execution_duration.rb new file mode 100644 index 000000000..4b17b33dd --- /dev/null +++ b/db/migrate/20241125070059_create_good_job_execution_duration.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class CreateGoodJobExecutionDuration < ActiveRecord::Migration[7.2] + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.column_exists?(:good_job_executions, :duration) + end + end + + add_column :good_job_executions, :duration, :interval + end +end diff --git a/db/schema.rb b/db/schema.rb index ba2de7a6b..62c38eb92 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_11_06_152337) do +ActiveRecord::Schema[8.0].define(version: 2024_11_25_070059) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pgcrypto" - enable_extension "plpgsql" enable_extension "unaccent" # Custom types defined in this database. @@ -194,13 +194,18 @@ t.bigint "tenant_id", null: false t.bigint "author_id", null: false t.string "name", null: false - t.string "query", null: false + t.string "query" t.integer "position", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "type" + t.bigint "tag_id" + t.boolean "is_pinned", default: false, null: false t.index ["author_id"], name: "index_filters_on_author_id" - t.index ["tenant_id", "position"], name: "index_filters_on_tenant_id_and_position", unique: true + t.index ["is_pinned"], name: "index_filters_on_is_pinned" + t.index ["tag_id"], name: "index_filters_on_tag_id" t.index ["tenant_id"], name: "index_filters_on_tenant_id" + t.index ["type"], name: "index_filters_on_type" end create_table "folders", force: :cascade do |t| @@ -249,6 +254,7 @@ t.datetime "enqueued_at" t.datetime "discarded_at" t.datetime "finished_at" + t.datetime "jobs_finished_at" end create_table "good_job_executions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -262,13 +268,18 @@ t.datetime "finished_at" t.text "error" t.integer "error_event", limit: 2 + t.text "error_backtrace", array: true + t.uuid "process_id" + t.interval "duration" t.index ["active_job_id", "created_at"], name: "index_good_job_executions_on_active_job_id_and_created_at" + t.index ["process_id", "created_at"], name: "index_good_job_executions_on_process_id_and_created_at" end create_table "good_job_processes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.jsonb "state" + t.integer "lock_type", limit: 2 end create_table "good_job_settings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -301,6 +312,8 @@ t.text "job_class" t.integer "error_event", limit: 2 t.text "labels", array: true + t.uuid "locked_by_id" + t.datetime "locked_at" t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at" t.index ["batch_callback_id"], name: "index_good_jobs_on_batch_callback_id", where: "(batch_callback_id IS NOT NULL)" t.index ["batch_id"], name: "index_good_jobs_on_batch_id", where: "(batch_id IS NOT NULL)" @@ -309,8 +322,10 @@ t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)" t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))" t.index ["labels"], name: "index_good_jobs_on_labels", where: "(labels IS NOT NULL)", using: :gin + t.index ["locked_by_id"], name: "index_good_jobs_on_locked_by_id", where: "(locked_by_id IS NOT NULL)" t.index ["priority", "created_at"], name: "index_good_job_jobs_for_candidate_lookup", where: "(finished_at IS NULL)" t.index ["priority", "created_at"], name: "index_good_jobs_jobs_on_priority_created_at_when_unfinished", order: { priority: "DESC NULLS LAST" }, where: "(finished_at IS NULL)" + t.index ["priority", "scheduled_at"], name: "index_good_jobs_on_priority_scheduled_at_unfinished_unlocked", where: "((finished_at IS NULL) AND (locked_by_id IS NULL))" t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)" t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)" end @@ -450,7 +465,7 @@ t.datetime "delivered_at", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.datetime "last_message_delivered_at", null: false + t.datetime "last_message_delivered_at", precision: nil, null: false t.bigint "box_id", null: false t.index ["folder_id"], name: "index_message_threads_on_folder_id" end @@ -570,12 +585,12 @@ t.bigint "owner_id" t.string "external_name" t.string "type", null: false - t.string "icon" - t.integer "tag_groups_count", default: 0, null: false t.enum "color", enum_type: "color" + t.integer "tag_groups_count", default: 0, null: false + t.string "icon" t.index "tenant_id, type, lower((name)::text)", name: "index_tags_on_tenant_id_and_type_and_lowercase_name", unique: true t.index ["owner_id"], name: "index_tags_on_owner_id" - t.index ["tenant_id", "type"], name: "signings_tags", unique: true, where: "((type)::text = ANY ((ARRAY['SignatureRequestedTag'::character varying, 'SignedTag'::character varying])::text[]))" + t.index ["tenant_id", "type"], name: "signings_tags", unique: true, where: "((type)::text = ANY (ARRAY[('SignatureRequestedTag'::character varying)::text, ('SignedTag'::character varying)::text]))" t.index ["tenant_id"], name: "index_tags_on_tenant_id" end @@ -616,6 +631,17 @@ t.datetime "updated_at", null: false end + create_table "user_item_visibilities", force: :cascade do |t| + t.bigint "user_id", null: false + t.string "user_item_type", null: false + t.bigint "user_item_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "visible", default: true, null: false + t.integer "position" + t.index ["user_id"], name: "index_user_item_visibilities_on_user_id" + end + create_table "users", force: :cascade do |t| t.bigint "tenant_id" t.string "email", null: false @@ -646,6 +672,7 @@ add_foreign_key "filter_subscriptions", "filters" add_foreign_key "filter_subscriptions", "tenants" add_foreign_key "filter_subscriptions", "users" + add_foreign_key "filters", "tags" add_foreign_key "filters", "tenants", on_delete: :cascade add_foreign_key "filters", "users", column: "author_id", on_delete: :cascade add_foreign_key "folders", "boxes" @@ -686,5 +713,6 @@ add_foreign_key "tags", "tenants" add_foreign_key "tags", "users", column: "owner_id" add_foreign_key "upvs_form_related_documents", "upvs_forms" + add_foreign_key "user_item_visibilities", "users" add_foreign_key "users", "tenants" end diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake new file mode 100644 index 000000000..1ad0ec39e --- /dev/null +++ b/lib/tasks/annotate_rb.rake @@ -0,0 +1,8 @@ +# This rake task was added by annotate_rb gem. + +# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this +if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil? + require "annotate_rb" + + AnnotateRb::Core.load_rake_tasks +end diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake deleted file mode 100644 index 8c4e3ff8a..000000000 --- a/lib/tasks/auto_annotate_models.rake +++ /dev/null @@ -1,59 +0,0 @@ -# NOTE: only doing this in development as some production environments (Heroku) -# NOTE: are sensitive to local FS writes, and besides -- it's just not proper -# NOTE: to have a dev-mode tool do its thing in production. -if Rails.env.development? - require 'annotate' - task :set_annotation_options do - # You can override any of these by setting an environment variable of the - # same name. - Annotate.set_defaults( - 'active_admin' => 'false', - 'additional_file_patterns' => [], - 'routes' => 'false', - 'models' => 'true', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'false', - 'show_complete_foreign_keys' => 'false', - 'show_indexes' => 'false', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'true', - 'exclude_fixtures' => 'true', - 'exclude_factories' => 'true', - 'exclude_serializers' => 'true', - 'exclude_scaffolds' => 'true', - 'exclude_controllers' => 'true', - 'exclude_helpers' => 'true', - 'exclude_sti_subclasses' => 'false', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_routes' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,bigint,boolean', - 'hide_default_column_types' => 'json,jsonb,hstore', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_yard' => 'false', - 'format_markdown' => 'false', - 'sort' => 'true', - 'force' => 'false', - 'frozen' => 'false', - 'classified_sort' => 'true', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil, - 'with_comment' => 'true' - ) - end - - Annotate.load_tasks -end diff --git a/test/fixtures/api_connections.yml b/test/fixtures/api_connections.yml index aa6607339..5ab8b5f0c 100644 --- a/test/fixtures/api_connections.yml +++ b/test/fixtures/api_connections.yml @@ -1,5 +1,19 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: api_connections +# +# id :bigint not null, primary key +# api_token_private_key :string not null +# obo :uuid +# settings :jsonb +# sub :string not null +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# govbox_api_api_connection1: sub: sub1 obo: <%= SecureRandom.uuid %> diff --git a/test/fixtures/automation/actions.yml b/test/fixtures/automation/actions.yml index c96ba8e30..dbd38a75a 100644 --- a/test/fixtures/automation/actions.yml +++ b/test/fixtures/automation/actions.yml @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: automation_actions +# +# id :bigint not null, primary key +# action_object_type :string +# type :string +# value :string +# created_at :datetime not null +# updated_at :datetime not null +# action_object_id :bigint +# automation_rule_id :bigint not null +# one_one: automation_rule: one type: Automation::AddMessageThreadTagAction diff --git a/test/fixtures/automation/conditions.yml b/test/fixtures/automation/conditions.yml index 2007db803..f026cb6a1 100644 --- a/test/fixtures/automation/conditions.yml +++ b/test/fixtures/automation/conditions.yml @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: automation_conditions +# +# id :bigint not null, primary key +# attr :string +# condition_object_type :string +# type :string +# value :string +# created_at :datetime not null +# updated_at :datetime not null +# automation_rule_id :bigint not null +# condition_object_id :bigint +# one: automation_rule: one type: Automation::ContainsCondition diff --git a/test/fixtures/automation/rules.yml b/test/fixtures/automation/rules.yml index f3d16276f..6732b967f 100644 --- a/test/fixtures/automation/rules.yml +++ b/test/fixtures/automation/rules.yml @@ -1,5 +1,17 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: automation_rules +# +# id :bigint not null, primary key +# name :string not null +# trigger_event :string not null +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint not null +# user_id :bigint not null +# one: user: basic tenant: ssd diff --git a/test/fixtures/automation/webhooks.yml b/test/fixtures/automation/webhooks.yml index 6dc799dd3..722f3ccb7 100644 --- a/test/fixtures/automation/webhooks.yml +++ b/test/fixtures/automation/webhooks.yml @@ -1,5 +1,16 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: automation_webhooks +# +# id :bigint not null, primary key +# name :string not null +# url :string not null +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint not null +# one: name: Webhook 1 url: https://example.com/webhook1 diff --git a/test/fixtures/boxes.yml b/test/fixtures/boxes.yml index 87c00c55e..3b788083c 100644 --- a/test/fixtures/boxes.yml +++ b/test/fixtures/boxes.yml @@ -1,5 +1,22 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: boxes +# +# id :bigint not null, primary key +# color :enum +# name :string not null +# settings :jsonb +# short_name :string +# syncable :boolean default(TRUE), not null +# type :string +# uri :string not null +# created_at :datetime not null +# updated_at :datetime not null +# api_connection_id :bigint +# tenant_id :bigint not null +# ssd_main: name: SSD main uri: SSDMainURI diff --git a/test/fixtures/filter_subscriptions.yml b/test/fixtures/filter_subscriptions.yml index b88359dbb..7f7987b8e 100644 --- a/test/fixtures/filter_subscriptions.yml +++ b/test/fixtures/filter_subscriptions.yml @@ -1,2 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: filter_subscriptions +# +# id :bigint not null, primary key +# events :string default([]), not null, is an Array +# last_notify_run_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# filter_id :bigint not null +# tenant_id :bigint not null +# user_id :bigint not null +# diff --git a/test/fixtures/filters.yml b/test/fixtures/filters.yml index df801de55..370b2a969 100644 --- a/test/fixtures/filters.yml +++ b/test/fixtures/filters.yml @@ -1,5 +1,21 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: filters +# +# id :bigint not null, primary key +# is_pinned :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# query :string +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint not null +# tag_id :bigint +# tenant_id :bigint not null +# one: tenant: ssd author: basic diff --git a/test/fixtures/fs/form_related_documents.yml b/test/fixtures/fs/form_related_documents.yml index 1af00d39a..9d3de8b73 100644 --- a/test/fixtures/fs/form_related_documents.yml +++ b/test/fixtures/fs/form_related_documents.yml @@ -1,5 +1,17 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: fs_form_related_documents +# +# id :bigint not null, primary key +# data :string not null +# document_type :string not null +# language :string not null +# created_at :datetime not null +# updated_at :datetime not null +# fs_form_id :bigint not null +# V2Pv21_xsd: document_type: CLS_F_XSD_EDOC language: sk diff --git a/test/fixtures/fs/forms.yml b/test/fixtures/fs/forms.yml index 49f19feb7..8f20fff61 100644 --- a/test/fixtures/fs/forms.yml +++ b/test/fixtures/fs/forms.yml @@ -1,5 +1,22 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: fs_forms +# +# id :bigint not null, primary key +# ez_signature :boolean +# group_name :string +# identifier :string not null +# name :string not null +# number_identifier :integer +# signature_required :boolean +# slug :string +# submission_type_identifier :string +# subtype_name :string +# created_at :datetime not null +# updated_at :datetime not null +# V2Pv21: identifier: '2682_712' name: Vyhlásenie o poukázaní sumy do výšky 2% (3%) zaplatenej dane za zdaňovacie obdobie 2021 diff --git a/test/fixtures/govbox/folders.yml b/test/fixtures/govbox/folders.yml index 5287801ec..f96fbf809 100644 --- a/test/fixtures/govbox/folders.yml +++ b/test/fixtures/govbox/folders.yml @@ -1,5 +1,18 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: govbox_folders +# +# id :bigint not null, primary key +# name :string not null +# system :boolean not null +# created_at :datetime not null +# updated_at :datetime not null +# box_id :bigint not null +# edesk_folder_id :integer not null +# parent_folder_id :bigint +# ssd_one: edesk_folder_id: 123456 box: ssd_main diff --git a/test/fixtures/govbox/messages.yml b/test/fixtures/govbox/messages.yml index 1ba47166f..3fca8d0d3 100644 --- a/test/fixtures/govbox/messages.yml +++ b/test/fixtures/govbox/messages.yml @@ -1,5 +1,20 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: govbox_messages +# +# id :bigint not null, primary key +# delivered_at :datetime not null +# edesk_class :string not null +# payload :json not null +# created_at :datetime not null +# updated_at :datetime not null +# correlation_id :uuid not null +# edesk_message_id :bigint not null +# folder_id :bigint not null +# message_id :uuid not null +# one: message_id: <%= SecureRandom.uuid %> correlation_id: a50cbb56-4da8-4499-b57c-e53c41b44930 diff --git a/test/fixtures/group_memberships.yml b/test/fixtures/group_memberships.yml index b7a97d927..116297e7a 100644 --- a/test/fixtures/group_memberships.yml +++ b/test/fixtures/group_memberships.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: group_memberships +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# group_id :bigint not null +# user_id :bigint not null +# ssd_basic_basic_user: user: basic group: ssd_basic_user diff --git a/test/fixtures/groups.yml b/test/fixtures/groups.yml index 5137aa621..60b9bc1e6 100644 --- a/test/fixtures/groups.yml +++ b/test/fixtures/groups.yml @@ -1,5 +1,17 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: groups +# +# id :bigint not null, primary key +# group_type :enum +# name :string not null +# type :string not null +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint not null +# ssd_all: name: all type: AllGroup diff --git a/test/fixtures/message_object_data.yml b/test/fixtures/message_object_data.yml index d824a1f31..04ed16c1c 100644 --- a/test/fixtures/message_object_data.yml +++ b/test/fixtures/message_object_data.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_object_data +# +# id :bigint not null, primary key +# blob :binary not null +# created_at :datetime not null +# updated_at :datetime not null +# message_object_id :bigint not null +# one: message_object: ssd_main_general_one_attachment blob: MyText diff --git a/test/fixtures/message_objects.yml b/test/fixtures/message_objects.yml index 4c5628b0e..b2ab3ad80 100644 --- a/test/fixtures/message_objects.yml +++ b/test/fixtures/message_objects.yml @@ -1,5 +1,20 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_objects +# +# id :bigint not null, primary key +# is_signed :boolean +# mimetype :string +# name :string +# object_type :string not null +# uuid :uuid +# visualizable :boolean +# created_at :datetime not null +# updated_at :datetime not null +# message_id :bigint not null +# ssd_main_general_one_attachment: message: ssd_main_general_one name: MyString diff --git a/test/fixtures/message_objects_tags.yml b/test/fixtures/message_objects_tags.yml index c77cdc905..72c3fe33b 100644 --- a/test/fixtures/message_objects_tags.yml +++ b/test/fixtures/message_objects_tags.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_objects_tags +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# message_object_id :bigint not null +# tag_id :bigint not null +# ssd_main_draft_to_be_signed_draft_one_form_signature_requested: message_object: ssd_main_draft_to_be_signed_draft_one_form tag: ssd_signer_user_signature_requested diff --git a/test/fixtures/message_thread_merge_identifiers.yml b/test/fixtures/message_thread_merge_identifiers.yml index 5951701c6..51a23b81f 100644 --- a/test/fixtures/message_thread_merge_identifiers.yml +++ b/test/fixtures/message_thread_merge_identifiers.yml @@ -1,5 +1,16 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_thread_merge_identifiers +# +# id :bigint not null, primary key +# uuid :uuid not null +# created_at :datetime not null +# updated_at :datetime not null +# box_id :bigint not null +# message_thread_id :bigint not null +# ssd_main_general_one: message_thread: ssd_main_general uuid: <%= SecureRandom.uuid %> diff --git a/test/fixtures/message_thread_notes.yml b/test/fixtures/message_thread_notes.yml index 431bb6cb8..0900036f6 100644 --- a/test/fixtures/message_thread_notes.yml +++ b/test/fixtures/message_thread_notes.yml @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: message_thread_notes +# +# id :bigint not null, primary key +# note :text +# created_at :datetime not null +# updated_at :datetime not null +# message_thread_id :bigint not null +# one: message_thread: ssd_main_general note: "Insider Note1" diff --git a/test/fixtures/message_threads.yml b/test/fixtures/message_threads.yml index 4cc60e30a..948d4af16 100644 --- a/test/fixtures/message_threads.yml +++ b/test/fixtures/message_threads.yml @@ -1,5 +1,19 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_threads +# +# id :bigint not null, primary key +# delivered_at :datetime not null +# last_message_delivered_at :datetime not null +# original_title :string not null +# title :string not null +# created_at :datetime not null +# updated_at :datetime not null +# box_id :bigint not null +# folder_id :bigint +# ssd_main_general: box: ssd_main title: General agenda SSD diff --git a/test/fixtures/message_threads_tags.yml b/test/fixtures/message_threads_tags.yml index 28b65ed05..c946dfca3 100644 --- a/test/fixtures/message_threads_tags.yml +++ b/test/fixtures/message_threads_tags.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_threads_tags +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# message_thread_id :bigint not null +# tag_id :bigint not null +# ssd_main_general_finance: message_thread: ssd_main_general tag: ssd_finance diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index 7c252063f..65d41cc8e 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -1,5 +1,28 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: messages +# +# id :bigint not null, primary key +# collapsed :boolean default(FALSE), not null +# delivered_at :datetime not null +# html_visualization :text +# metadata :json +# outbox :boolean default(FALSE), not null +# read :boolean default(FALSE), not null +# recipient_name :string +# replyable :boolean default(TRUE), not null +# sender_name :string +# title :string +# type :string +# uuid :uuid not null +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint +# import_id :bigint +# message_thread_id :bigint not null +# ssd_main_general_one: uuid: <%= SecureRandom.uuid %> title: The First Message diff --git a/test/fixtures/messages_tags.yml b/test/fixtures/messages_tags.yml index 1afc0d818..50a1412fd 100644 --- a/test/fixtures/messages_tags.yml +++ b/test/fixtures/messages_tags.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: messages_tags +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# message_id :bigint not null +# tag_id :bigint not null +# ssd_main_general_one_external: message: ssd_main_general_one tag: ssd_external diff --git a/test/fixtures/notifications.yml b/test/fixtures/notifications.yml index a90503903..14e9e10f1 100644 --- a/test/fixtures/notifications.yml +++ b/test/fixtures/notifications.yml @@ -1 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: notifications +# +# id :bigint not null, primary key +# filter_name :string not null +# type :string not null +# created_at :datetime not null +# updated_at :datetime not null +# filter_subscription_id :bigint +# message_id :bigint +# message_thread_id :bigint not null +# user_id :bigint not null +# diff --git a/test/fixtures/tag_groups.yml b/test/fixtures/tag_groups.yml index 856268e80..ef9f3c5ed 100644 --- a/test/fixtures/tag_groups.yml +++ b/test/fixtures/tag_groups.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: tag_groups +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# group_id :bigint not null +# tag_id :bigint not null +# drafts_basic_user: tag: ssd_basic_user_drafts group: ssd_basic_user diff --git a/test/fixtures/tags.yml b/test/fixtures/tags.yml index b8c4d4775..9cd800970 100644 --- a/test/fixtures/tags.yml +++ b/test/fixtures/tags.yml @@ -1,5 +1,22 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# color :enum +# external_name :string +# icon :string +# name :string not null +# tag_groups_count :integer default(0), not null +# type :string not null +# visible :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# owner_id :bigint +# tenant_id :bigint not null +# ssd_finance: name: Finance type: SimpleTag diff --git a/test/fixtures/tenants.yml b/test/fixtures/tenants.yml index 67893b680..118b8fa4e 100644 --- a/test/fixtures/tenants.yml +++ b/test/fixtures/tenants.yml @@ -1,5 +1,16 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: tenants +# +# id :bigint not null, primary key +# api_token_public_key :string +# feature_flags :string default([]), is an Array +# name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# ssd: name: SSD feature_flags: diff --git a/test/fixtures/upvs/form_related_documents.yml b/test/fixtures/upvs/form_related_documents.yml index 4e5508d12..d97954848 100644 --- a/test/fixtures/upvs/form_related_documents.yml +++ b/test/fixtures/upvs/form_related_documents.yml @@ -1,5 +1,17 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: upvs_form_related_documents +# +# id :bigint not null, primary key +# data :string not null +# document_type :string not null +# language :string not null +# created_at :datetime not null +# updated_at :datetime not null +# upvs_form_id :bigint not null +# general_agenda_xsd: data: document_type: CLS_F_XSD_EDOC @@ -760,4 +772,4 @@ fs_eud_v1_0_fo_xsl: document_type: CLS_F_XSL_FO language: sk - form: fs_eud_v1_0 \ No newline at end of file + form: fs_eud_v1_0 diff --git a/test/fixtures/upvs/forms.yml b/test/fixtures/upvs/forms.yml index db17d8193..dfd77ddc5 100644 --- a/test/fixtures/upvs/forms.yml +++ b/test/fixtures/upvs/forms.yml @@ -1,5 +1,15 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: upvs_forms +# +# id :bigint not null, primary key +# identifier :string not null +# version :string not null +# created_at :datetime not null +# updated_at :datetime not null +# general_agenda: identifier: App.GeneralAgenda version: 1.9 diff --git a/test/fixtures/upvs/message_templates.yml b/test/fixtures/upvs/message_templates.yml index dbea37d6b..d6ac969ab 100644 --- a/test/fixtures/upvs/message_templates.yml +++ b/test/fixtures/upvs/message_templates.yml @@ -1,5 +1,19 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: message_templates +# +# id :bigint not null, primary key +# content :text not null +# metadata :jsonb +# name :string not null +# system :boolean default(FALSE), not null +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# message_reply: content: {{ Predmet:text_field }} diff --git a/test/fixtures/upvs/service_with_form_allow_rules.yml b/test/fixtures/upvs/service_with_form_allow_rules.yml index f927ddb72..ba956ffa5 100644 --- a/test/fixtures/upvs/service_with_form_allow_rules.yml +++ b/test/fixtures/upvs/service_with_form_allow_rules.yml @@ -1,5 +1,18 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: upvs_service_with_form_allow_rules +# +# id :bigint not null, primary key +# institution_name :string +# institution_uri :string not null +# name :string +# schema_url :string +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# general_agenda: institution_name: Test OVM identity institution_uri: ico://sk/12345678 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 67f5bfc6b..f7b568f4f 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,5 +1,19 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: users +# +# id :bigint not null, primary key +# email :string not null +# name :string not null +# notifications_last_opened_at :datetime +# notifications_reset_at :datetime +# saml_identifier :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# basic: name: Basic user email: basic_user@email.com diff --git a/test/integration/tenant_api_test.rb b/test/integration/tenant_api_test.rb index c997686e4..8b651aeab 100644 --- a/test/integration/tenant_api_test.rb +++ b/test/integration/tenant_api_test.rb @@ -27,7 +27,7 @@ class TenantApiTest < ActionDispatch::IntegrationTest assert_response :bad_request json_response = JSON.parse(response.body) - assert_match "param is missing or the value is empty: admin", json_response["message"] + assert_match "param is missing or the value is empty or invalid: admin", json_response["message"] end test "can destroy tenant" do diff --git a/test/jobs/govbox/process_unathorized_delivery_notification_job_test.rb b/test/jobs/govbox/process_unathorized_delivery_notification_job_test.rb index 519c0f2e7..0e021ccff 100644 --- a/test/jobs/govbox/process_unathorized_delivery_notification_job_test.rb +++ b/test/jobs/govbox/process_unathorized_delivery_notification_job_test.rb @@ -19,7 +19,8 @@ class Govbox::ProcessMessageJobTest < ActiveJob::TestCase Govbox::ProcessUnauthorizedDeliveryNotificationJob.new.perform(govbox_message) end - assert_enqueued_with(job: Govbox::ProcessUnauthorizedDeliveryNotificationJob, at: Time.parse(govbox_message.delivery_notification['delivery_period_end_at'])) + assert_equal "Govbox::ProcessUnauthorizedDeliveryNotificationJob", GoodJob::Job.last.job_class + assert_equal Time.parse(govbox_message.delivery_notification['delivery_period_end_at']), GoodJob::Job.last.scheduled_at assert_equal message.changed?, false assert_equal govbox_message.changed?, false end diff --git a/test/jobs/govbox/sync_box_job_test.rb b/test/jobs/govbox/sync_box_job_test.rb index 56c21100f..c4889e47e 100644 --- a/test/jobs/govbox/sync_box_job_test.rb +++ b/test/jobs/govbox/sync_box_job_test.rb @@ -34,9 +34,9 @@ class Govbox::SyncBoxJobTest < ActiveJob::TestCase ]] ::Upvs::GovboxApi::Edesk.stub :new, edesk_api_mock do - assert_enqueued_with(job: Govbox::SyncFolderJob, priority: 1000) do - Govbox::SyncBoxJob.set(job_context: :later).perform_now(box) - end + Govbox::SyncBoxJob.set(job_context: :later).perform_now(box) + assert_equal "Govbox::SyncFolderJob", GoodJob::Job.last.job_class + assert_equal 1000, GoodJob::Job.last.priority end end @@ -73,9 +73,9 @@ class Govbox::SyncBoxJobTest < ActiveJob::TestCase ]] ::Upvs::GovboxApi::Edesk.stub :new, edesk_api_mock do - assert_enqueued_with(job: Govbox::SyncFolderJob, priority: nil) do - Govbox::SyncBoxJob.perform_now(box) - end + Govbox::SyncBoxJob.perform_now(box) + assert_equal "Govbox::SyncFolderJob", GoodJob::Job.first.job_class + assert_equal 0, GoodJob::Job.first.priority end end end diff --git a/test/jobs/govbox/sync_folder_job_test.rb b/test/jobs/govbox/sync_folder_job_test.rb index 069793fb0..6f778122e 100644 --- a/test/jobs/govbox/sync_folder_job_test.rb +++ b/test/jobs/govbox/sync_folder_job_test.rb @@ -46,7 +46,7 @@ class Govbox::SyncFolderJobTest < ActiveJob::TestCase Govbox::SyncFolderJob.new.perform(folder) end - assert_enqueued_jobs 4 + assert_equal 4, GoodJob::Job.count end test "does not download older messages than box sync_since value in box settings" do @@ -96,6 +96,6 @@ class Govbox::SyncFolderJobTest < ActiveJob::TestCase Govbox::SyncFolderJob.new.perform(folder) end - assert_enqueued_jobs 2 + assert_equal 2, GoodJob::Job.count end end diff --git a/test/lib/event_bus_test.rb b/test/lib/event_bus_test.rb index e4f58b8c7..c553dd17d 100644 --- a/test/lib/event_bus_test.rb +++ b/test/lib/event_bus_test.rb @@ -3,14 +3,11 @@ require "test_helper" class EventBusTest < ActiveSupport::TestCase - include ActiveJob::TestHelper - - test ":message_draft_changed event schedules Searchable::ReindexMessageThreadJob" do + test ":message_draft_changed event schedules Searchable::ReindexMessageThreadJob" do message = messages(:ssd_main_general_draft_one) - assert_enqueued_with(job: Searchable::ReindexMessageThreadJob) do - message.update(html_visualization: 'some junktext') - end + message.update(html_visualization: 'some junktext') + assert_equal "Searchable::ReindexMessageThreadJob", GoodJob::Job.last.job_class end test "should fire matching subscribers" do diff --git a/test/models/api_connection_test.rb b/test/models/api_connection_test.rb index f6d510f40..5ff33855a 100644 --- a/test/models/api_connection_test.rb +++ b/test/models/api_connection_test.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: api_connections +# +# id :bigint not null, primary key +# api_token_private_key :string not null +# obo :uuid +# settings :jsonb +# sub :string not null +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# require "test_helper" class ApiConnectionTest < ActiveSupport::TestCase diff --git a/test/models/automation/rule_test.rb b/test/models/automation/rule_test.rb index 4f01ce7fa..bff51974e 100644 --- a/test/models/automation/rule_test.rb +++ b/test/models/automation/rule_test.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: automation_rules +# +# id :bigint not null, primary key +# name :string not null +# trigger_event :string not null +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint not null +# user_id :bigint not null +# require 'test_helper' class Automation::RuleTest < ActiveSupport::TestCase diff --git a/test/models/automation/webhook_test.rb b/test/models/automation/webhook_test.rb index 8c3e5fea7..f64a55cfb 100644 --- a/test/models/automation/webhook_test.rb +++ b/test/models/automation/webhook_test.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: automation_webhooks +# +# id :bigint not null, primary key +# name :string not null +# url :string not null +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint not null +# require "test_helper" class Automation::WebhookTest < ActiveSupport::TestCase diff --git a/test/models/box_test.rb b/test/models/box_test.rb index c3dd7c0e6..ab70d1a63 100644 --- a/test/models/box_test.rb +++ b/test/models/box_test.rb @@ -1,8 +1,23 @@ +# == Schema Information +# +# Table name: boxes +# +# id :bigint not null, primary key +# color :enum +# name :string not null +# settings :jsonb +# short_name :string +# syncable :boolean default(TRUE), not null +# type :string +# uri :string not null +# created_at :datetime not null +# updated_at :datetime not null +# api_connection_id :bigint +# tenant_id :bigint not null +# require "test_helper" class BoxTest < ActiveSupport::TestCase - include ActiveJob::TestHelper - test "should not be valid if obo value present in settings when api_connection is a Govbox::ApiConnection without tenant" do box = boxes(:google_box_with_govbox_api_connection) assert box.valid? @@ -33,17 +48,16 @@ class BoxTest < ActiveSupport::TestCase test "sync method schedules Govbox::SyncBoxJob with highest priority" do box = boxes(:ssd_main) - assert_enqueued_with(job: Govbox::SyncBoxJob, priority: -1000) do - box.sync - end + box.sync + assert_equal "Govbox::SyncBoxJob", GoodJob::Job.last.job_class + assert_equal -1000, GoodJob::Job.last.priority end test "sync_all schedules sync of all boxes" do - assert_enqueued_with(job: Govbox::SyncBoxJob) do - Box.sync_all - end + Box.sync_all + assert_equal "Govbox::SyncBoxJob", GoodJob::Job.last.job_class - assert_enqueued_jobs Upvs::Box.where(syncable: true).count + assert_equal Upvs::Box.where(syncable: true).count, GoodJob::Job.count end test "should not be valid if same obo value present in other boxes within connection" do diff --git a/test/models/everything_tag_test.rb b/test/models/everything_tag_test.rb index 5ec2dca4f..6b602c9f0 100644 --- a/test/models/everything_tag_test.rb +++ b/test/models/everything_tag_test.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# color :enum +# external_name :string +# icon :string +# name :string not null +# tag_groups_count :integer default(0), not null +# type :string not null +# visible :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# owner_id :bigint +# tenant_id :bigint not null +# require "test_helper" class EverythingTagTest < ActiveSupport::TestCase diff --git a/test/models/filter_subscription_test.rb b/test/models/filter_subscription_test.rb index 134d1df36..37c576afc 100644 --- a/test/models/filter_subscription_test.rb +++ b/test/models/filter_subscription_test.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: filter_subscriptions +# +# id :bigint not null, primary key +# events :string default([]), not null, is an Array +# last_notify_run_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# filter_id :bigint not null +# tenant_id :bigint not null +# user_id :bigint not null +# require "test_helper" class FilterSubscriptionTest < ActiveSupport::TestCase diff --git a/test/models/filter_test.rb b/test/models/filter_test.rb index f9dee97f8..e2cb2bdfc 100644 --- a/test/models/filter_test.rb +++ b/test/models/filter_test.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: filters +# +# id :bigint not null, primary key +# is_pinned :boolean default(FALSE), not null +# name :string not null +# position :integer not null +# query :string +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint not null +# tag_id :bigint +# tenant_id :bigint not null +# require "test_helper" class FilterTest < ActiveSupport::TestCase diff --git a/test/models/fs/api_connection_test.rb b/test/models/fs/api_connection_test.rb index 5aa7430c7..532fbe532 100644 --- a/test/models/fs/api_connection_test.rb +++ b/test/models/fs/api_connection_test.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: api_connections +# +# id :bigint not null, primary key +# api_token_private_key :string not null +# obo :uuid +# settings :jsonb +# sub :string not null +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# require "test_helper" class Fs::ApiConnectionTest < ActiveSupport::TestCase diff --git a/test/models/fs/box_test.rb b/test/models/fs/box_test.rb index c9221af32..78d8a03f1 100644 --- a/test/models/fs/box_test.rb +++ b/test/models/fs/box_test.rb @@ -1,5 +1,22 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: boxes +# +# id :bigint not null, primary key +# color :enum +# name :string not null +# settings :jsonb +# short_name :string +# syncable :boolean default(TRUE), not null +# type :string +# uri :string not null +# created_at :datetime not null +# updated_at :datetime not null +# api_connection_id :bigint +# tenant_id :bigint not null +# require "test_helper" class Fs::BoxTest < ActiveSupport::TestCase diff --git a/test/models/fs/message_draft_test.rb b/test/models/fs/message_draft_test.rb index 8787de5ad..8921ffc76 100644 --- a/test/models/fs/message_draft_test.rb +++ b/test/models/fs/message_draft_test.rb @@ -1,9 +1,31 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: messages +# +# id :bigint not null, primary key +# collapsed :boolean default(FALSE), not null +# delivered_at :datetime not null +# html_visualization :text +# metadata :json +# outbox :boolean default(FALSE), not null +# read :boolean default(FALSE), not null +# recipient_name :string +# replyable :boolean default(TRUE), not null +# sender_name :string +# title :string +# type :string +# uuid :uuid not null +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint +# import_id :bigint +# message_thread_id :bigint not null +# require "test_helper" class Fs::MessageDraftTest < ActiveSupport::TestCase - include ActiveJob::TestHelper include ActionDispatch::TestProcess::FixtureFile test "create_and_validate_with_fs_form method schedules Fs::ValidateMessageDraftJob" do @@ -17,9 +39,8 @@ class Fs::MessageDraftTest < ActiveSupport::TestCase [file_fixture("fs/dic1122334455_fs3055_781__sprava_dani_2023.xml").read] FsEnvironment.fs_client.stub :api, fs_api do - assert_enqueued_with(job: Fs::ValidateMessageDraftJob) do - Fs::MessageDraft.create_and_validate_with_fs_form(form_files: [fixture_file_upload("fs/dic1122334455_fs3055_781__sprava_dani_2023.xml", "application/xml")], author: author) - end + Fs::MessageDraft.create_and_validate_with_fs_form(form_files: [fixture_file_upload("fs/dic1122334455_fs3055_781__sprava_dani_2023.xml", "application/xml")], author: author) + assert_equal "Fs::ValidateMessageDraftJob", GoodJob::Job.last.job_class end message_draft = Fs::MessageDraft.last diff --git a/test/models/govbox/authorize_delivery_notification_action_test.rb b/test/models/govbox/authorize_delivery_notification_action_test.rb index 744e760bd..8b6d3930a 100644 --- a/test/models/govbox/authorize_delivery_notification_action_test.rb +++ b/test/models/govbox/authorize_delivery_notification_action_test.rb @@ -1,13 +1,11 @@ require "test_helper" class Govbox::AuthorizeDeliveryNotificationActionTest < ActiveSupport::TestCase - include ActiveJob::TestHelper - test "schedules Govbox::AuthorizeDeliveryNotificationJob with highest priority" do message = messages(:solver_main_delivery_notification_two) - assert_enqueued_with(job: Govbox::AuthorizeDeliveryNotificationJob, priority: -1000) do - Govbox::AuthorizeDeliveryNotificationAction.run(message) - end + Govbox::AuthorizeDeliveryNotificationAction.run(message) + assert_equal "Govbox::AuthorizeDeliveryNotificationJob", GoodJob::Job.last.job_class + assert_equal -1000, GoodJob::Job.last.priority end end diff --git a/test/models/govbox/folder_test.rb b/test/models/govbox/folder_test.rb index 610c32514..acbcea382 100644 --- a/test/models/govbox/folder_test.rb +++ b/test/models/govbox/folder_test.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: govbox_folders +# +# id :bigint not null, primary key +# name :string not null +# system :boolean not null +# created_at :datetime not null +# updated_at :datetime not null +# box_id :bigint not null +# edesk_folder_id :integer not null +# parent_folder_id :bigint +# require "test_helper" class Govbox::FolderTest < ActiveSupport::TestCase diff --git a/test/models/govbox/message_test.rb b/test/models/govbox/message_test.rb index b73a07764..916eba87e 100644 --- a/test/models/govbox/message_test.rb +++ b/test/models/govbox/message_test.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: govbox_messages +# +# id :bigint not null, primary key +# delivered_at :datetime not null +# edesk_class :string not null +# payload :json not null +# created_at :datetime not null +# updated_at :datetime not null +# correlation_id :uuid not null +# edesk_message_id :bigint not null +# folder_id :bigint not null +# message_id :uuid not null +# require "test_helper" class Govbox::MessageTest < ActiveSupport::TestCase diff --git a/test/models/group_membership_test.rb b/test/models/group_membership_test.rb index 6509ed7af..591da8d35 100644 --- a/test/models/group_membership_test.rb +++ b/test/models/group_membership_test.rb @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: group_memberships +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# group_id :bigint not null +# user_id :bigint not null +# require "test_helper" class GroupMembershipTest < ActiveSupport::TestCase diff --git a/test/models/message_draft_test.rb b/test/models/message_draft_test.rb index c2d4921c5..cf5462f2a 100644 --- a/test/models/message_draft_test.rb +++ b/test/models/message_draft_test.rb @@ -1,8 +1,29 @@ +# == Schema Information +# +# Table name: messages +# +# id :bigint not null, primary key +# collapsed :boolean default(FALSE), not null +# delivered_at :datetime not null +# html_visualization :text +# metadata :json +# outbox :boolean default(FALSE), not null +# read :boolean default(FALSE), not null +# recipient_name :string +# replyable :boolean default(TRUE), not null +# sender_name :string +# title :string +# type :string +# uuid :uuid not null +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint +# import_id :bigint +# message_thread_id :bigint not null +# require "test_helper" class MessageDraftTest < ActiveSupport::TestCase - include ActiveJob::TestHelper - test "created! method publishes events on EventBus" do box = boxes(:ssd_main) message = MessageDraft.create( @@ -138,8 +159,8 @@ class MessageDraftTest < ActiveSupport::TestCase test "single draft submission schedules jobs with highest priority" do message_draft = messages(:ssd_main_draft) - assert_enqueued_with(job: Govbox::SubmitMessageDraftJob, priority: -1000) do - message_draft.submit - end + message_draft.submit + assert_equal "Govbox::SubmitMessageDraftJob", GoodJob::Job.first.job_class + assert_equal -1000, GoodJob::Job.first.priority end end diff --git a/test/models/message_object_datum_test.rb b/test/models/message_object_datum_test.rb index 95585f48f..de3f43a90 100644 --- a/test/models/message_object_datum_test.rb +++ b/test/models/message_object_datum_test.rb @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: message_object_data +# +# id :bigint not null, primary key +# blob :binary not null +# created_at :datetime not null +# updated_at :datetime not null +# message_object_id :bigint not null +# require "test_helper" class MessageObjectDatumTest < ActiveSupport::TestCase diff --git a/test/models/message_object_test.rb b/test/models/message_object_test.rb index f3e109145..65eb04ded 100644 --- a/test/models/message_object_test.rb +++ b/test/models/message_object_test.rb @@ -1,3 +1,18 @@ +# == Schema Information +# +# Table name: message_objects +# +# id :bigint not null, primary key +# is_signed :boolean +# mimetype :string +# name :string +# object_type :string not null +# uuid :uuid +# visualizable :boolean +# created_at :datetime not null +# updated_at :datetime not null +# message_id :bigint not null +# require "test_helper" class MessageObjectTest < ActiveSupport::TestCase diff --git a/test/models/message_objects_tag_test.rb b/test/models/message_objects_tag_test.rb index 0c9420767..40f7d7f1b 100644 --- a/test/models/message_objects_tag_test.rb +++ b/test/models/message_objects_tag_test.rb @@ -1,3 +1,13 @@ +# == Schema Information +# +# Table name: message_objects_tags +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# message_object_id :bigint not null +# tag_id :bigint not null +# require "test_helper" class MessageObjectsTagTest < ActiveSupport::TestCase diff --git a/test/models/message_test.rb b/test/models/message_test.rb index 05fcc517d..1e7ab5b44 100644 --- a/test/models/message_test.rb +++ b/test/models/message_test.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: messages +# +# id :bigint not null, primary key +# collapsed :boolean default(FALSE), not null +# delivered_at :datetime not null +# html_visualization :text +# metadata :json +# outbox :boolean default(FALSE), not null +# read :boolean default(FALSE), not null +# recipient_name :string +# replyable :boolean default(TRUE), not null +# sender_name :string +# title :string +# type :string +# uuid :uuid not null +# created_at :datetime not null +# updated_at :datetime not null +# author_id :bigint +# import_id :bigint +# message_thread_id :bigint not null +# require "test_helper" class MessageTest < ActiveSupport::TestCase diff --git a/test/models/message_thread_test.rb b/test/models/message_thread_test.rb index 814014026..f286900f4 100644 --- a/test/models/message_thread_test.rb +++ b/test/models/message_thread_test.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: message_threads +# +# id :bigint not null, primary key +# delivered_at :datetime not null +# last_message_delivered_at :datetime not null +# original_title :string not null +# title :string not null +# created_at :datetime not null +# updated_at :datetime not null +# box_id :bigint not null +# folder_id :bigint +# require "test_helper" class MessageThreadTest < ActiveSupport::TestCase diff --git a/test/models/notification_test.rb b/test/models/notification_test.rb index a76e08d66..d0a7218d4 100644 --- a/test/models/notification_test.rb +++ b/test/models/notification_test.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: notifications +# +# id :bigint not null, primary key +# filter_name :string not null +# type :string not null +# created_at :datetime not null +# updated_at :datetime not null +# filter_subscription_id :bigint +# message_id :bigint +# message_thread_id :bigint not null +# user_id :bigint not null +# require "test_helper" class NotificationTest < ActiveSupport::TestCase diff --git a/test/models/tag_test.rb b/test/models/tag_test.rb index b4abcd82f..590b3903d 100644 --- a/test/models/tag_test.rb +++ b/test/models/tag_test.rb @@ -1,3 +1,20 @@ +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# color :enum +# external_name :string +# icon :string +# name :string not null +# tag_groups_count :integer default(0), not null +# type :string not null +# visible :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# owner_id :bigint +# tenant_id :bigint not null +# require "test_helper" class TagTest < ActiveSupport::TestCase diff --git a/test/models/tenant_test.rb b/test/models/tenant_test.rb index 8d992e867..442aad5df 100644 --- a/test/models/tenant_test.rb +++ b/test/models/tenant_test.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: tenants +# +# id :bigint not null, primary key +# api_token_public_key :string +# feature_flags :string default([]), is an Array +# name :string not null +# created_at :datetime not null +# updated_at :datetime not null +# require "test_helper" class TenantTest < ActiveSupport::TestCase diff --git a/test/models/upvs/message_template_test.rb b/test/models/upvs/message_template_test.rb index 6e8dc1cec..6adafa0c3 100644 --- a/test/models/upvs/message_template_test.rb +++ b/test/models/upvs/message_template_test.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: message_templates +# +# id :bigint not null, primary key +# content :text not null +# metadata :jsonb +# name :string not null +# system :boolean default(FALSE), not null +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# tenant_id :bigint +# require "test_helper" class Upvs::MessageTemplateTest < ActiveSupport::TestCase diff --git a/test/system/message_drafts_test.rb b/test/system/message_drafts_test.rb index 24e8e6cbf..312b6a10b 100644 --- a/test/system/message_drafts_test.rb +++ b/test/system/message_drafts_test.rb @@ -19,6 +19,7 @@ class MessageDraftsTest < ApplicationSystemTestCase end test "user can create message draft as reply on replyable message" do + skip end test "templated message draft content is searchable" do diff --git a/test/system/upvs/message_drafts_test.rb b/test/system/upvs/message_drafts_test.rb index 97c6a3c48..852199cd6 100644 --- a/test/system/upvs/message_drafts_test.rb +++ b/test/system/upvs/message_drafts_test.rb @@ -11,17 +11,22 @@ class Upvs::MessageDraftsTest < ApplicationSystemTestCase end test "user can create message draft from Všeobecná agenda MessageTemplate" do + skip end test "user can create message draft from CRAC MessageTemplate" do + skip end test "user can update message draft content" do + skip end test "user can submit message draft" do + skip end test "user can delete message draft" do + skip end end diff --git a/app/assets/builds/.keep b/vendor/javascript/.keep similarity index 100% rename from app/assets/builds/.keep rename to vendor/javascript/.keep