-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1e9b2b
commit 3762e90
Showing
6 changed files
with
120 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# == Schema Information | ||
# | ||
# Table name: claim_activities | ||
# | ||
# id :uuid not null, primary key | ||
# action :string | ||
# record_type :string not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# record_id :uuid not null | ||
# user_id :uuid not null | ||
# | ||
# Indexes | ||
# | ||
# index_claim_activities_on_record (record_type,record_id) | ||
# index_claim_activities_on_user_id (user_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (user_id => users.id) | ||
# | ||
class Claims::ClaimActivity < ApplicationRecord | ||
belongs_to :user | ||
belongs_to :record, polymorphic: true | ||
|
||
enum :action, { payment_delivered: "payment_delivered" } | ||
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
11 changes: 11 additions & 0 deletions
11
db/migrate/20241217132410_create_claims_claim_activities.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,11 @@ | ||
class CreateClaimsClaimActivities < ActiveRecord::Migration[7.2] | ||
def change | ||
create_table :claim_activities, id: :uuid do |t| | ||
t.string :action | ||
t.references :user, null: false, foreign_key: true, type: :uuid | ||
t.references :record, null: false, polymorphic: true, type: :uuid | ||
|
||
t.timestamps | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# == Schema Information | ||
# | ||
# Table name: claim_activities | ||
# | ||
# id :uuid not null, primary key | ||
# action :string | ||
# record_type :string not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# record_id :uuid not null | ||
# user_id :uuid not null | ||
# | ||
# Indexes | ||
# | ||
# index_claim_activities_on_record (record_type,record_id) | ||
# index_claim_activities_on_user_id (user_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (user_id => users.id) | ||
# | ||
FactoryBot.define do | ||
factory :claim_activity, class: "Claims::ClaimActivity" do | ||
association :user, factory: :claims_support_user | ||
|
||
trait :payment_delivered do | ||
action { "payment_delivered" } | ||
|
||
association :record, factory: :claims_payment | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# == Schema Information | ||
# | ||
# Table name: claim_activities | ||
# | ||
# id :uuid not null, primary key | ||
# action :string | ||
# record_type :string not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# record_id :uuid not null | ||
# user_id :uuid not null | ||
# | ||
# Indexes | ||
# | ||
# index_claim_activities_on_record (record_type,record_id) | ||
# index_claim_activities_on_user_id (user_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# fk_rails_... (user_id => users.id) | ||
# | ||
require "rails_helper" | ||
|
||
RSpec.describe Claims::ClaimActivity, type: :model do | ||
describe "associations" do | ||
it { is_expected.to belong_to(:user) } | ||
it { is_expected.to belong_to(:record) } | ||
end | ||
end |