|
|
@ -193,6 +193,14 @@ class Category < EntityModel |
|
|
|
@name = data["name"] |
|
|
|
@name = data["name"] |
|
|
|
@color = data["color"] |
|
|
|
@color = data["color"] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def self.create(name, color) |
|
|
|
|
|
|
|
data = { |
|
|
|
|
|
|
|
name: name, |
|
|
|
|
|
|
|
color: color |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
self.insert(data) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
class Image < EntityModel |
|
|
|
class Image < EntityModel |
|
|
@ -212,5 +220,12 @@ class Auction_Category_relation < EntityModel |
|
|
|
@auction_id = data["auction_id"] |
|
|
|
@auction_id = data["auction_id"] |
|
|
|
@category_id = data["category_id"] |
|
|
|
@category_id = data["category_id"] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def self.get_user_roles(user_id) |
|
|
|
|
|
|
|
roleids = self.get "role_id", "user_id = ?", user_id |
|
|
|
|
|
|
|
roles = roleids.map do |ent| |
|
|
|
|
|
|
|
Role.find_by_id(ent["role_id"].to_i) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|