chore: apply Biome cleanup
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
"use server"
|
||||
|
||||
import { revalidatePath } from "next/cache"
|
||||
import { getAuthenticatedUserId } from "@/services/auth.service"
|
||||
import {
|
||||
createAssignmentUseCase,
|
||||
returnAssignmentUseCase,
|
||||
updateAssignmentUseCase,
|
||||
} from "@/use-cases/assignment.use-cases"
|
||||
|
||||
import {
|
||||
assignmentSchema,
|
||||
type CreateAssignmentFormType,
|
||||
@@ -15,6 +8,12 @@ import {
|
||||
type UpdateAssignmentFormType,
|
||||
updateAssignmentSchema,
|
||||
} from "@/schemas/assignment.schema"
|
||||
import { getAuthenticatedUserId } from "@/services/auth.service"
|
||||
import {
|
||||
createAssignmentUseCase,
|
||||
returnAssignmentUseCase,
|
||||
updateAssignmentUseCase,
|
||||
} from "@/use-cases/assignment.use-cases"
|
||||
|
||||
export async function createAssignment(formData: CreateAssignmentFormType) {
|
||||
const createdBy = await getAuthenticatedUserId()
|
||||
|
||||
@@ -77,9 +77,7 @@ export default async function AssignmentsPage(props: {
|
||||
<td className="p-4">
|
||||
{assignment?.asset?.serialNumber || "N/A"}
|
||||
</td>
|
||||
<td className="p-4">
|
||||
{assignment?.quantity}
|
||||
</td>
|
||||
<td className="p-4">{assignment?.quantity}</td>
|
||||
<td className="p-4">
|
||||
<div className="flex gap-2">
|
||||
<Link
|
||||
|
||||
@@ -8,4 +8,4 @@ export default function ForbiddenPage() {
|
||||
<Link href="/">Volver al inicio</Link>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+20
-8
@@ -1,14 +1,25 @@
|
||||
import type { Prisma } from "@/generated/prisma/client"
|
||||
import type { PaginatedResult } from "@/types"
|
||||
|
||||
type PaginationModel<T> = {
|
||||
findMany(args: {
|
||||
where?: unknown
|
||||
skip: number
|
||||
take: number
|
||||
orderBy?: unknown
|
||||
include?: unknown
|
||||
select?: unknown
|
||||
}): Promise<T[]>
|
||||
count(args: { where?: unknown }): Promise<number>
|
||||
}
|
||||
|
||||
type PaginationArgs<_T> = {
|
||||
model: any
|
||||
where?: Prisma.Enumerable<any>
|
||||
model: unknown
|
||||
where?: unknown
|
||||
page?: number
|
||||
pageSize?: number
|
||||
orderBy?: any
|
||||
include?: Prisma.Enumerable<any>
|
||||
select?: Prisma.Enumerable<any>
|
||||
orderBy?: unknown
|
||||
include?: unknown
|
||||
select?: unknown
|
||||
}
|
||||
|
||||
export async function paginate<T>({
|
||||
@@ -21,9 +32,10 @@ export async function paginate<T>({
|
||||
select,
|
||||
}: PaginationArgs<T>): Promise<PaginatedResult<T>> {
|
||||
const skip = (page - 1) * pageSize
|
||||
const paginatedModel = model as PaginationModel<T>
|
||||
|
||||
const [data, totalItems] = await Promise.all([
|
||||
model.findMany({
|
||||
paginatedModel.findMany({
|
||||
where,
|
||||
skip,
|
||||
take: pageSize,
|
||||
@@ -31,7 +43,7 @@ export async function paginate<T>({
|
||||
include,
|
||||
select,
|
||||
}),
|
||||
model.count({ where }),
|
||||
paginatedModel.count({ where }),
|
||||
])
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user