Skip to content

Commit

Permalink
Up level SES package; fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
chuck-dbos committed Dec 20, 2024
1 parent e68714c commit 4de7749
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion typescript/widget-store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The Server Tools section give you an opportunity to crash the app. After crashin

## Nightly Sales Reports (Optional)

As per [this blog post](https://www.dbos.dev/blog/how-to-build-cloud-cron-jobs), the DBOS Widget Store can send out nightly email sales reports, illustrating [scheduled workflows](https://docs.dbos.dev/typescript/tutorials/scheduled-workflows) and an [email library](https://www.npmjs.com/package/@dbos-inc/communicator-email-ses).
As per [this blog post](https://www.dbos.dev/blog/how-to-build-cloud-cron-jobs), the DBOS Widget Store can send out nightly email sales reports, illustrating [scheduled workflows](https://docs.dbos.dev/typescript/tutorials/scheduled-workflows) and an [email library](https://www.npmjs.com/package/@dbos-inc/dbos-email-ses).

To enable the features, set up your email accounts in [SES](https://us-east-2.console.aws.amazon.com/ses/home) and then set the following environment variables before launching the widget store:

Expand Down
2 changes: 1 addition & 1 deletion typescript/widget-store/migrations/001_initial_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ exports.up = async function(knex) {
};

exports.down = async function(knex) {
await knex.schema.dropTable('products');
await knex.schema.dropTable('orders');
await knex.schema.dropTable('products');
};
26 changes: 13 additions & 13 deletions typescript/widget-store/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion typescript/widget-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@dbos-inc/communicator-email-ses": "^1.24.15",
"@dbos-inc/dbos-email-ses": "^1.31.13-preview.g4f38e6e769",
"@dbos-inc/dbos-sdk": "^1.30.13",
"liquidjs": "^10.10.1",
"ts-node": "^10.9.2",
Expand Down
6 changes: 3 additions & 3 deletions typescript/widget-store/src/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SendEmailStep } from '@dbos-inc/communicator-email-ses';
import { DBOS_SES } from '@dbos-inc/dbos-email-ses';
import { SchedulerMode, DBOS} from '@dbos-inc/dbos-sdk';

export enum OrderStatus {
Expand Down Expand Up @@ -35,7 +35,7 @@ export interface OrderWithProduct {
export const PRODUCT_ID = 1;

const reportSes = (process.env['REPORT_EMAIL_TO_ADDRESS'] && process.env['REPORT_EMAIL_FROM_ADDRESS'])
? DBOS.configureInstance(SendEmailStep, 'reportSES', {awscfgname: 'aws_config'})
? DBOS.configureInstance(DBOS_SES, 'reportSES', {awscfgname: 'aws_config'})
: undefined;

export class ShopUtilities {
Expand Down Expand Up @@ -176,7 +176,7 @@ export class ShopUtilities {

static async sendStatusEmail(yd: Date, sales: SalesSummary) {
if (!reportSes) return;
await DBOS.invoke(reportSes).sendEmail({
await reportSes.sendEmail({
to: [process.env['REPORT_EMAIL_TO_ADDRESS']!],
from: process.env['REPORT_EMAIL_FROM_ADDRESS']!,
subject: `Daily report for ${yd.toDateString()}`,
Expand Down

0 comments on commit 4de7749

Please sign in to comment.