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

feat(data-modeling):create Financial.CurrencyConversion type #33

Merged
merged 5 commits into from
May 15, 2024

Conversation

ll-zerr
Copy link
Contributor

@ll-zerr ll-zerr commented Mar 28, 2024

Resolves #32

Creates Financial.CurrencyConversion collection type.

Note: Needed to create the year field type as short text to avoid a comma in the value.

@ll-zerr ll-zerr added the enhancement New feature or request label Mar 28, 2024
Copy link
Contributor

@TravisAlmey TravisAlmey left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a few minor things.

src/api/currency/content-types/currency/schema.json Outdated Show resolved Hide resolved
src/api/currency/content-types/currency/schema.json Outdated Show resolved Hide resolved
src/api/currency/content-types/currency/schema.json Outdated Show resolved Hide resolved
src/api/currency/content-types/currency/schema.json Outdated Show resolved Hide resolved
@jtfairbank
Copy link
Collaborator

@ll-zerr see the commit I just pushed up! I was able to update the name by recreating the content type and copying over the attributes. In general using the Strapi generate API seems more powerful than the admin panel, at least to create the base api / content type which you can then add attributes to via the admin panel. Want to try it out to create the next content type in the existing financial api?

Steps I followed for the rename:

# 1. generate a new content type ("currency-conversion") & api ("financial")
yarn strapi generate

# 2. copy over the attributes from the old schema.json file to the new one

# 3. delete the old one
rm -rf src/api/currency/

# 4. manually update the types
yarn strapi ts:generate-types

},
"attributes": {
"year": {
"type": "biginteger",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ll-zerr don't love using biginteger for this, as that will increase the database storage requirements.

Maybe it'd make sense to have year as a string with custom regex validation? Something like ^20\d{2}$ would require it to be a year in the 2000s. You could make this more complex with something like ^2019|202[0-9]$ to allow it to be "2019" or a year in the "2020s".

Feel free to play around here: https://regex101.com/r/oxiBhf/1

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack @ll-zerr so sorry! I didn't realize I hadn't submitted this review two weeks ago when I made it 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jtfairbank, I made the changes suggested and modified the regex to include a year in the "2030s" to allow for a larger year span past five years.

@ll-zerr ll-zerr requested a review from jtfairbank April 27, 2024 18:12
Copy link
Collaborator

@jtfairbank jtfairbank left a comment

Choose a reason for hiding this comment

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

praise: looks great @ll-zerr! thanks for your patience with the review, merging into saga now

@jtfairbank jtfairbank merged commit af52023 into saga May 15, 2024
1 check passed
@jtfairbank jtfairbank deleted the feat/32/create-financial-currency-conversion-type branch May 15, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat(data modeling): Create Financial.CurrencyConversion collection type
3 participants