add: home index models

This commit is contained in:
yystopf 2021-11-02 15:56:47 +08:00
parent 2273b4817e
commit 94075717e2
10 changed files with 148 additions and 0 deletions

17
app/models/topic.rb Normal file
View File

@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
class Topic < ApplicationRecord
default_scope { order(order_index: :desc)}
end

View File

@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页平台动态
class Topic::ActivityForum < Topic
end

View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页banner
class Topic::Banner < Topic
end

16
app/models/topic/card.rb Normal file
View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页卡片内容
class Topic::Card < Topic
end

View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页合作伙伴
class Topic::Cooperator < Topic
end

View File

@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页优秀项目
class Topic::ExcellentProject < Topic
end

View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页经验分享
class Topic::ExperienceForum < Topic
end

View File

@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# image_url :string(255)
# url :string(255)
# order_index :integer
#
# 首页精选文章
class Topic::PinnedForum < Topic
end

View File

@ -0,0 +1,12 @@
class CreateTopics < ActiveRecord::Migration[5.2]
def change
create_table :topics do |t|
t.string :type
t.string :title
t.integer :uuid
t.string :image_url
t.string :url
t.integer :order_index
end
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Topic, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end