mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-22 16:03:29 +10:00
update imports/exports
This commit is contained in:
@@ -2,6 +2,7 @@ import { createSelectSchema } from "drizzle-zod";
|
||||
import z from "zod";
|
||||
import { schema } from "@/integrations/drizzle";
|
||||
import { resumeDataSchema } from "@/schema/resume/data";
|
||||
import { jsonPatchOperationSchema } from "@/utils/resume/patch";
|
||||
|
||||
const resumeSchema = createSelectSchema(schema.resume, {
|
||||
id: z.string().describe("The ID of the resume."),
|
||||
@@ -81,14 +82,7 @@ export const resumeDto = {
|
||||
input: z.object({
|
||||
id: z.string().describe("The ID of the resume to patch."),
|
||||
operations: z
|
||||
.array(
|
||||
z.object({
|
||||
op: z.enum(["add", "remove", "replace", "move", "copy", "test"]),
|
||||
path: z.string(),
|
||||
value: z.any().optional(),
|
||||
from: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
.array(jsonPatchOperationSchema)
|
||||
.min(1)
|
||||
.describe("An array of JSON Patch (RFC 6902) operations to apply to the resume data."),
|
||||
}),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { Operation } from "fast-json-patch";
|
||||
import z from "zod";
|
||||
import { sampleResumeData } from "@/schema/resume/sample";
|
||||
import { generateRandomName, slugify } from "@/utils/string";
|
||||
@@ -215,7 +214,7 @@ export const resumeRouter = {
|
||||
return await resumeService.patch({
|
||||
id: input.id,
|
||||
userId: context.user.id,
|
||||
operations: input.operations as Operation[],
|
||||
operations: input.operations,
|
||||
});
|
||||
}),
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import { defaultResumeData, resumeDataSchema } from "@/schema/resume/data";
|
||||
|
||||
export const aiProviderSchema = z.enum(["ollama", "openai", "gemini", "anthropic", "vercel-ai-gateway"]);
|
||||
|
||||
export type AIProvider = z.infer<typeof aiProviderSchema>;
|
||||
type AIProvider = z.infer<typeof aiProviderSchema>;
|
||||
|
||||
export type GetModelInput = {
|
||||
type GetModelInput = {
|
||||
provider: AIProvider;
|
||||
model: string;
|
||||
apiKey: string;
|
||||
@@ -49,9 +49,9 @@ export const fileInputSchema = z.object({
|
||||
data: z.string(), // base64 encoded
|
||||
});
|
||||
|
||||
export type TestConnectionInput = z.infer<typeof aiCredentialsSchema>;
|
||||
type TestConnectionInput = z.infer<typeof aiCredentialsSchema>;
|
||||
|
||||
export async function testConnection(input: TestConnectionInput): Promise<boolean> {
|
||||
async function testConnection(input: TestConnectionInput): Promise<boolean> {
|
||||
const RESPONSE_OK = "1";
|
||||
|
||||
const result = await generateText({
|
||||
@@ -63,11 +63,11 @@ export async function testConnection(input: TestConnectionInput): Promise<boolea
|
||||
return result.output === RESPONSE_OK;
|
||||
}
|
||||
|
||||
export type ParsePdfInput = z.infer<typeof aiCredentialsSchema> & {
|
||||
type ParsePdfInput = z.infer<typeof aiCredentialsSchema> & {
|
||||
file: z.infer<typeof fileInputSchema>;
|
||||
};
|
||||
|
||||
export async function parsePdf(input: ParsePdfInput): Promise<ResumeData> {
|
||||
async function parsePdf(input: ParsePdfInput): Promise<ResumeData> {
|
||||
const model = getModel(input);
|
||||
|
||||
const result = await generateText({
|
||||
@@ -101,12 +101,12 @@ export async function parsePdf(input: ParsePdfInput): Promise<ResumeData> {
|
||||
});
|
||||
}
|
||||
|
||||
export type ParseDocxInput = z.infer<typeof aiCredentialsSchema> & {
|
||||
type ParseDocxInput = z.infer<typeof aiCredentialsSchema> & {
|
||||
file: z.infer<typeof fileInputSchema>;
|
||||
mediaType: "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
};
|
||||
|
||||
export async function parseDocx(input: ParseDocxInput): Promise<ResumeData> {
|
||||
async function parseDocx(input: ParseDocxInput): Promise<ResumeData> {
|
||||
const model = getModel(input);
|
||||
|
||||
const result = await generateText({
|
||||
|
||||
@@ -82,7 +82,7 @@ export function isImageFile(mimeType: string): boolean {
|
||||
return IMAGE_MIME_TYPES.includes(mimeType);
|
||||
}
|
||||
|
||||
export interface ProcessedImage {
|
||||
interface ProcessedImage {
|
||||
data: Uint8Array;
|
||||
contentType: string;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ export function getStorageService(): StorageService {
|
||||
// High-level upload types
|
||||
type UploadType = "picture" | "screenshot" | "pdf";
|
||||
|
||||
export interface UploadFileInput {
|
||||
interface UploadFileInput {
|
||||
userId: string;
|
||||
data: Uint8Array;
|
||||
contentType: string;
|
||||
@@ -324,7 +324,7 @@ export interface UploadFileInput {
|
||||
resumeId?: string;
|
||||
}
|
||||
|
||||
export interface UploadFileResult {
|
||||
interface UploadFileResult {
|
||||
url: string;
|
||||
key: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user