Skip to content

Commit

Permalink
Fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tompretty committed Feb 15, 2021
1 parent cf2da92 commit 1090cc0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/create-reminder-signup/lambda/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const createSignup = async <T extends BaseSignupRequest>(
body: 'Invalid body',
};
}
console.log(signupRequest);

const token = await identityAccessTokenPromise;
const pool = await dbConnectionPoolPromise;
Expand Down
1 change: 0 additions & 1 deletion src/create-reminder-signup/lambda/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function runLocal() {
body: JSON.stringify({
email: '[email protected]',
reminderPeriod: '2021-01-01',
reminderCreatedAt: 'foo',
reminderFrequencyMonths: 3,
reminderPlatform: 'WEB',
reminderComponent: 'EPIC',
Expand Down
14 changes: 7 additions & 7 deletions src/create-reminder-signup/lambda/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,29 @@ function isValidEmail(email: string): boolean {
type DateString = string;

function isValidDateString(dateString: string): boolean {
console.log(dateString);
const date = Date.parse(dateString);
console.log('after!');
return !isNaN(date);
}

export interface BaseSignupRequest {
email: Email;
country?: string;
reminderCreatedAt: DateString;
reminderCreatedAt?: DateString;
reminderPlatform: ReminderPlatform;
reminderComponent: ReminderComponent;
reminderStage: ReminderStage;
reminderOption?: string;
}

export interface OneOffSignupRequest extends BaseSignupRequest {
// typecheck.macro doesn't support extends
export type OneOffSignupRequest = BaseSignupRequest & {
reminderPeriod: DateString;
}
};

export interface RecurringSignupRequest extends BaseSignupRequest {
// typecheck.macro doesn't support extends
export type RecurringSignupRequest = BaseSignupRequest & {
reminderFrequencyMonths: number;
}
};

export interface APIGatewayEvent {
headers: Record<string, string | undefined>;
Expand Down

0 comments on commit 1090cc0

Please sign in to comment.