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

Fix Discord & Google Calendar UUIDs #439

Merged
merged 6 commits into from
May 7, 2024
Merged

Conversation

nik-dange
Copy link
Member

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

Made Discord UUIDs and Google Calendar UUIDs strings because they aren't V4 UUIDs

Changes

  • See above

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: (Fill In)

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Postman testing passing successfully.

Copy link

github-actions bot commented May 3, 2024

Thanks for contributing!
If you've made changes to the API's functionality, please make sure to bump the package
version—see this guide to semantic versioning for details—and
document those changes as appropriate.

Copy link
Contributor

@dowhep dowhep left a comment

Choose a reason for hiding this comment

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

nit on change on uuid

@Column('uuid', { nullable: true })
discordEvent: Uuid;
@Column('varchar', { nullable: true })
discordEvent: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

In types/index.ts, we define Uuid with type Uuid = string and we just use it for clarification on the context we use it. As a result, I think it is better to leave Uuid as type here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

So to clarify, the column type can be varchar, but it should be discordEvent: Uuid?

@@ -41,8 +41,8 @@ export class EventFactory {
deleted: false,
eventLink: faker.internet.url(),
thumbnail: FactoryUtils.getRandomImageUrl(),
discordEvent: uuid(),
googleCalendarEvent: uuid(),
discordEvent: faker.datatype.hexaDecimal(10),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the way discord generate Uuid or is this just random string?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a random string. Discord UUIDs are different (see this error message: https://discord.com/channels/573028991527550986/1012204566122598431/1236042800043397261) than what Postgres allows for UUIDs (https://www.postgresql.org/docs/current/datatype-uuid.html), which is why I opted to make it a string

@@ -155,8 +155,8 @@ export interface OptionalEventProperties {
eventLink?: string;
requiresStaff?: boolean;
staffPointBonus?: number;
discordEvent?: Uuid;
googleCalendarEvent?: Uuid;
discordEvent?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with the Uuid comment above

Copy link
Contributor

@dowhep dowhep left a comment

Choose a reason for hiding this comment

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

One suggested change regarding migration

migrations/0045-fix-discord-gcal-field.ts Show resolved Hide resolved
Copy link
Contributor

@dowhep dowhep left a comment

Choose a reason for hiding this comment

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

LFTM 🚀 🚀

Upon discussion, the down migration is deemed not necessary and will create more problems to implement than to just leave it.

@dowhep dowhep merged commit 9893841 into master May 7, 2024
5 checks passed
@dowhep dowhep deleted the bug/discord-uuid-column branch May 7, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants