Files
vontor-cz/frontend/orval.config.ts
David Bruno Vontor 946f86db7e Refactor order creation and add configuration endpoints
Refactored order creation logic to use new serializers and transaction handling, improving validation and modularity. Introduced admin and public endpoints for shop configuration with sensitive fields protected. Enhanced Zásilkovna (Packeta) integration, including packet widget template, new API fields, and improved error handling. Added django-silk for profiling, updated requirements and settings, and improved frontend Orval config for API client generation.
2025-12-08 18:19:20 +01:00

74 lines
1.6 KiB
TypeScript

import { defineConfig } from "orval";
import "dotenv/config";
import {process} from "node:process";
const backendUrl = process.env.VITE_API_BASE_URL || "http://localhost:8000";
// může se hodit pokud nechceme při buildu generovat klienta (nechat false pro produkci nebo vynechat)
const SKIP_ORVAL = process.env.SKIP_ORVAL === "true";
if (SKIP_ORVAL) {
console.log("[ORVAL] Generation skipped.");
process.exit(0);
}
export default defineConfig({
public: {
input: {
target: `${backendUrl}/api/schema/`,
filters: {
mode: "include",
tags: ["public"],
},
},
output: {
target: "src/api/generated/public.ts",
schemas: "src/api/generated/public/models",
mode: "tags",
clean: true,
client: "react-query",
httpClient: "axios",
override: {
mutator: {
path: "src/api/publicClient.ts", //IMPORTANTE
name: "publicApi",
},
},
},
hooks: {
afterAllFilesWrite: 'prettier --write',
}
},
private: {
input: {
target: `${backendUrl}/api/schema/`
// No filters, include all endpoints
},
output: {
target: "src/api/generated/private.ts", //IMPORTANTE
schemas: "src/api/generated/private/models",
mode: "tags",
clean: true,
client: "react-query",
httpClient: "axios",
override: {
mutator: {
path: "src/api/privateClient.ts",
name: "privateApi",
},
},
},
hooks: {
afterAllFilesWrite: 'prettier --write',
}
},
});