-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Extract Avo::Mappings module with constants
- Loading branch information
1 parent
a63b966
commit 9f8e33c
Showing
2 changed files
with
108 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
module Avo | ||
module Mappings | ||
ASSOCIATIONS_MAPPING ||= { | ||
Check failure on line 3 in lib/avo/mappings.rb GitHub Actions / lint / runner / standardrb
|
||
ActiveRecord::Reflection::BelongsToReflection => { | ||
field: "belongs_to" | ||
}, | ||
ActiveRecord::Reflection::HasOneReflection => { | ||
field: "has_one" | ||
}, | ||
ActiveRecord::Reflection::HasManyReflection => { | ||
field: "has_many" | ||
}, | ||
ActiveRecord::Reflection::HasAndBelongsToManyReflection => { | ||
field: "has_and_belongs_to_many" | ||
} | ||
}.freeze | ||
|
||
ATTACHMENTS_MAPPING ||= { | ||
Check failure on line 18 in lib/avo/mappings.rb GitHub Actions / lint / runner / standardrb
|
||
ActiveRecord::Reflection::HasOneReflection => { | ||
field: "file" | ||
}, | ||
ActiveRecord::Reflection::HasManyReflection => { | ||
field: "files" | ||
} | ||
}.freeze | ||
|
||
FIELDS_MAPPING ||= { | ||
Check failure on line 27 in lib/avo/mappings.rb GitHub Actions / lint / runner / standardrb
|
||
primary_key: { | ||
field: "id" | ||
}, | ||
string: { | ||
field: "text" | ||
}, | ||
text: { | ||
field: "textarea" | ||
}, | ||
integer: { | ||
field: "number" | ||
}, | ||
float: { | ||
field: "number" | ||
}, | ||
decimal: { | ||
field: "number" | ||
}, | ||
datetime: { | ||
field: "date_time" | ||
}, | ||
timestamp: { | ||
field: "date_time" | ||
}, | ||
time: { | ||
field: "date_time" | ||
}, | ||
date: { | ||
field: "date" | ||
}, | ||
binary: { | ||
field: "number" | ||
}, | ||
boolean: { | ||
field: "boolean" | ||
}, | ||
references: { | ||
field: "belongs_to" | ||
}, | ||
json: { | ||
field: "code" | ||
} | ||
}.freeze | ||
|
||
NAMES_MAPPING ||= { | ||
Check failure on line 72 in lib/avo/mappings.rb GitHub Actions / lint / runner / standardrb
|
||
id: { | ||
field: "id" | ||
}, | ||
description: { | ||
field: "textarea" | ||
}, | ||
gravatar: { | ||
field: "gravatar" | ||
}, | ||
email: { | ||
field: "text" | ||
}, | ||
password: { | ||
field: "password" | ||
}, | ||
password_confirmation: { | ||
field: "password" | ||
}, | ||
stage: { | ||
field: "select" | ||
}, | ||
budget: { | ||
field: "currency" | ||
}, | ||
money: { | ||
field: "currency" | ||
}, | ||
country: { | ||
field: "country" | ||
} | ||
}.freeze | ||
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