chore: apply Biome cleanup
This commit is contained in:
@@ -10,10 +10,7 @@
|
||||
// "features": {},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// This can be used to network with other containers or with the host.
|
||||
"forwardPorts": [
|
||||
3000,
|
||||
5432
|
||||
],
|
||||
"forwardPorts": [3000, 5432],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "bun i",
|
||||
// Use 'postStartCommand' to run commands after the container is started.
|
||||
@@ -38,4 +35,4 @@
|
||||
"containerEnv": {
|
||||
"SHELL": "/bin/bash"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -11,5 +11,5 @@
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,4 +63,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"iconLibrary": "lucide"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { NextConfig } from "next"
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { execFileSync, spawn, type ChildProcess } from "node:child_process"
|
||||
import { type ChildProcess, execFileSync, spawn } from "node:child_process"
|
||||
import process from "node:process"
|
||||
import {
|
||||
PostgreSqlContainer,
|
||||
|
||||
@@ -60,7 +60,9 @@ describe("assignment use-cases", () => {
|
||||
prisma.assignment.findUniqueOrThrow({
|
||||
where: { id: result.assignmentId },
|
||||
}),
|
||||
prisma.movement.findMany({ orderBy: [{ createdAt: "asc" }, { id: "asc" }] }),
|
||||
prisma.movement.findMany({
|
||||
orderBy: [{ createdAt: "asc" }, { id: "asc" }],
|
||||
}),
|
||||
])
|
||||
|
||||
expect(updatedItem.stock).toBe(3)
|
||||
@@ -138,7 +140,9 @@ describe("assignment use-cases", () => {
|
||||
prisma.assignment.findUniqueOrThrow({
|
||||
where: { id: created.assignmentId },
|
||||
}),
|
||||
prisma.movement.findMany({ orderBy: [{ createdAt: "asc" }, { id: "asc" }] }),
|
||||
prisma.movement.findMany({
|
||||
orderBy: [{ createdAt: "asc" }, { id: "asc" }],
|
||||
}),
|
||||
])
|
||||
|
||||
expect(updatedItem.stock).toBe(4)
|
||||
|
||||
Reference in New Issue
Block a user