refactor: add and use assignment data output type in services
This commit is contained in:
@@ -26,6 +26,7 @@ export const createAssignmentSchema = assignmentSchema.omit({
|
||||
returnDate: true,
|
||||
})
|
||||
export type CreateAssignmentFormType = z.input<typeof createAssignmentSchema>
|
||||
export type CreateAssignmentData = z.output<typeof createAssignmentSchema>
|
||||
|
||||
export const updateAssignmentSchema = assignmentSchema
|
||||
.omit({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Prisma } from "@/generated/prisma/client"
|
||||
import { paginate } from "@/lib/paginate"
|
||||
import prisma from "@/lib/prisma"
|
||||
import type { CreateAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
||||
import type { CreateAssignmentData } from "@/lib/schemas/assignment.schemas"
|
||||
import type { Assignment, AssignmentWithRecipientItemAsset } from "@/lib/types"
|
||||
|
||||
import { getAuthenticatedUserId } from "./auth.service"
|
||||
@@ -94,7 +94,7 @@ export const AssignmentService = {
|
||||
},
|
||||
})
|
||||
},
|
||||
create: async (data: CreateAssignmentFormType): Promise<Assignment> => {
|
||||
create: async (data: CreateAssignmentData): Promise<Assignment> => {
|
||||
return prisma.assignment.create({
|
||||
data: {
|
||||
...data,
|
||||
|
||||
Reference in New Issue
Block a user