refactor: update type imports to use 'type' for better TypeScript compatibility across the codebase
This commit is contained in:
@@ -7,9 +7,9 @@ import {
|
||||
updateAssignment,
|
||||
} from "@/lib/actions/assignament.actions"
|
||||
import {
|
||||
CreateAssetFormType,
|
||||
type CreateAssetFormType,
|
||||
createAssetSchema,
|
||||
UpdateAssetFormType,
|
||||
type UpdateAssetFormType,
|
||||
updateAssetSchema,
|
||||
} from "@/lib/schemas/asset.schemas"
|
||||
import { AssetService } from "@/services/asset.service"
|
||||
|
||||
@@ -11,9 +11,9 @@ import { MovementService } from "@/services/movement.service"
|
||||
|
||||
import {
|
||||
assignmentSchema,
|
||||
CreateAssignmentFormType,
|
||||
ReturnAssignmentFormType,
|
||||
UpdateAssignmentFormType,
|
||||
type CreateAssignmentFormType,
|
||||
type ReturnAssignmentFormType,
|
||||
type UpdateAssignmentFormType,
|
||||
updateAssignmentSchema,
|
||||
} from "../schemas/assignment.schemas"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { AuthError } from "next-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) {
|
||||
const { username, password } = values
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { revalidatePath } from "next/cache"
|
||||
|
||||
import {
|
||||
CreateCategoryFormType,
|
||||
type CreateCategoryFormType,
|
||||
createCategorySchema,
|
||||
UpdateCategoryFormType,
|
||||
type UpdateCategoryFormType,
|
||||
updateCategorySchema,
|
||||
} from "@/lib/schemas/category.schemas"
|
||||
import { CategoryService } from "@/services/category.service"
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { revalidatePath } from "next/cache"
|
||||
import Papa from "papaparse"
|
||||
|
||||
import { ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
||||
import { ImportItem } from "@/lib/types"
|
||||
import { type ImportFormType, importSchema } from "@/lib/schemas/import.schemas"
|
||||
import type { ImportItem } from "@/lib/types"
|
||||
import { AssetService } from "@/services/asset.service"
|
||||
import { AssignmentService } from "@/services/assignment.service"
|
||||
import { CategoryService } from "@/services/category.service"
|
||||
@@ -47,7 +47,7 @@ export async function importItems(formData: ImportFormType) {
|
||||
if (papaErrors.length > 0) {
|
||||
return {
|
||||
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 {
|
||||
CreateItemFormType,
|
||||
type CreateItemFormType,
|
||||
createItemSchema,
|
||||
UpdateItemFormType,
|
||||
type UpdateItemFormType,
|
||||
updateItemSchema,
|
||||
} from "@/lib/schemas/item.schemas"
|
||||
import { getAuthenticatedUserId } from "@/services/auth.service"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
CreateMovementFormType,
|
||||
type CreateMovementFormType,
|
||||
createMovementSchema,
|
||||
} from "../schemas/movement.schemas"
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { revalidatePath } from "next/cache"
|
||||
|
||||
import prisma from "@/lib/prisma"
|
||||
import {
|
||||
CreateRecipientFormType,
|
||||
type CreateRecipientFormType,
|
||||
createRecipientSchema,
|
||||
UpdateRecipientFormType,
|
||||
type UpdateRecipientFormType,
|
||||
updateRecipientSchema,
|
||||
} from "@/lib/schemas/recipients.schemas"
|
||||
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 { 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 { signInSchema } from "@/lib/schemas/auth.schemas"
|
||||
import { verifyPassword } from "@/lib/security"
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { Prisma } from "@/generated/prisma/client"
|
||||
import { PaginatedResult } from "@/lib/types"
|
||||
import type { Prisma } from "@/generated/prisma/client"
|
||||
import type { PaginatedResult } from "@/lib/types"
|
||||
|
||||
//eslint-disable-next-line
|
||||
type PaginationArgs<T> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
Asset as PrismaAsset,
|
||||
import type {
|
||||
Assignment,
|
||||
Asset as PrismaAsset,
|
||||
ItemStatus as PrismaItemStatus,
|
||||
} 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 { Item } from "./item"
|
||||
import { Recipient } from "./recipient"
|
||||
import type { Asset } from "./asset"
|
||||
import type { Item } from "./item"
|
||||
import type { Recipient } from "./recipient"
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 { Item } from "./item"
|
||||
import { Recipient } from "./recipient"
|
||||
import type { Asset } from "./asset"
|
||||
import type { Item } from "./item"
|
||||
import type { Recipient } from "./recipient"
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user