-
Notifications
You must be signed in to change notification settings - Fork 1
Changes models #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cxasper
wants to merge
13
commits into
master
Choose a base branch
from
changes-models
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes models #29
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
632143b
Change type category on models
cxasper 04d5117
Add column in space model
cxasper 6a24ceb
Create ContractSpace model
cxasper d01a5c4
Create Payment model
cxasper a86985f
Remove id column from rails admin
cxasper 51e0802
Hide id column of the models
cxasper 5afe481
Refactor on spec
cxasper a90d219
wip
cxasper 4991e6b
Merge branch 'master' of github.com:devacademyla/spaces into changes-…
cxasper 7061d14
Update payment model
cxasper 846db7a
Create relation contract and spaces model
cxasper a6b5d72
Create relation asset and supplier model
cxasper e52e4ae
Refactor spec and rails admin
cxasper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # ContractSpace | ||
| class ContractSpace < ApplicationRecord | ||
| belongs_to :contract | ||
| belongs_to :space | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Payment | ||
| class Payment < ApplicationRecord | ||
| validates :due_date, presence: true | ||
| validates :payment_date, presence: true | ||
| validates :amount, presence: true | ||
| validates :status, presence: true | ||
| belongs_to :contract | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209171717_change_type_category_asset_description.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategoryAssetDescription < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :assets do |t| | ||
| t.change :description, :text | ||
| end | ||
| end | ||
| end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209171835_change_type_category_organization_description.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategoryOrganizationDescription < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :organizations do |t| | ||
| t.change :description, :text | ||
| end | ||
| end | ||
| end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209172057_change_type_category_supplier_address.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategorySupplierAddress < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :suppliers do |t| | ||
| t.change :address, :text | ||
| end | ||
| end | ||
| end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209172202_change_type_category_supply_description.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategorySupplyDescription < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :supplies do |t| | ||
| t.change :description, :text | ||
| end | ||
| end | ||
| end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209172241_change_type_category_supply_note.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategorySupplyNote < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :supplies do |t| | ||
| t.change :note, :text | ||
| end | ||
| end | ||
| end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20180209172347_change_type_category_user_address.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class ChangeTypeCategoryUserAddress < ActiveRecord::Migration[5.1] | ||
| def up | ||
| change_table :users do |t| | ||
| t.change :address, :text | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddFullNameToSpace < ActiveRecord::Migration[5.1] | ||
| def change | ||
| add_column :spaces, :full_name, :string | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class RemoveReferencesOnContract < ActiveRecord::Migration[5.1] | ||
| def change | ||
| remove_reference(:contracts, :space, index: true) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| class CreatePayments < ActiveRecord::Migration[5.1] | ||
| def change | ||
| create_table :payments do |t| | ||
| t.integer :payment | ||
| t.date :payment_date | ||
| t.date :warning_date | ||
| t.integer :quantity | ||
| t.string :status | ||
| t.text :note | ||
| t.references :contract, foreign_key: true | ||
|
|
||
| t.timestamps | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| class ChangesOnPayment < ActiveRecord::Migration[5.1] | ||
| def change | ||
| rename_column :payments, :warning_date, :due_date | ||
| rename_column :payments, :quantity, :amount | ||
| remove_column :payments, :payment, :integer | ||
| change_column :payments, :amount, :float | ||
| end | ||
| end |
6 changes: 6 additions & 0 deletions
6
db/migrate/20180214194333_remove_references_on_contract_spaces.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class RemoveReferencesOnContractSpaces < ActiveRecord::Migration[5.1] | ||
| def change | ||
| remove_reference(:contract_spaces, :space, index: true) | ||
| remove_reference(:contract_spaces, :contract, index: true) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class DropContractSpace < ActiveRecord::Migration[5.1] | ||
| def change | ||
| drop_table :contract_spaces | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class ContractsSpaces < ActiveRecord::Migration[5.1] | ||
| create_table :contracts_spaces, id: false do |t| | ||
| t.belongs_to :contract, index: true | ||
| t.belongs_to :space, index: true | ||
| end | ||
| end |
6 changes: 6 additions & 0 deletions
6
db/migrate/20180214211752_remove_references_on_asset_supplier.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class RemoveReferencesOnAssetSupplier < ActiveRecord::Migration[5.1] | ||
| def change | ||
| remove_reference(:asset_suppliers, :asset, index: true) | ||
| remove_reference(:asset_suppliers, :supplier, index: true) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class DropAssetSupplier < ActiveRecord::Migration[5.1] | ||
| def change | ||
| drop_table :asset_suppliers | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class AssetsSuppliers < ActiveRecord::Migration[5.1] | ||
| create_table :assets_suppliers, id: false do |t| | ||
| t.belongs_to :asset, index: true | ||
| t.belongs_to :supplier, index: true | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class RemoveRelationContractsSpace < ActiveRecord::Migration[5.1] | ||
| def change | ||
| drop_table :contracts_spaces | ||
| end | ||
| end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20180215171311_remove_relation_assets_suppliers.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class RemoveRelationAssetsSuppliers < ActiveRecord::Migration[5.1] | ||
| def change | ||
| drop_table :assets_suppliers | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| class CreateContractSpaces < ActiveRecord::Migration[5.1] | ||
| def change | ||
| create_table :contract_spaces do |t| | ||
| t.belongs_to :contract, index: true | ||
| t.belongs_to :space, index: true | ||
| t.datetime :appointment_date | ||
|
|
||
| t.timestamps | ||
| end | ||
| end | ||
| end |
6 changes: 3 additions & 3 deletions
6
.../20180204230315_create_asset_suppliers.rb → .../20180215175137_create_asset_suppliers.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class RemoveColumnOnContractSpace < ActiveRecord::Migration[5.1] | ||
| def change | ||
| remove_column :contract_spaces, :appointment_date, :datetime | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| # | ||
| # It's strongly recommended that you check this file into your version control system. | ||
|
|
||
| ActiveRecord::Schema.define(version: 20180208203810) do | ||
| ActiveRecord::Schema.define(version: 20180215181142) do | ||
|
|
||
| # These are extensions that must be enabled in order to support this database | ||
| enable_extension "plpgsql" | ||
|
|
@@ -32,22 +32,29 @@ | |
| t.string "category" | ||
| t.string "sub_category" | ||
| t.integer "status" | ||
| t.string "description" | ||
| t.text "description" | ||
| t.integer "interval" | ||
| t.bigint "space_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.index ["space_id"], name: "index_assets_on_space_id" | ||
| end | ||
|
|
||
| create_table "contract_spaces", force: :cascade do |t| | ||
| t.bigint "contract_id" | ||
| t.bigint "space_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.index ["contract_id"], name: "index_contract_spaces_on_contract_id" | ||
| t.index ["space_id"], name: "index_contract_spaces_on_space_id" | ||
| end | ||
|
|
||
| create_table "contracts", force: :cascade do |t| | ||
| t.date "start_date" | ||
| t.date "finish_date" | ||
| t.bigint "space_id" | ||
| t.bigint "user_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.index ["space_id"], name: "index_contracts_on_space_id" | ||
| t.index ["user_id"], name: "index_contracts_on_user_id" | ||
| end | ||
|
|
||
|
|
@@ -64,13 +71,25 @@ | |
|
|
||
| create_table "organizations", force: :cascade do |t| | ||
| t.string "name" | ||
| t.string "description" | ||
| t.text "description" | ||
| t.string "organization_identifier" | ||
| t.string "website" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| end | ||
|
|
||
| create_table "payments", force: :cascade do |t| | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| t.date "payment_date" | ||
| t.date "due_date" | ||
| t.float "amount" | ||
| t.string "status" | ||
| t.text "note" | ||
| t.bigint "contract_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.index ["contract_id"], name: "index_payments_on_contract_id" | ||
| end | ||
|
|
||
| create_table "spaces", force: :cascade do |t| | ||
| t.string "space_identifier" | ||
| t.string "name" | ||
|
|
@@ -80,6 +99,7 @@ | |
| t.bigint "space_id" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| t.string "full_name" | ||
| t.index ["space_id"], name: "index_spaces_on_space_id" | ||
| end | ||
|
|
||
|
|
@@ -90,7 +110,7 @@ | |
| t.integer "ranking" | ||
| t.string "services" | ||
| t.string "category" | ||
| t.string "address" | ||
| t.text "address" | ||
| t.string "bank" | ||
| t.string "current_account" | ||
| t.string "email" | ||
|
|
@@ -102,7 +122,7 @@ | |
|
|
||
| create_table "supplies", force: :cascade do |t| | ||
| t.string "name" | ||
| t.string "description" | ||
| t.text "description" | ||
| t.string "brand" | ||
| t.string "color" | ||
| t.string "presentation" | ||
|
|
@@ -112,7 +132,7 @@ | |
| t.integer "stock" | ||
| t.integer "stock_minimun" | ||
| t.integer "stock_reposition" | ||
| t.string "note" | ||
| t.text "note" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
| end | ||
|
|
@@ -127,7 +147,7 @@ | |
| t.date "birthday" | ||
| t.string "role" | ||
| t.integer "user_identifier" | ||
| t.string "address" | ||
| t.text "address" | ||
| t.text "bio" | ||
| t.datetime "created_at", null: false | ||
| t.datetime "updated_at", null: false | ||
|
|
@@ -144,13 +164,11 @@ | |
| t.index ["supply_id"], name: "index_warehouses_on_supply_id" | ||
| end | ||
|
|
||
| add_foreign_key "asset_suppliers", "assets" | ||
| add_foreign_key "asset_suppliers", "suppliers" | ||
| add_foreign_key "assets", "spaces" | ||
| add_foreign_key "contracts", "spaces" | ||
| add_foreign_key "contracts", "users" | ||
| add_foreign_key "maintenances", "assets" | ||
| add_foreign_key "maintenances", "suppliers" | ||
| add_foreign_key "payments", "contracts" | ||
| add_foreign_key "spaces", "spaces" | ||
| add_foreign_key "users", "organizations" | ||
| add_foreign_key "warehouses", "spaces" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| FactoryBot.define do | ||
| factory :contract_space do | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| FactoryBot.define do | ||
| factory :payment do | ||
| payment_date FFaker::IdentificationESCO.expedition_date | ||
| due_date FFaker::IdentificationESCO.expedition_date | ||
| amount FFaker::PhoneNumberAU.home_work_phone_prefix | ||
| status 'Completo' | ||
| note FFaker::Book.description | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta clase no es necesaria.