Skip to content

Commit

Permalink
chore: unique code
Browse files Browse the repository at this point in the history
  • Loading branch information
sadmann7 committed Mar 3, 2024
1 parent 0fa36e2 commit da207d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/_lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { db } from "@/db"
import { tasks, type Task } from "@/db/schema"
import { faker } from "@faker-js/faker"
import { eq } from "drizzle-orm"
import { customAlphabet } from "nanoid"
import type { z } from "zod"

import { createId } from "@/lib/utils"
Expand All @@ -27,7 +28,7 @@ export async function seedTasks({
for (let i = 0; i < count; i++) {
allTasks.push({
id: createId(),
code: `TASK-${faker.number.int({ min: 1000, max: 9999 })}`,
code: `TASK-${customAlphabet("0123456789", 4)()}`,
title: faker.hacker
.phrase()
.replace(/^./, (letter) => letter.toUpperCase()),
Expand Down

0 comments on commit da207d9

Please sign in to comment.