From 38d3a0ff14c869d06aa68c4348d8a1e6e66d0526 Mon Sep 17 00:00:00 2001 From: Neetpone <132411956+Neetpone@users.noreply.github.com> Date: Wed, 3 Apr 2024 05:23:50 -0400 Subject: [PATCH] docs: annotate --- app/models/author.rb | 12 ++++++++++++ app/models/chapter.rb | 18 ++++++++++++++++++ app/models/story.rb | 27 +++++++++++++++++++++++++++ app/models/story/tagging.rb | 14 +++++++++++++- app/models/tag.rb | 9 +++++++++ test/fixtures/authors.yml | 13 ++++++++++++- test/fixtures/chapters.yml | 19 ++++++++++++++++++- test/fixtures/stories.yml | 28 +++++++++++++++++++++++++++- test/fixtures/tags.yml | 10 +++++++++- test/models/author_test.rb | 12 ++++++++++++ test/models/chapter_test.rb | 18 ++++++++++++++++++ test/models/story_test.rb | 27 +++++++++++++++++++++++++++ test/models/tag_test.rb | 9 +++++++++ 13 files changed, 211 insertions(+), 5 deletions(-) diff --git a/app/models/author.rb b/app/models/author.rb index 3b39b4e..903da1e 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: authors +# +# id :bigint not null, primary key +# avatar :text +# bio_html :text +# date_joined :datetime not null +# name :text not null +# num_blog_posts :integer default(0), not null +# num_followers :integer default(0), not null +# class Author < ApplicationRecord has_many :stories end diff --git a/app/models/chapter.rb b/app/models/chapter.rb index a40e143..647ef26 100644 --- a/app/models/chapter.rb +++ b/app/models/chapter.rb @@ -1,3 +1,21 @@ +# == Schema Information +# +# Table name: chapters +# +# id :bigint not null, primary key +# body :text +# date_modified :datetime +# date_published :datetime not null +# num_views :integer default(0), not null +# num_words :integer +# number :integer default(1), not null +# title :text not null +# story_id :bigint not null +# +# Indexes +# +# index_chapters_on_story_id (story_id) +# class Chapter < ApplicationRecord belongs_to :story end diff --git a/app/models/story.rb b/app/models/story.rb index 136fbd2..1b355c6 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -1,3 +1,30 @@ +# == Schema Information +# +# Table name: stories +# +# id :bigint not null, primary key +# color :integer +# completion_status :text +# content_rating :text +# cover_image :text +# date_modified :datetime +# date_published :datetime not null +# date_updated :datetime +# description_html :text +# num_comments :integer default(0), not null +# num_views :integer default(0), not null +# num_words :integer not null +# prequel :integer +# rating :integer not null +# short_description :text +# title :text not null +# total_num_views :integer default(0), not null +# author_id :bigint not null +# +# Indexes +# +# index_stories_on_author_id (author_id) +# class Story < ApplicationRecord include FancySearchable::Searchable include Indexable diff --git a/app/models/story/tagging.rb b/app/models/story/tagging.rb index 2349210..8fe5f27 100644 --- a/app/models/story/tagging.rb +++ b/app/models/story/tagging.rb @@ -1,6 +1,18 @@ +# == Schema Information +# +# Table name: story_taggings +# +# story_id :bigint not null +# tag_id :bigint not null +# +# Indexes +# +# index_story_taggings_on_story_id (story_id) +# index_story_taggings_on_tag_id (tag_id) +# class Story::Tagging < ApplicationRecord belongs_to :story belongs_to :tag validates :tag, uniqueness: { scope: [:story_id] } -end \ No newline at end of file +end diff --git a/app/models/tag.rb b/app/models/tag.rb index 3cf3b3f..857e1d2 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,3 +1,12 @@ +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# name :text not null +# type :text not null +# old_id :text +# class Tag < ApplicationRecord # needed because we have a column called 'type' self.inheritance_column = '_inheritance_column' diff --git a/test/fixtures/authors.yml b/test/fixtures/authors.yml index d7a3329..eec7b63 100644 --- a/test/fixtures/authors.yml +++ b/test/fixtures/authors.yml @@ -1,4 +1,15 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: authors +# +# id :bigint not null, primary key +# avatar :text +# bio_html :text +# date_joined :datetime not null +# name :text not null +# num_blog_posts :integer default(0), not null +# num_followers :integer default(0), not null +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately diff --git a/test/fixtures/chapters.yml b/test/fixtures/chapters.yml index d7a3329..506acfc 100644 --- a/test/fixtures/chapters.yml +++ b/test/fixtures/chapters.yml @@ -1,4 +1,21 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: chapters +# +# id :bigint not null, primary key +# body :text +# date_modified :datetime +# date_published :datetime not null +# num_views :integer default(0), not null +# num_words :integer +# number :integer default(1), not null +# title :text not null +# story_id :bigint not null +# +# Indexes +# +# index_chapters_on_story_id (story_id) +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately diff --git a/test/fixtures/stories.yml b/test/fixtures/stories.yml index d7a3329..98896ff 100644 --- a/test/fixtures/stories.yml +++ b/test/fixtures/stories.yml @@ -1,4 +1,30 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: stories +# +# id :bigint not null, primary key +# color :integer +# completion_status :text +# content_rating :text +# cover_image :text +# date_modified :datetime +# date_published :datetime not null +# date_updated :datetime +# description_html :text +# num_comments :integer default(0), not null +# num_views :integer default(0), not null +# num_words :integer not null +# prequel :integer +# rating :integer not null +# short_description :text +# title :text not null +# total_num_views :integer default(0), not null +# author_id :bigint not null +# +# Indexes +# +# index_stories_on_author_id (author_id) +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately diff --git a/test/fixtures/tags.yml b/test/fixtures/tags.yml index d7a3329..e108136 100644 --- a/test/fixtures/tags.yml +++ b/test/fixtures/tags.yml @@ -1,4 +1,12 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# name :text not null +# type :text not null +# old_id :text +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately diff --git a/test/models/author_test.rb b/test/models/author_test.rb index b2d7df1..6cd7eb9 100644 --- a/test/models/author_test.rb +++ b/test/models/author_test.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: authors +# +# id :bigint not null, primary key +# avatar :text +# bio_html :text +# date_joined :datetime not null +# name :text not null +# num_blog_posts :integer default(0), not null +# num_followers :integer default(0), not null +# require "test_helper" class AuthorTest < ActiveSupport::TestCase diff --git a/test/models/chapter_test.rb b/test/models/chapter_test.rb index a89eb86..f36de24 100644 --- a/test/models/chapter_test.rb +++ b/test/models/chapter_test.rb @@ -1,3 +1,21 @@ +# == Schema Information +# +# Table name: chapters +# +# id :bigint not null, primary key +# body :text +# date_modified :datetime +# date_published :datetime not null +# num_views :integer default(0), not null +# num_words :integer +# number :integer default(1), not null +# title :text not null +# story_id :bigint not null +# +# Indexes +# +# index_chapters_on_story_id (story_id) +# require "test_helper" class ChapterTest < ActiveSupport::TestCase diff --git a/test/models/story_test.rb b/test/models/story_test.rb index 275e648..eadadba 100644 --- a/test/models/story_test.rb +++ b/test/models/story_test.rb @@ -1,3 +1,30 @@ +# == Schema Information +# +# Table name: stories +# +# id :bigint not null, primary key +# color :integer +# completion_status :text +# content_rating :text +# cover_image :text +# date_modified :datetime +# date_published :datetime not null +# date_updated :datetime +# description_html :text +# num_comments :integer default(0), not null +# num_views :integer default(0), not null +# num_words :integer not null +# prequel :integer +# rating :integer not null +# short_description :text +# title :text not null +# total_num_views :integer default(0), not null +# author_id :bigint not null +# +# Indexes +# +# index_stories_on_author_id (author_id) +# require "test_helper" class StoryTest < ActiveSupport::TestCase diff --git a/test/models/tag_test.rb b/test/models/tag_test.rb index 1846cdb..ccf7251 100644 --- a/test/models/tag_test.rb +++ b/test/models/tag_test.rb @@ -1,3 +1,12 @@ +# == Schema Information +# +# Table name: tags +# +# id :bigint not null, primary key +# name :text not null +# type :text not null +# old_id :text +# require "test_helper" class TagTest < ActiveSupport::TestCase