refactor: update type imports to use 'type' for better TypeScript compatibility across the codebase
This commit is contained in:
@@ -7,7 +7,7 @@ import { useForm } from "react-hook-form"
|
|||||||
|
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { signInAction } from "@/lib/actions/auth.actions"
|
import { signInAction } from "@/lib/actions/auth.actions"
|
||||||
import { SignInFormType, signInSchema } from "@/lib/schemas/auth.schemas"
|
import { type SignInFormType, signInSchema } from "@/lib/schemas/auth.schemas"
|
||||||
|
|
||||||
export default function SignInForm() {
|
export default function SignInForm() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { UpdateAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
import type { UpdateAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
||||||
import type { Item } from "@/lib/types"
|
import type { Item } from "@/lib/types"
|
||||||
import { AssetService } from "@/services/asset.service"
|
import { AssetService } from "@/services/asset.service"
|
||||||
import { AssignmentService } from "@/services/assignment.service"
|
import { AssignmentService } from "@/services/assignment.service"
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { updateAssignment } from "@/lib/actions/assignament.actions"
|
import { updateAssignment } from "@/lib/actions/assignament.actions"
|
||||||
import {
|
import {
|
||||||
UpdateAssignmentFormType,
|
type UpdateAssignmentFormType,
|
||||||
updateAssignmentSchema,
|
updateAssignmentSchema,
|
||||||
} from "@/lib/schemas/assignment.schemas"
|
} from "@/lib/schemas/assignment.schemas"
|
||||||
import { Asset, Item, Recipient } from "@/lib/types"
|
import type { Asset, Item, Recipient } from "@/lib/types"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
recipients: Recipient[]
|
recipients: Recipient[]
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { createAssignment } from "@/lib/actions/assignament.actions"
|
import { createAssignment } from "@/lib/actions/assignament.actions"
|
||||||
import {
|
import {
|
||||||
CreateAssignmentFormType,
|
type CreateAssignmentFormType,
|
||||||
createAssignmentSchema,
|
createAssignmentSchema,
|
||||||
} from "@/lib/schemas/assignment.schemas"
|
} from "@/lib/schemas/assignment.schemas"
|
||||||
import { Asset, Item, Recipient } from "@/lib/types"
|
import type { Asset, Item, Recipient } from "@/lib/types"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
recipients: Recipient[]
|
recipients: Recipient[]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { toast } from "sonner"
|
|||||||
|
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { returnAssignment } from "@/lib/actions/assignament.actions"
|
import { returnAssignment } from "@/lib/actions/assignament.actions"
|
||||||
import { ReturnAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
import type { ReturnAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
||||||
|
|
||||||
export default function ReturnButton({
|
export default function ReturnButton({
|
||||||
assignmentId,
|
assignmentId,
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod"
|
import { zodResolver } from "@hookform/resolvers/zod"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { ChangeEvent } from "react"
|
import type { ChangeEvent } from "react"
|
||||||
import { useForm } from "react-hook-form"
|
import { useForm } from "react-hook-form"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
|
|
||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { importItems } from "@/lib/actions/import.actions"
|
import { importItems } from "@/lib/actions/import.actions"
|
||||||
import { ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
import { type ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
||||||
import { CategorySummary } from "@/lib/types"
|
import type { CategorySummary } from "@/lib/types"
|
||||||
|
|
||||||
export default function ImportForm({
|
export default function ImportForm({
|
||||||
categories,
|
categories,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use server"
|
"use server"
|
||||||
|
|
||||||
import { AssetWithAssignment } from "@/lib/types"
|
import type { AssetWithAssignment } from "@/lib/types"
|
||||||
import { AssetService } from "@/services/asset.service"
|
import { AssetService } from "@/services/asset.service"
|
||||||
import { ItemService } from "@/services/item.service"
|
import { ItemService } from "@/services/item.service"
|
||||||
import { RecipientService } from "@/services/recipient.service"
|
import { RecipientService } from "@/services/recipient.service"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import { SubmitButton } from "@/components/forms/submitButton"
|
|||||||
import { ItemStatus } from "@/generated/prisma/client"
|
import { ItemStatus } from "@/generated/prisma/client"
|
||||||
import { updateAssetAction } from "@/lib/actions/asset.actions"
|
import { updateAssetAction } from "@/lib/actions/asset.actions"
|
||||||
import {
|
import {
|
||||||
UpdateAssetFormType,
|
type UpdateAssetFormType,
|
||||||
updateAssetSchema,
|
updateAssetSchema,
|
||||||
} from "@/lib/schemas/asset.schemas"
|
} from "@/lib/schemas/asset.schemas"
|
||||||
import {
|
import type {
|
||||||
AssetWithAssignment,
|
AssetWithAssignment,
|
||||||
Item,
|
Item,
|
||||||
Recipient,
|
Recipient,
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import { SubmitButton } from "@/components/forms/submitButton"
|
|||||||
import { ItemStatus } from "@/generated/prisma/client"
|
import { ItemStatus } from "@/generated/prisma/client"
|
||||||
import { createAssetAction } from "@/lib/actions/asset.actions"
|
import { createAssetAction } from "@/lib/actions/asset.actions"
|
||||||
import {
|
import {
|
||||||
CreateAssetFormType,
|
type CreateAssetFormType,
|
||||||
createAssetSchema,
|
createAssetSchema,
|
||||||
} from "@/lib/schemas/asset.schemas"
|
} from "@/lib/schemas/asset.schemas"
|
||||||
import { ItemWithoutStock, Recipient } from "@/lib/types"
|
import type { ItemWithoutStock, Recipient } from "@/lib/types"
|
||||||
|
|
||||||
interface NewAssetFormProps {
|
interface NewAssetFormProps {
|
||||||
items: ItemWithoutStock[]
|
items: ItemWithoutStock[]
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { updateCategoryAction } from "@/lib/actions/category.actions"
|
import { updateCategoryAction } from "@/lib/actions/category.actions"
|
||||||
import {
|
import {
|
||||||
UpdateCategoryFormType,
|
type UpdateCategoryFormType,
|
||||||
updateCategorySchema,
|
updateCategorySchema,
|
||||||
} from "@/lib/schemas/category.schemas"
|
} from "@/lib/schemas/category.schemas"
|
||||||
import { CategorySummary } from "@/lib/types"
|
import type { CategorySummary } from "@/lib/types"
|
||||||
|
|
||||||
export default function EditCategoryForm({
|
export default function EditCategoryForm({
|
||||||
category,
|
category,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { createCategoryAction } from "@/lib/actions/category.actions"
|
import { createCategoryAction } from "@/lib/actions/category.actions"
|
||||||
import {
|
import {
|
||||||
CreateCategoryFormType,
|
type CreateCategoryFormType,
|
||||||
createCategorySchema,
|
createCategorySchema,
|
||||||
} from "@/lib/schemas/category.schemas"
|
} from "@/lib/schemas/category.schemas"
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { createItemAction } from "@/lib/actions/item.actions"
|
import { createItemAction } from "@/lib/actions/item.actions"
|
||||||
import {
|
import {
|
||||||
CreateItemFormType,
|
type CreateItemFormType,
|
||||||
createItemSchema,
|
createItemSchema,
|
||||||
} from "@/lib/schemas/item.schemas"
|
} from "@/lib/schemas/item.schemas"
|
||||||
import { CategorySummary } from "@/lib/types"
|
import type { CategorySummary } from "@/lib/types"
|
||||||
|
|
||||||
export default function NewItemForm({
|
export default function NewItemForm({
|
||||||
categories,
|
categories,
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { toast } from "sonner"
|
|||||||
import { SubmitButton } from "@/components/forms/submitButton"
|
import { SubmitButton } from "@/components/forms/submitButton"
|
||||||
import { updateItemAction } from "@/lib/actions/item.actions"
|
import { updateItemAction } from "@/lib/actions/item.actions"
|
||||||
import {
|
import {
|
||||||
UpdateItemFormType,
|
type UpdateItemFormType,
|
||||||
updateItemSchema,
|
updateItemSchema,
|
||||||
} from "@/lib/schemas/item.schemas"
|
} from "@/lib/schemas/item.schemas"
|
||||||
import { CategorySummary, ItemWithAssetCount } from "@/lib/types"
|
import type { CategorySummary, ItemWithAssetCount } from "@/lib/types"
|
||||||
|
|
||||||
export default function UpdateItemForm({
|
export default function UpdateItemForm({
|
||||||
categories,
|
categories,
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import {
|
|||||||
updateRecipient,
|
updateRecipient,
|
||||||
} from "@/lib/actions/recipient.actions"
|
} from "@/lib/actions/recipient.actions"
|
||||||
import {
|
import {
|
||||||
CreateRecipientFormType,
|
type CreateRecipientFormType,
|
||||||
recipientSchema,
|
recipientSchema,
|
||||||
UpdateRecipientFormType,
|
type UpdateRecipientFormType,
|
||||||
} from "@/lib/schemas/recipients.schemas"
|
} from "@/lib/schemas/recipients.schemas"
|
||||||
import { Recipient } from "@/lib/types"
|
import type { Recipient } from "@/lib/types"
|
||||||
|
|
||||||
interface RecipientFormProps {
|
interface RecipientFormProps {
|
||||||
initialData?: Recipient
|
initialData?: Recipient
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Link from "next/link"
|
|||||||
import PageHeader from "@/components/common/pageheader"
|
import PageHeader from "@/components/common/pageheader"
|
||||||
import PaginationButtons from "@/components/common/pagination"
|
import PaginationButtons from "@/components/common/pagination"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Recipient } from "@/generated/prisma/client"
|
import type { Recipient } from "@/generated/prisma/client"
|
||||||
import { RecipientService } from "@/services/recipient.service"
|
import { RecipientService } from "@/services/recipient.service"
|
||||||
|
|
||||||
export default async function RecipientsPage(props: {
|
export default async function RecipientsPage(props: {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
import { ChevronRight } from "lucide-react"
|
import { ChevronRight } from "lucide-react"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import React, { useEffect, useState } from "react"
|
import type React from "react"
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Collapsible,
|
Collapsible,
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
updateAssignment,
|
updateAssignment,
|
||||||
} from "@/lib/actions/assignament.actions"
|
} from "@/lib/actions/assignament.actions"
|
||||||
import {
|
import {
|
||||||
CreateAssetFormType,
|
type CreateAssetFormType,
|
||||||
createAssetSchema,
|
createAssetSchema,
|
||||||
UpdateAssetFormType,
|
type UpdateAssetFormType,
|
||||||
updateAssetSchema,
|
updateAssetSchema,
|
||||||
} from "@/lib/schemas/asset.schemas"
|
} from "@/lib/schemas/asset.schemas"
|
||||||
import { AssetService } from "@/services/asset.service"
|
import { AssetService } from "@/services/asset.service"
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import { MovementService } from "@/services/movement.service"
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
assignmentSchema,
|
assignmentSchema,
|
||||||
CreateAssignmentFormType,
|
type CreateAssignmentFormType,
|
||||||
ReturnAssignmentFormType,
|
type ReturnAssignmentFormType,
|
||||||
UpdateAssignmentFormType,
|
type UpdateAssignmentFormType,
|
||||||
updateAssignmentSchema,
|
updateAssignmentSchema,
|
||||||
} from "../schemas/assignment.schemas"
|
} from "../schemas/assignment.schemas"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { AuthError } from "next-auth"
|
import { AuthError } from "next-auth"
|
||||||
|
|
||||||
import { signIn } from "@/lib/auth"
|
import { signIn } from "@/lib/auth"
|
||||||
import { SignInFormType } from "@/lib/schemas/auth.schemas"
|
import type { SignInFormType } from "@/lib/schemas/auth.schemas"
|
||||||
|
|
||||||
export async function signInAction(values: SignInFormType) {
|
export async function signInAction(values: SignInFormType) {
|
||||||
const { username, password } = values
|
const { username, password } = values
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { revalidatePath } from "next/cache"
|
import { revalidatePath } from "next/cache"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateCategoryFormType,
|
type CreateCategoryFormType,
|
||||||
createCategorySchema,
|
createCategorySchema,
|
||||||
UpdateCategoryFormType,
|
type UpdateCategoryFormType,
|
||||||
updateCategorySchema,
|
updateCategorySchema,
|
||||||
} from "@/lib/schemas/category.schemas"
|
} from "@/lib/schemas/category.schemas"
|
||||||
import { CategoryService } from "@/services/category.service"
|
import { CategoryService } from "@/services/category.service"
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { revalidatePath } from "next/cache"
|
import { revalidatePath } from "next/cache"
|
||||||
import Papa from "papaparse"
|
import Papa from "papaparse"
|
||||||
|
|
||||||
import { ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
import { type ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
||||||
import { ImportItem } from "@/lib/types"
|
import type { ImportItem } from "@/lib/types"
|
||||||
import { AssetService } from "@/services/asset.service"
|
import { AssetService } from "@/services/asset.service"
|
||||||
import { AssignmentService } from "@/services/assignment.service"
|
import { AssignmentService } from "@/services/assignment.service"
|
||||||
import { CategoryService } from "@/services/category.service"
|
import { CategoryService } from "@/services/category.service"
|
||||||
@@ -47,7 +47,7 @@ export async function importItems(formData: ImportFormType) {
|
|||||||
if (papaErrors.length > 0) {
|
if (papaErrors.length > 0) {
|
||||||
return {
|
return {
|
||||||
errors: {
|
errors: {
|
||||||
file: papaErrors.map((err) => err.message).flat(),
|
file: papaErrors.flatMap((err) => err.message),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { revalidatePath } from "next/cache"
|
|||||||
|
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import {
|
import {
|
||||||
CreateItemFormType,
|
type CreateItemFormType,
|
||||||
createItemSchema,
|
createItemSchema,
|
||||||
UpdateItemFormType,
|
type UpdateItemFormType,
|
||||||
updateItemSchema,
|
updateItemSchema,
|
||||||
} from "@/lib/schemas/item.schemas"
|
} from "@/lib/schemas/item.schemas"
|
||||||
import { getAuthenticatedUserId } from "@/services/auth.service"
|
import { getAuthenticatedUserId } from "@/services/auth.service"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
CreateMovementFormType,
|
type CreateMovementFormType,
|
||||||
createMovementSchema,
|
createMovementSchema,
|
||||||
} from "../schemas/movement.schemas"
|
} from "../schemas/movement.schemas"
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { revalidatePath } from "next/cache"
|
|||||||
|
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import {
|
import {
|
||||||
CreateRecipientFormType,
|
type CreateRecipientFormType,
|
||||||
createRecipientSchema,
|
createRecipientSchema,
|
||||||
UpdateRecipientFormType,
|
type UpdateRecipientFormType,
|
||||||
updateRecipientSchema,
|
updateRecipientSchema,
|
||||||
} from "@/lib/schemas/recipients.schemas"
|
} from "@/lib/schemas/recipients.schemas"
|
||||||
import { RecipientService } from "@/services/recipient.service"
|
import { RecipientService } from "@/services/recipient.service"
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import NextAuth, { type DefaultSession } from "next-auth"
|
|||||||
import Credentials from "next-auth/providers/credentials"
|
import Credentials from "next-auth/providers/credentials"
|
||||||
import { ZodError } from "zod"
|
import { ZodError } from "zod"
|
||||||
|
|
||||||
import { UserRole } from "@/generated/prisma/client"
|
import type { UserRole } from "@/generated/prisma/client"
|
||||||
import { SIGN_IN_URL, TOKEN_EXPIRATION_SECONDS } from "@/lib/constants"
|
import { SIGN_IN_URL, TOKEN_EXPIRATION_SECONDS } from "@/lib/constants"
|
||||||
import { signInSchema } from "@/lib/schemas/auth.schemas"
|
import { signInSchema } from "@/lib/schemas/auth.schemas"
|
||||||
import { verifyPassword } from "@/lib/security"
|
import { verifyPassword } from "@/lib/security"
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { Prisma } from "@/generated/prisma/client"
|
import type { Prisma } from "@/generated/prisma/client"
|
||||||
import { PaginatedResult } from "@/lib/types"
|
import type { PaginatedResult } from "@/lib/types"
|
||||||
|
|
||||||
//eslint-disable-next-line
|
//eslint-disable-next-line
|
||||||
type PaginationArgs<T> = {
|
type PaginationArgs<T> = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import type {
|
||||||
Asset as PrismaAsset,
|
|
||||||
Assignment,
|
Assignment,
|
||||||
|
Asset as PrismaAsset,
|
||||||
ItemStatus as PrismaItemStatus,
|
ItemStatus as PrismaItemStatus,
|
||||||
} from "@/generated/prisma/client"
|
} from "@/generated/prisma/client"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Assignment as PrismaAssignment } from "@/generated/prisma/client"
|
import type { Assignment as PrismaAssignment } from "@/generated/prisma/client"
|
||||||
|
|
||||||
import { Asset } from "./asset"
|
import type { Asset } from "./asset"
|
||||||
import { Item } from "./item"
|
import type { Item } from "./item"
|
||||||
import { Recipient } from "./recipient"
|
import type { Recipient } from "./recipient"
|
||||||
|
|
||||||
export type Assignment = PrismaAssignment
|
export type Assignment = PrismaAssignment
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Category as PrismaCategory } from "@/generated/prisma/client"
|
import type { Category as PrismaCategory } from "@/generated/prisma/client"
|
||||||
|
|
||||||
export type Category = PrismaCategory
|
export type Category = PrismaCategory
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Category, Item as PrismaItem } from "@/generated/prisma/client"
|
import type { Category, Item as PrismaItem } from "@/generated/prisma/client"
|
||||||
|
|
||||||
export type Item = PrismaItem
|
export type Item = PrismaItem
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Movement as PrismaMovement } from "@/generated/prisma/client"
|
import type { Movement as PrismaMovement } from "@/generated/prisma/client"
|
||||||
|
|
||||||
import { Asset } from "./asset"
|
import type { Asset } from "./asset"
|
||||||
import { Item } from "./item"
|
import type { Item } from "./item"
|
||||||
import { Recipient } from "./recipient"
|
import type { Recipient } from "./recipient"
|
||||||
|
|
||||||
export type Movement = PrismaMovement
|
export type Movement = PrismaMovement
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { Recipient as PrismaRecipient } from "@/generated/prisma/client"
|
import type { Recipient as PrismaRecipient } from "@/generated/prisma/client"
|
||||||
|
|
||||||
export type Recipient = PrismaRecipient
|
export type Recipient = PrismaRecipient
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { User as PrismaUser } from "@/generated/prisma/client"
|
import type { User as PrismaUser } from "@/generated/prisma/client"
|
||||||
|
|
||||||
export type User = PrismaUser
|
export type User = PrismaUser
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Asset, Prisma } from "@/generated/prisma/client"
|
import type { Asset, Prisma } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import {
|
import type {
|
||||||
AssetWithAssignment,
|
AssetWithAssignment,
|
||||||
AssetWithItemAndCategory,
|
AssetWithItemAndCategory,
|
||||||
} from "@/lib/types/asset"
|
} from "@/lib/types/asset"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Prisma } from "@/generated/prisma/client"
|
import type { Prisma } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import { CreateAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
import type { CreateAssignmentFormType } from "@/lib/schemas/assignment.schemas"
|
||||||
import { Assignment, AssignmentWithRecipientItemAsset } from "@/lib/types"
|
import type { Assignment, AssignmentWithRecipientItemAsset } from "@/lib/types"
|
||||||
|
|
||||||
import { getAuthenticatedUserId } from "./auth.service"
|
import { getAuthenticatedUserId } from "./auth.service"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Prisma } from "@/generated/prisma/client"
|
import type { Prisma } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import { Category, CategorySummary, CategoryWithItemsCount } from "@/lib/types"
|
import type { Category, CategorySummary, CategoryWithItemsCount } from "@/lib/types"
|
||||||
|
|
||||||
export const CategoryService = {
|
export const CategoryService = {
|
||||||
findAll: async (): Promise<CategorySummary[]> => {
|
findAll: async (): Promise<CategorySummary[]> => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Prisma } from "@/generated/prisma/client"
|
import type { Prisma } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import {
|
import type {
|
||||||
Item,
|
Item,
|
||||||
ItemSummary,
|
ItemSummary,
|
||||||
ItemWithAssetAndMovementCount,
|
ItemWithAssetAndMovementCount,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { MovementType, Prisma } from "@/generated/prisma/client"
|
import type { MovementType, Prisma } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import { CreateMovementFormType } from "@/lib/schemas/movement.schemas"
|
import type { CreateMovementFormType } from "@/lib/schemas/movement.schemas"
|
||||||
import { Movement } from "@/lib/types"
|
import type { Movement } from "@/lib/types"
|
||||||
|
|
||||||
import { getAuthenticatedUserId } from "./auth.service"
|
import { getAuthenticatedUserId } from "./auth.service"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Prisma, Recipient } from "@/generated/prisma/client"
|
import type { Prisma, Recipient } from "@/generated/prisma/client"
|
||||||
import { paginate } from "@/lib/paginate"
|
import { paginate } from "@/lib/paginate"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { UserRole } from "@/generated/prisma/client"
|
import { UserRole } from "@/generated/prisma/client"
|
||||||
import prisma from "@/lib/prisma"
|
import prisma from "@/lib/prisma"
|
||||||
import { getPasswordHash } from "@/lib/security"
|
import { getPasswordHash } from "@/lib/security"
|
||||||
import { User } from "@/lib/types/user"
|
import type { User } from "@/lib/types/user"
|
||||||
|
|
||||||
export async function createUser({ data }: { data: User }) {
|
export async function createUser({ data }: { data: User }) {
|
||||||
const newUser = await prisma.user.create({
|
const newUser = await prisma.user.create({
|
||||||
|
|||||||
Reference in New Issue
Block a user