Skip to content
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

no need to cast prisma return to User #362

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions template/app/src/newsletter/sendNewsletter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { type SendNewsletter } from 'wasp/server/jobs';

import { type User } from 'wasp/entities';
import { emailSender } from 'wasp/server/email';
import { type Email } from 'wasp/server/email/core/types'; // TODO fix after it gets fixed in wasp :)

Expand All @@ -27,14 +26,14 @@ export const checkAndQueueNewsletterEmails: SendNewsletter<never, void> = async
const currentDate = new Date();
const twoWeeksFromNow = new Date(currentDate.getTime() + 14 * 24 * 60 * 60 * 1000);

const users = (await context.entities.User.findMany({
const users = await context.entities.User.findMany({
where: {
datePaid: {
equals: twoWeeksFromNow,
},
sendNewsletter: true,
},
})) as User[];
});

if (users.length === 0) {
return;
Expand Down
Loading