Skip to content

Commit

Permalink
Fix Discord & Google Calendar UUIDs (#439)
Browse files Browse the repository at this point in the history
* fixed UUIDs

* fixed test

* a migration to fix the migration

* linting

* updated uuid type
  • Loading branch information
nik-dange authored May 7, 2024
1 parent 4159213 commit 9893841
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions migrations/0045-fix-discord-gcal-field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class FixDiscordGcalField1714770061929 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('ALTER TABLE "Events" ALTER COLUMN "discordEvent" TYPE varchar');
await queryRunner.query('ALTER TABLE "Events" ALTER COLUMN "googleCalendarEvent" TYPE varchar');
}

public async down(queryRunner: QueryRunner): Promise<void> {
// nothing here because it's fixing an earlier migration (# 0044)
}
}
4 changes: 2 additions & 2 deletions models/EventModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export class EventModel extends BaseEntity {
@OneToMany((type) => ExpressCheckinModel, (expressCheckin) => expressCheckin.event, { cascade: true })
expressCheckins: ExpressCheckinModel[];

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

@Column('uuid', { nullable: true })
@Column('varchar', { nullable: true })
googleCalendarEvent: Uuid;

public getPublicEvent(canSeeAttendanceCode = false): PublicEvent {
Expand Down
4 changes: 2 additions & 2 deletions tests/data/EventFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
googleCalendarEvent: faker.datatype.hexaDecimal(10),
});
return EventModel.merge(fake, substitute);
}
Expand Down

0 comments on commit 9893841

Please sign in to comment.