feat(teams): add Team entity and cutover Person.department to Person.teamId
Co-authored-by: Asis Ferrer <aferrer@aferrer.dev> Co-committed-by: Asis Ferrer <aferrer@aferrer.dev>
This commit was merged in pull request #5.
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import type {
|
||||
PersonDepartment,
|
||||
PrismaClient,
|
||||
UserRole,
|
||||
} from "@/generated/prisma/client"
|
||||
import type { PrismaClient, UserRole } from "@/generated/prisma/client"
|
||||
import { UserStatus } from "@/generated/prisma/client"
|
||||
import { normalizeEmail } from "@/lib/email"
|
||||
|
||||
@@ -54,12 +50,25 @@ export async function createTestCategory(
|
||||
})
|
||||
}
|
||||
|
||||
export async function createTestTeam(
|
||||
prisma: PrismaClient,
|
||||
overrides: Partial<{ name: string }> = {},
|
||||
) {
|
||||
const suffix = nextSuffix()
|
||||
|
||||
return prisma.team.create({
|
||||
data: {
|
||||
name: overrides.name ?? `Test Team ${suffix}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function createTestPerson(
|
||||
prisma: PrismaClient,
|
||||
overrides: Partial<{
|
||||
firstName: string
|
||||
lastName: string
|
||||
department: PersonDepartment
|
||||
teamId: string | null
|
||||
email: string | null
|
||||
phone: string | null
|
||||
}> = {},
|
||||
@@ -70,26 +79,13 @@ export async function createTestPerson(
|
||||
data: {
|
||||
firstName: overrides.firstName ?? "Test",
|
||||
lastName: overrides.lastName ?? `Person-${suffix}`,
|
||||
department: overrides.department ?? "OTHER",
|
||||
teamId: overrides.teamId ?? null,
|
||||
email: overrides.email ?? null,
|
||||
phone: overrides.phone ?? null,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function createTestTeam(
|
||||
prisma: PrismaClient,
|
||||
overrides: Partial<{ name: string }> = {},
|
||||
) {
|
||||
const suffix = nextSuffix()
|
||||
|
||||
return prisma.team.create({
|
||||
data: {
|
||||
name: overrides.name ?? `Test Team ${suffix}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function createTestItem(
|
||||
prisma: PrismaClient,
|
||||
overrides: Partial<{
|
||||
|
||||
Reference in New Issue
Block a user