(options?: Partial<auths>)
| 13 | } |
| 14 | |
| 15 | export default function createAuth(options?: Partial<auths>): Promise<auths> { |
| 16 | const password = options?.password || 'password'; |
| 17 | const salt = generateSalt(); |
| 18 | const hash = generateHash(password, salt); |
| 19 | const data = { |
| 20 | email: `${randomUUID()}@${randomUUID()}.com`, |
| 21 | token: 'token', |
| 22 | password: '', |
| 23 | salt: '', |
| 24 | ...options, |
| 25 | }; |
| 26 | data.password = hash; |
| 27 | data.salt = salt; |
| 28 | return prisma.auths.create({ |
| 29 | data, |
| 30 | }); |
| 31 | } |