Skip to content

Commit

Permalink
docs: fix the getting started seed.ts content
Browse files Browse the repository at this point in the history
  • Loading branch information
floross committed Jun 2, 2023
1 parent 7ddc1f6 commit a73bba7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions apps/docs/docs/01-Overview/02-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ generator client {
}
datasource db {
provider = "postgresql"
provider = "sqlite"
url = env("DATABASE_URL")
}
Expand Down Expand Up @@ -179,7 +179,7 @@ And you can add the `seed.ts` next to your schema file (don't forget to add the
{
"prisma": {
"schema": "prisma/schema.prisma",
"seed": "npx ts-node --project ./prisma/seed.ts"
"seed": "npx ts-node --project tsconfig.json ./prisma/seed.ts"
}
}
```
Expand All @@ -188,28 +188,28 @@ Note: you will need to install `@ngneat/falso` as a dev dependency and to add th

```typescript
import { randFirstName, randLastName, randText } from '@ngneat/falso';
import { PrismaClient, Role } from '@prisma/client';
import { PrismaClient } from '@prisma/client';
import * as bcrypt from 'bcrypt';

const prisma = new PrismaClient();

export function createUser({
email,
password,
roles,
role,
sharedTasksWith = [],
}: {
email: string;
password: string;
roles: Role[];
role: string;
sharedTasksWith?: string[];
}) {
console.info(`Creating user ${email}`);
return prisma.user.create({
data: {
email,
password: bcrypt.hashSync(password, 10),
roles,
role,
profile: {
create: {
firstName: randFirstName(),
Expand Down Expand Up @@ -242,17 +242,17 @@ async function seed() {
await createUser({
email: '[email protected]',
password: 'password',
roles: [Role.admin],
role: 'admin',
}),
await createUser({
email: '[email protected]',
password: 'password',
roles: [Role.user],
role: 'user',
}),
await createUser({
email: '[email protected]',
password: 'password',
roles: [Role.user],
role: 'user',
sharedTasksWith: ['[email protected]'],
}),
];
Expand All @@ -264,6 +264,7 @@ seed().catch((e) => {
console.error(e);
process.exit(1);
});

```

## User Authentication
Expand Down

0 comments on commit a73bba7

Please sign in to comment.