Titles with a cool effect

This commit is contained in:
Ahmed Al-Taiar
2024-10-04 23:13:44 -04:00
parent 8671f47e91
commit e5f9bbd462
19 changed files with 367 additions and 91 deletions

View File

@@ -3,6 +3,8 @@ import { db } from 'api/src/lib/db'
import { hashPassword } from '@redwoodjs/auth-dbauth-api'
const MAX_TITLES = 5
export default async () => {
try {
const admin = {
@@ -29,6 +31,24 @@ export default async () => {
salt,
},
})
const titles = await db.titles.findFirst()
await db.titles.upsert({
where: {
id: 1,
},
create: {
titles: Array.from({ length: MAX_TITLES }).map(
(_, i) => `a title ${i + 1}`
),
},
update: {
titles:
titles?.titles ||
Array.from({ length: MAX_TITLES }).map((_, i) => `a title ${i + 1}`),
},
})
} catch (error) {
console.error(error)
}