Skip to content

Commit

Permalink
Annotate models
Browse files Browse the repository at this point in the history
This was intended only for Accession and Degree Period, but it
caught a few others, so I'm including it as a separate commit.
  • Loading branch information
jazairi committed Aug 28, 2023
1 parent d5cac58 commit 623f44e
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 78 deletions.
10 changes: 10 additions & 0 deletions app/models/accession.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# == Schema Information
#
# Table name: accessions
#
# id :integer not null, primary key
# accession_number :string
# created_at :datetime not null
# updated_at :datetime not null
# degree_period_id :integer not null
#
class Accession < ApplicationRecord
belongs_to :degree_period

Expand Down
1 change: 1 addition & 0 deletions app/models/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# graduation_confirmed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# proquest_allowed :boolean
#
class Author < ApplicationRecord
belongs_to :user
Expand Down
10 changes: 10 additions & 0 deletions app/models/degree_period.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# == Schema Information
#
# Table name: degree_periods
#
# id :integer not null, primary key
# grad_month :string
# grad_year :string
# created_at :datetime not null
# updated_at :datetime not null
#
class DegreePeriod < ApplicationRecord
has_one :accession

Expand Down
8 changes: 8 additions & 0 deletions app/models/proquest_export_batch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# == Schema Information
#
# Table name: proquest_export_batches
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
#
class ProquestExportBatch < ApplicationRecord
require 'csv'

Expand Down
7 changes: 1 addition & 6 deletions app/models/submission_information_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# preserved_at :datetime
# preservation_status :integer default(0), not null
# preservation_status :integer default("unpreserved"), not null
# bag_declaration :string
# bag_name :string
# manifest :text
Expand All @@ -13,11 +13,6 @@
# created_at :datetime not null
# updated_at :datetime not null
#
# Creates the structure for an individual thesis to be preserved in Archivematica according to the BagIt spec:
# https://datatracker.ietf.org/doc/html/rfc8493.
#
# Note: instances of this class are invalid without an associated thesis that has a DSpace handle, a copyright, and
# at least one attached file with no duplicate filenames.
class SubmissionInformationPackage < ApplicationRecord
include Checksums

Expand Down
35 changes: 19 additions & 16 deletions app/models/thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
#
# Table name: theses
#
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# authors_count :integer
# proquest_exported :integer default("Not exported"), not null
# proquest_export_batch_id :integer
#

class Thesis < ApplicationRecord
Expand Down
16 changes: 9 additions & 7 deletions app/models/transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
#
# Table name: transfers
#
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# files_count :integer default(0), not null
# unassigned_files_count :integer default(0), not null
#
class Transfer < ApplicationRecord
belongs_to :user
Expand Down
11 changes: 10 additions & 1 deletion test/fixtures/accessions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# == Schema Information
#
# Table name: accessions
#
# id :integer not null, primary key
# accession_number :string
# created_at :datetime not null
# updated_at :datetime not null
# degree_period_id :integer 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
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# graduation_confirmed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# proquest_allowed :boolean
#

one:
Expand Down
11 changes: 10 additions & 1 deletion test/fixtures/degree_periods.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# == Schema Information
#
# Table name: degree_periods
#
# id :integer not null, primary key
# grad_month :string
# grad_year :string
# created_at :datetime not null
# updated_at :datetime not null
#

june_2023:
grad_month: 'June'
Expand Down
15 changes: 15 additions & 0 deletions test/fixtures/submission_information_packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: submission_information_packages
#
# id :integer not null, primary key
# preserved_at :datetime
# preservation_status :integer default("unpreserved"), not null
# bag_declaration :string
# bag_name :string
# manifest :text
# metadata :text
# thesis_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
sip_one:
preserved_at: Master of Fine Arts
preservation_status: 0
Expand Down
35 changes: 19 additions & 16 deletions test/fixtures/theses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
#
# Table name: theses
#
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# authors_count :integer
# proquest_exported :integer default("Not exported"), not null
# proquest_export_batch_id :integer
#

# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
Expand Down
16 changes: 9 additions & 7 deletions test/fixtures/transfers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
#
# Table name: transfers
#
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# files_count :integer default(0), not null
# unassigned_files_count :integer default(0), not null
#
valid:
department: one
Expand Down
10 changes: 10 additions & 0 deletions test/models/accession_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# == Schema Information
#
# Table name: accessions
#
# id :integer not null, primary key
# accession_number :string
# created_at :datetime not null
# updated_at :datetime not null
# degree_period_id :integer not null
#
require "test_helper"

class AccessionTest < ActiveSupport::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/models/author_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# graduation_confirmed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# proquest_allowed :boolean
#
require 'csv'
require 'test_helper'
Expand Down
10 changes: 10 additions & 0 deletions test/models/degree_period_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# == Schema Information
#
# Table name: degree_periods
#
# id :integer not null, primary key
# grad_month :string
# grad_year :string
# created_at :datetime not null
# updated_at :datetime not null
#
require "test_helper"

class DegreePeriodTest < ActiveSupport::TestCase
Expand Down
8 changes: 8 additions & 0 deletions test/models/proquest_export_batch_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# == Schema Information
#
# Table name: proquest_export_batches
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
#
require 'test_helper'
require 'csv'

Expand Down
2 changes: 1 addition & 1 deletion test/models/submission_information_package_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# preserved_at :datetime
# preservation_status :integer default(0), not null
# preservation_status :integer default("unpreserved"), not null
# bag_declaration :string
# bag_name :string
# manifest :text
Expand Down
35 changes: 19 additions & 16 deletions test/models/thesis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
#
# Table name: theses
#
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# id :integer not null, primary key
# title :string
# abstract :text
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# processor_note :text
# author_note :text
# files_complete :boolean default(FALSE), not null
# metadata_complete :boolean default(FALSE), not null
# publication_status :string default("Not ready for publication"), not null
# coauthors :string
# copyright_id :integer
# license_id :integer
# dspace_handle :string
# issues_found :boolean default(FALSE), not null
# authors_count :integer
# proquest_exported :integer default("Not exported"), not null
# proquest_export_batch_id :integer
#

require 'csv'
Expand Down
16 changes: 9 additions & 7 deletions test/models/transfer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
#
# Table name: transfers
#
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# id :integer not null, primary key
# user_id :integer not null
# department_id :integer not null
# grad_date :date not null
# created_at :datetime not null
# updated_at :datetime not null
# note :text
# files_count :integer default(0), not null
# unassigned_files_count :integer default(0), not null
#
require 'test_helper'

Expand Down

0 comments on commit 623f44e

Please sign in to comment.