feat(api): add email subscription endpoints to new API (#54000)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Tom
2024-05-07 06:31:39 -05:00
committed by GitHub
parent dea35985c1
commit acb38ca4e2
9 changed files with 442 additions and 6 deletions

View File

@@ -1,6 +1,11 @@
import crypto from 'node:crypto';
import { type Prisma } from '@prisma/client';
import { customAlphabet } from 'nanoid';
export const nanoidCharSet =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
const nanoid = customAlphabet(nanoidCharSet, 21);
/**
* Creates the necessary data to create a new user.
@@ -52,7 +57,7 @@ export function createUserInput(email: string): Prisma.userCreateInput {
keyboardShortcuts: false,
location: '',
name: '',
unsubscribeId: '',
unsubscribeId: nanoid(),
partiallyCompletedChallenges: [], // TODO(Post-MVP): Omit this from the document? (prisma will always return [])
picture: '',
portfolio: [], // TODO(Post-MVP): Omit this from the document? (prisma will always return [])