Skip to content

Commit

Permalink
Merge pull request #245 from Purple-Stock/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
puppe1990 authored May 6, 2024
2 parents ca52d29 + d306497 commit 3744774
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 11 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [push, pull_request]
on: [pull_request]

jobs:
build:
Expand Down Expand Up @@ -36,20 +36,17 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.9.0'
cache: 'yarn'
- run: |
npm install -g yarn@1.22.19
yarn install --check-files
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2

- name: Install dependencies
env:
RAILS_ENV: test
run: |
npm install -g yarn@1.22.19
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
yarn install --check-files
# runs 'bundle install' and cache installed gems automatically
bundler-cache: true

- name: Setup test database
env:
Expand Down
20 changes: 20 additions & 0 deletions app/jobs/change_order_status_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class ChangeOrderStatusJob < ApplicationJob
attr_accessor :account_id

def perform(old_status, new_status, account_id)
orders = Services::Bling::Order.call(order_command: 'find_orders', tenant: account_id,
situation: old_status)
orders = orders['data']

orders_ids = []
orders.each do |order|
orders_ids << order['id'].to_s
end

Services::Bling::UpdateOrderStatus.call(
tenant: account_id,
order_ids: orders_ids,
new_status:
)
end
end
8 changes: 8 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@
args: [1, ((Date.today - 5.days) - 5.days)],
set: { priority: 4 },
description: 'Create Order Items whose statuses are collected every hour'
},

change_in_progress_to_printed: {
cron: '*/10 * * * *',
class: 'ChangeOrderStatusJob',
args: ['15', '95745', 1],
set: { priority: 2 },
description: 'Update new orders to printed status'
}
}
end
8 changes: 8 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@
args: [1, ((Date.today - 5.days) - 5.days)],
set: { priority: 4 },
description: 'Create Order Items whose statuses are collected every hour'
},

change_in_progress_to_printed: {
cron: '*/10 * * * *',
class: 'ChangeOrderStatusJob',
args: ['15', '95745', 1],
set: { priority: 2 },
description: 'Update new orders to printed status'
}
}
end
8 changes: 8 additions & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@
args: [1, ((Date.today - 5.days) - 5.days)],
set: { priority: 4 },
description: 'Create Order Items whose statuses are collected every hour'
},

change_in_progress_to_printed: {
cron: '*/10 * * * *',
class: 'ChangeOrderStatusJob',
args: ['15', '95745', 1],
set: { priority: 2 },
description: 'Update new orders to printed status'
}
}
end
2 changes: 1 addition & 1 deletion dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM ruby:3.3-alpine
FROM ruby:3.0-alpine

LABEL maintainer="gilcierweb@gmail.com"

Expand Down

0 comments on commit 3744774

Please sign in to comment.