-
Notifications
You must be signed in to change notification settings - Fork 6
Email ics file for pickup events #443
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; | ||
|
||
const TABLE_NAME = 'OrderPickupEvents'; | ||
const COLUMN_NAME = 'location'; | ||
|
||
export class AddLocationColumnToOrderPickupEvent1716061560746 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.addColumn(TABLE_NAME, new TableColumn({ | ||
name: COLUMN_NAME, | ||
type: 'varchar(255)', | ||
})); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropColumn(TABLE_NAME, COLUMN_NAME); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ import { EventModel } from '../models/EventModel'; | |
import Repositories, { TransactionsManager } from '../repositories'; | ||
import { MerchandiseCollectionModel } from '../models/MerchandiseCollectionModel'; | ||
import { MerchCollectionPhotoModel } from '../models/MerchCollectionPhotoModel'; | ||
import EmailService, { OrderInfo, OrderPickupEventInfo } from './EmailService'; | ||
import EmailService, { OrderInfo, OrderPickupEventCalendarInfo, OrderPickupEventInfo } from './EmailService'; | ||
import { UserError } from '../utils/Errors'; | ||
import { OrderItemModel } from '../models/OrderItemModel'; | ||
import { OrderPickupEventModel } from '../models/OrderPickupEventModel'; | ||
|
@@ -593,7 +593,8 @@ export default class MerchStoreService { | |
totalCost: order.totalCost, | ||
pickupEvent: MerchStoreService.toPickupEventUpdateInfo(order.pickupEvent), | ||
}; | ||
this.emailService.sendOrderConfirmation(user.email, user.firstName, orderConfirmation); | ||
const calendarInfo = MerchStoreService.toEventCalendarInfo(order.pickupEvent); | ||
this.emailService.sendOrderConfirmation(user.email, user.firstName, orderConfirmation, calendarInfo); | ||
|
||
return order; | ||
} | ||
|
@@ -717,7 +718,8 @@ export default class MerchStoreService { | |
throw new UserError('This merch pickup event is full! Please choose a different pickup event'); | ||
} | ||
const orderInfo = await MerchStoreService.buildOrderUpdateInfo(order, newPickupEventForOrder, txn); | ||
await this.emailService.sendOrderPickupUpdated(user.email, user.firstName, orderInfo); | ||
const calendarInfo = MerchStoreService.toEventCalendarInfo(newPickupEventForOrder); | ||
await this.emailService.sendOrderPickupUpdated(user.email, user.firstName, orderInfo, calendarInfo); | ||
return orderRepository.upsertMerchOrder(order, { | ||
pickupEvent: newPickupEventForOrder, | ||
status: OrderStatus.PLACED, | ||
|
@@ -911,6 +913,16 @@ export default class MerchStoreService { | |
}; | ||
} | ||
|
||
private static toEventCalendarInfo(pickupEvent: OrderPickupEventModel): OrderPickupEventCalendarInfo { | ||
return { | ||
start: pickupEvent.start.getTime(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are your thoughts on adding location as a field to OrderPickupEvents? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After discussing, we've decided to add it and copy over the location from the linkedEvent if none is provided. One potential issue is that if the linkedEvent location updates, this field will not, however, we do not think this will be a big problem as the user will be notified through discord. |
||
end: pickupEvent.end.getTime(), | ||
title: pickupEvent.title, | ||
description: pickupEvent.description, | ||
location: pickupEvent.location, | ||
}; | ||
} | ||
|
||
/** | ||
* Process fulfillment updates for all order items of an order. | ||
* If all items get fulfilled after this update, then the order is considered fulfilled. | ||
|
Uh oh!
There was an error while loading. Please reload this page.