-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.rb
83 lines (58 loc) · 1.82 KB
/
models.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/keynote-store.db")
class User
include DataMapper::Resource
property :id, Serial
property :user_first_name, String, :required => true
property :user_last_name, String, :required => true
property :user_email, String, :required => true, :unique => true, :format => :email_address
property :password, BCryptHash, :required => true, :length => 255
end
class Theme
include DataMapper::Resource
property :id, Serial
property :created_at, DateTime
property :name, String
property :tagline, String
property :price, Integer
property :style, Text
property :extras, Text
property :list_order, Integer
property :keynote_version, String
property :fonts, String
property :download_size, String
property :theme_sizes, String
property :text_layouts, String
property :photo_layouts, String
property :total_layouts, String
property :extras_slides, String
property :video_tutorial, String
property :promo_one, Integer
property :promo_two, Integer
property :promo_three, Integer
end
class Order
include DataMapper::Resource
property :id, Serial
property :created_at, DateTime
property :order_number, Integer
property :order_first_name, String
property :order_last_name, String
property :order_email, String
property :order_newsletter, Boolean
property :order_discount, Float, :default => 0
property :order_total, Integer
property :stripe_token, String
has n, :purchases
end
class Purchase
include DataMapper::Resource
property :id, Serial
property :created_at, DateTime
property :item_name, String
property :item_id, Integer
property :item_quantity, Integer
property :item_price, Integer
property :item_url, Text
belongs_to :order
end
DataMapper.auto_upgrade!