PhilanthropyDataCommons / service

A project for collecting and serving public information associated with grant applications
GNU Affero General Public License v3.0
8 stars 2 forks source link

Update URL to url in field_type enum #1032

Closed hminsky2002 closed 2 weeks ago

hminsky2002 commented 2 months ago

This PR remedies a typo from the field_type enum, which is used to validate the type of a basefield. The value of 'url' was originally capitalized as 'URL', but this goes against our convention. It adds a new migration, and updates the seed file accordingly. Notably, it also casts any existing base-fields with type 'URL' to 'url'

Closes #989

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.57%. Comparing base (625be13) to head (3e56720).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1032 +/- ## ======================================= Coverage 88.57% 88.57% ======================================= Files 129 129 Lines 1725 1725 Branches 220 213 -7 ======================================= Hits 1528 1528 Misses 197 197 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hminsky2002 commented 2 months ago

I believe BaseField.ts will need to be updated too, correct?

diff --git a/src/types/BaseField.ts b/src/types/BaseField.ts
index c0d9c61..6af8a4d 100644
--- a/src/types/BaseField.ts
+++ b/src/types/BaseField.ts
@@ -7,7 +7,7 @@ export enum BaseFieldDataType {
  NUMBER = 'number',
  PHONE_NUMBER = 'phone_number',
  EMAIL = 'email',
- URL = 'URL',
+ URL = 'url',
  BOOLEAN = 'boolean',
 }

I do believe you are correct @reefdog ! Updating and force pushing now

slifty commented 3 weeks ago

@hminsky2002 just to confirm I don't see the change yet, unless I'm missing it!

hminsky2002 commented 3 weeks ago

@hminsky2002 just to confirm I don't see the change yet, unless I'm missing it!

@slifty apologies, I was running into an issue where altering the enum was failing the migration, with the error Reason: unsafe use of new value "url" of enum type field_type Which seems to suggest that directly altering the enum is not liked by our system? I kept the feature of making a new enum, but have been able to avoid the case statement which does feel better!