Created
December 15, 2008 00:14
-
-
Save TheNicholasNick/35835 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Company | |
include DataMapper::Resource | |
property :id , Serial | |
property :sub_domain , String , :nullable => false, :length => 2..10 , :unique_index => true | |
property :name , String , :nullable => false, :length => 100 | |
property :branding_code, String , :nullable => false, :length => 2..10 , :unique_index => true | |
property :active , Boolean , :nullable => false, :default => true | |
property :created_at , DateTime | |
property :updated_at , DateTime | |
has n, :users | |
has n, :rate_plans | |
end |
This file contains hidden or 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
class User | |
include DataMapper::Resource | |
property :id , Serial | |
property :login , String , :nullable => false | |
property :email , String , :nullable => false | |
property :first_name , String , :nullable => false | |
property :last_name , String , :nullable => false | |
property :is_manager , Boolean , :nullable => false, :default => false | |
property :logged_in_at, DateTime | |
property :updated_at , DateTime | |
property :created_at , DateTime | |
has n, :customers | |
belongs_to :company | |
belongs_to :rate_plan | |
end |
This file contains hidden or 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
class RatePlan | |
include DataMapper::Resource | |
property :id , Serial | |
property :updated_at, DateTime | |
property :created_at, DateTime | |
has n, :users | |
has n, :rates | |
has n, :rate_modifiers | |
has n, :productlenders | |
belongs_to :company | |
end |
This file contains hidden or 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
class RateModifier | |
include DataMapper::Resource | |
property :id , Serial | |
property :lender , BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :base , BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :brokerage_percent_low , BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :brokerage_percent_high, BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :created_at , DateTime | |
property :updated_at , DateTime | |
belongs_to :rate_plan | |
end |
This file contains hidden or 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
class Rate | |
include DataMapper::Resource | |
property :id , Serial | |
property :asset_age_high , Integer , :nullable => false | |
property :asset_age_low , Integer , :nullable => false | |
property :finance_amount_low , Integer , :nullable => false | |
property :finance_amount_high, Integer , :nullable => false | |
property :lender , BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :base , BigDecimal, :nullable => false, :scale => 2, :precision => 4 | |
property :created_at , DateTime | |
property :updated_at , DateTime | |
belongs_to :rate_plan | |
end |
This file contains hidden or 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
class Productlender | |
include DataMapper::Resource | |
property :id , Serial | |
property :created_at, DateTime | |
has n, :fees | |
belongs_to :rate_plan | |
belongs_to :product | |
belongs_to :lender | |
end |
This file contains hidden or 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
class Product | |
include DataMapper::Resource | |
property :code , String , :nullable => false, :length => 6..6 ,:key => true # char 1-3 name, char4 paid in advance, char5 has gst, char6 has deposit | |
property :name , String , :nullable => false | |
property :paid_in_advance, Boolean , :nullable => false, :default => false | |
property :has_gst , Boolean , :nullable => false, :default => false | |
property :has_deposit , Boolean , :nullable => false, :default => false | |
property :updated_at , DateTime | |
property :created_at , DateTime | |
has n, :productlenders | |
has n, :lenders, :through => :productlenders | |
end |
This file contains hidden or 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
class Lender | |
include DataMapper::Resource | |
property :code , String , :nullable => false, :length => 3..3, :key => true | |
property :short_name , String , :nullable => false | |
property :long_name , String , :nullable => false | |
# use this when looking up rates | |
# if true amount financed is sans brokerage | |
# if false amount finance is plus brokerage | |
property :rate_includes_brokerage, Boolean , :nullable => false, :default => false | |
property :updated_at , DateTime | |
property :created_at , DateTime | |
has n, :productlenders | |
has n, :products, :through => :productlenders | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment