Skip to content
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

[V2] Technology #49

Merged
merged 2 commits into from
Aug 25, 2024
Merged

[V2] Technology #49

merged 2 commits into from
Aug 25, 2024

Conversation

GittavanderPol
Copy link
Collaborator

@GittavanderPol GittavanderPol commented Aug 17, 2024

This pull request introduces a new feature to associate companies with technologies, allowing users to view technologies associated with each company. The most important changes include updates to the models, serializers, and frontend components to support this new feature.

@GittavanderPol GittavanderPol self-assigned this Aug 17, 2024
@GittavanderPol GittavanderPol marked this pull request as ready for review August 17, 2024 22:24
Copy link
Owner

@CalvinWalzel CalvinWalzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just some minor feedback

belongs_to :technology

validates :company_id, uniqueness: { scope: :technology_id }
validates :technology_id, uniqueness: { scope: :company_id }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are redundant. Removing one of them should achieve the same result.


validates :name, presence: true, uniqueness: true
validates :background_color,
format: { with: /\A#(?:[0-9a-fA-F]{3}){1,2}\z/, message: "must be a valid hex color code" },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract the regex into a constant?

class Technology < ApplicationRecord
  HEX_COLOR_REGEX = /\A#(?:[0-9a-fA-F]{3}){1,2}\z/.freeze
  
  # ...
  
  validates :background_color,
    format: { with: HEX_COLOR_REGEX, ... }

We can move it to a custom validator once/if we need it in another model.

db/schema.rb Outdated
@@ -19,8 +19,28 @@
t.string "website"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "introduction"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed? I think it's a leftover from your local development database. Removing it manually from db/schema.rb is fine.

Copy link
Owner

@CalvinWalzel CalvinWalzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@CalvinWalzel CalvinWalzel merged commit 67c5f95 into version-2 Aug 25, 2024
4 checks passed
@CalvinWalzel CalvinWalzel deleted the v2/technology branch August 25, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants