forked from trebonian/crowdsource-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.rb
104 lines (87 loc) · 2.45 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/db/development.db")
### MODELS
class User
include DataMapper::Resource
property :id, Serial
property :name, String, :unique_index => true
property :real_name, String
property :email, String, :unique_index => true
property :location, String
property :salt, String
property :hashpass, String # 'hash' is a restricted property
property :points, Integer
property :promotion_level, Integer
property :quality_factor, Integer
property :admin, Boolean
#team information
property :team_id, Integer
property :created_at, DateTime
end
class Chip
include DataMapper::Resource
property :id, Serial
property :name, String
property :wikiURL, Text
property :description, Text
property :maxx, Integer
property :maxy, Integer
property :created_at, DateTime
end
class Layer
include DataMapper::Resource
property :id, Serial
property :name, String
property :chip_id, Integer
property :itype, String
property :short_text, Text
property :long_text, Text
property :thumbnail, Text
property :created_at, DateTime
end
class Tile
include DataMapper::Resource
property :id, Serial
property :layer_id, Integer
#current tile mechanism
property :x_coord, Integer
property :y_coord, Integer
#this represents some different mapping:
property :minx, Integer
property :miny, Integer
property :sizex, Integer
property :sizey, Integer
property :jpeg, Text
property :png, Text
property :thumbnail, Text
end
=begin
What is this?
class Photolayer
include DataMapper::Resource
property :id, Serial
property :name, String
end
=end
class Submission
include DataMapper::Resource
property :id, Serial
property :user_id, Integer
property :tile_id, Integer
property :rawdata, Text
property :state, String
property :quality_factor, Integer
property :initial_score, Integer
property :bonus_score, Integer
property :current_player_calibre, Integer
property :created_at, DateTime
end
class Line
include DataMapper::Resource
property :id, Serial
property :submission_id, Integer
property :data, Text
property :created_at, DateTime
end