Skip to content

Commit

Permalink
fixed version, changed food to foodItems
Browse files Browse the repository at this point in the history
  • Loading branch information
newracket committed Oct 23, 2024
1 parent 8ab35b4 commit 7722948
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/validators/EventControllerRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class OptionalEventProperties implements IOptionalEventProperties {
googleCalendarEvent?: Uuid;

@Allow()
food?: string;
foodItems?: string;
}

export class Event extends OptionalEventProperties implements IEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';

const TABLE_NAME = 'Events';

export class AddFoodColumn1728959627663 implements MigrationInterface {
export class AddFoodItemsColumn1728959627663 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumns(TABLE_NAME, [
await queryRunner.addColumn(TABLE_NAME,
new TableColumn({
name: 'food',
name: 'foodItems',
type: 'varchar(255)',
isNullable: true,
}),
]);
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumns(TABLE_NAME, [
await queryRunner.dropColumn(TABLE_NAME,
new TableColumn({
name: 'food',
name: 'foodItems',
type: 'varchar(255)',
}),
]);
);
}
}
4 changes: 2 additions & 2 deletions models/EventModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class EventModel extends BaseEntity {
googleCalendarEvent: Uuid;

@Column('varchar', { nullable: true })
food: string;
foodItems: string;

public getPublicEvent(canSeeAttendanceCode = false): PublicEvent {
const publicEvent: PublicEvent = {
Expand All @@ -94,7 +94,7 @@ export class EventModel extends BaseEntity {
staffPointBonus: this.staffPointBonus,
discordEvent: this.discordEvent,
googleCalendarEvent: this.googleCalendarEvent,
food: this.food,
foodItems: this.foodItems,
};
if (canSeeAttendanceCode) publicEvent.attendanceCode = this.attendanceCode;
return publicEvent;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acmucsd/membership-portal",
"version": "3.6.3",
"version": "3.7.0",
"description": "REST API for ACM UCSD's membership portal.",
"main": "index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion tests/Seeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ async function seed(): Promise<void> {
...EventFactory.daysBefore(6),
attendanceCode: 'galaxybrain',
...staffed,
food: 'Boba',
foodItems: 'Boba',
});
const PAST_HACK_WORKSHOP = EventFactory.fake({
title: 'Hack: Intro to Rust',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/EventFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class EventFactory {
thumbnail: FactoryUtils.getRandomImageUrl(),
discordEvent: faker.datatype.hexaDecimal(10),
googleCalendarEvent: faker.datatype.hexaDecimal(10),
food: null,
foodItems: null,
});
return EventModel.merge(fake, substitute);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('event creation', () => {
start: moment().subtract(2, 'hour').toDate(),
end: moment().subtract(1, 'hour').toDate(),
attendanceCode: 'p4rty',
food: 'Boba',
foodItems: 'Boba',
pointValue: 10,
};

Expand All @@ -58,7 +58,7 @@ describe('event creation', () => {
expect(eventResponse.event.committee).toEqual(event.committee);
expect(eventResponse.event.start).toEqual(event.start);
expect(eventResponse.event.end).toEqual(event.end);
expect(eventResponse.event.food).toEqual(event.food);
expect(eventResponse.event.foodItems).toEqual(event.foodItems);
expect(eventResponse.event.pointValue).toEqual(event.pointValue);

// verifying response from event lookup
Expand All @@ -85,7 +85,7 @@ describe('event creation', () => {
start: moment().subtract(2, 'hour').toDate(),
end: moment().subtract(1, 'hour').toDate(),
attendanceCode: 'p4rty',
food: '',
foodItems: '',
pointValue: 10,
};

Expand Down Expand Up @@ -117,7 +117,7 @@ describe('event creation', () => {
start: moment().subtract(1, 'hour').toDate(),
end: moment().subtract(2, 'hour').toDate(),
attendanceCode: 'p4rty',
food: null,
foodItems: null,
pointValue: 10,
};

Expand Down
2 changes: 1 addition & 1 deletion types/ApiRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export interface OptionalEventProperties {
staffPointBonus?: number;
discordEvent?: Uuid;
googleCalendarEvent?: Uuid;
food?: string;
foodItems?: string;
}

export interface Event extends OptionalEventProperties {
Expand Down
2 changes: 1 addition & 1 deletion types/ApiResponses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export interface PublicEvent {
staffPointBonus: number;
discordEvent: Uuid;
googleCalendarEvent: Uuid;
food: string;
foodItems: string;
}

export interface GetPastEventsResponse extends ApiResponse {
Expand Down

0 comments on commit 7722948

Please sign in to comment.