Skip to content

Instantly share code, notes, and snippets.

@bacoords
Created June 17, 2024 19:55
Show Gist options
  • Save bacoords/2c8d26412e7a905d5571affcc1b92dec to your computer and use it in GitHub Desktop.
Save bacoords/2c8d26412e7a905d5571affcc1b92dec to your computer and use it in GitHub Desktop.
<pre><code class="language-typescript">
import { faker } from "@faker-js/faker";
const attachmentBlueprint = async (data?: Partial<Attachment>) => {
const messageId = data?.messageId ?? (await messageBlueprint()).id;
return await prisma.attachment.create({
data: {
messageId,
filename: faker.system.fileName(),
...data
}
});
}
</code></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment