-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/solver-it-sro/govbox-pro in…
…to GO-195/sync_folders_according_to_box # Conflicts: # app/jobs/govbox/sync_box_job.rb # db/schema.rb
- Loading branch information
Showing
18 changed files
with
1,694 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Govbox | ||
class DestroyBoxDataJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(box_id) | ||
Govbox::ApiConnection.find_by(box_id: box_id).destroy | ||
Govbox::Folder.where(box_id: box_id).destroy_all | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
|
||
resources :message_threads do | ||
collection do | ||
get 'merge' | ||
post 'merge' | ||
end | ||
resources :messages | ||
end | ||
|
43 changes: 43 additions & 0 deletions
43
db/migrate/20230914130304_add_unique_name_index_to_tags.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class AddUniqueNameIndexToTags < ActiveRecord::Migration[7.0] | ||
def up | ||
Tag.connection.select_all( | ||
"select tenant_id, ARRAY_AGG(id) AS ids from tags GROUP BY (tenant_id, LOWER(name)) HAVING COUNT(*) > 1;" | ||
).cast_values.each do |row| | ||
tenant_id, ids = row | ||
|
||
tags = Tag.where(tenant_id: tenant_id).find(ids) | ||
|
||
main_tag = tags[0] | ||
|
||
tags[1..-1].each do |other_tag| | ||
MessagesTag.where(tag_id: other_tag).map do |mt| | ||
mt.tag_id = main_tag.id | ||
mt.save! | ||
end | ||
|
||
MessageThreadsTag.where(tag_id: other_tag).map do |mtt| | ||
mtt.tag_id = main_tag.id | ||
mtt.save! | ||
end | ||
|
||
TagGroup.where(tag_id: other_tag).map do |tg| | ||
tg.tag_id = main_tag.id | ||
tg.save! | ||
end | ||
|
||
TagUser.where(tag_id: other_tag).map do |tu| | ||
tu.tag_id = main_tag.id | ||
tu.save! | ||
end | ||
|
||
other_tag.destroy | ||
end | ||
end | ||
|
||
execute "CREATE UNIQUE INDEX index_tags_on_tenant_id_and_lowercase_name ON tags USING btree (tenant_id, lower(name));" | ||
end | ||
|
||
def down | ||
remove_index :tags, name: "index_tags_on_tenant_id_and_lowercase_name" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ChangeEmailIndexInUsers < ActiveRecord::Migration[7.0] | ||
def up | ||
remove_index :users, name: "index_users_on_tenant_id_and_email" | ||
execute "CREATE UNIQUE INDEX index_users_on_tenant_id_and_lowercase_email ON users USING btree (tenant_id, lower(email));" | ||
end | ||
|
||
def down | ||
remove_index :users, name: "index_users_on_tenant_id_and_lowercase_email" | ||
add_index :users, [:tenant_id, :email], unique: true, name: "index_users_on_tenant_id_and_email" | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
db/migrate/20230919111034_update_replyable_attributes_on_messages.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class UpdateReplyableAttributesOnMessages < ActiveRecord::Migration[7.0] | ||
def change | ||
Message.find_each do |message| | ||
govbox_message = Govbox::Message.find_by(message_id: message.uuid) | ||
message.update(replyable: govbox_message&.replyable? || false) | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20230920093428_update_box_reference_in_govbox_folders.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class UpdateBoxReferenceInGovboxFolders < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_foreign_key :govbox_folders, :boxes | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20230920093653_update_box_reference_in_govbox_api_connections.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class UpdateBoxReferenceInGovboxApiConnections < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_foreign_key :govbox_api_connections, :boxes | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.