mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 10:19:35 +01:00
chore(types): OpenAPI-Spec update
This commit is contained in:
parent
d27dbaa843
commit
d20fb4108a
11 changed files with 2468 additions and 45 deletions
1
frontend/openapi.json
Normal file
1
frontend/openapi.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -3,6 +3,15 @@
|
|||
"version": "0.1.0",
|
||||
"description": "HTTP client for the Effigenix ERP API",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
|
|
@ -10,6 +19,7 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
"version": "0.1.0",
|
||||
"description": "Shared configuration constants for Effigenix ERP",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
|
|
@ -10,6 +19,7 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
"version": "0.1.0",
|
||||
"description": "TypeScript types for Effigenix ERP (auto-generated from OpenAPI)",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
|
|
@ -10,10 +19,12 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"generate:types": "openapi-typescript http://localhost:8080/api-docs -o src/generated/api.ts",
|
||||
"build": "pnpm run generate:types && tsup",
|
||||
"generate:types": "openapi-typescript ../../openapi.json -o src/generated/api.ts",
|
||||
"generate:spec": "curl -sf http://localhost:8080/api-docs -o ../../openapi.json",
|
||||
"build": "tsup",
|
||||
"dev": "tsup --watch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"clean": "rm -rf dist .turbo"
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ export type LoginResponse = components['schemas']['LoginResponse'];
|
|||
// Token Refresh
|
||||
export type RefreshTokenRequest = components['schemas']['RefreshTokenRequest'];
|
||||
|
||||
// Session Token
|
||||
export type SessionToken = components['schemas']['SessionToken'];
|
||||
|
||||
/**
|
||||
* Custom types not in OpenAPI spec
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,15 +3,17 @@
|
|||
* Re-exports types from the auto-generated OpenAPI schema
|
||||
*/
|
||||
|
||||
import type { components } from './generated/api';
|
||||
|
||||
// Error handling
|
||||
export type ErrorResponse = components['schemas']['ErrorResponse'];
|
||||
|
||||
/**
|
||||
* Custom common types
|
||||
*/
|
||||
|
||||
export interface ErrorResponse {
|
||||
message: string;
|
||||
status?: number;
|
||||
timestamp?: string;
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export interface ValidationError {
|
||||
field: string;
|
||||
message: string;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,8 +7,8 @@ import type { components } from './generated/api';
|
|||
|
||||
// Role DTOs
|
||||
export type RoleDTO = components['schemas']['RoleDTO'];
|
||||
export type RoleName = components['schemas']['RoleName'];
|
||||
export type Permission = components['schemas']['Permission'];
|
||||
export type RoleName = NonNullable<RoleDTO['name']>;
|
||||
export type Permission = NonNullable<RoleDTO['permissions']>[number];
|
||||
|
||||
/**
|
||||
* Custom types for UI
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
"version": "0.1.0",
|
||||
"description": "Zod validation schemas for Effigenix ERP",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
|
|
@ -10,6 +19,7 @@
|
|||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
|
|
|
|||
7
makefile
Normal file
7
makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
backend/run:
|
||||
cd backend && mvn spring-boot:run
|
||||
|
||||
generate/openapi:
|
||||
./scripts/generate-openapi.sh
|
||||
52
scripts/generate-openapi.sh
Executable file
52
scripts/generate-openapi.sh
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BACKEND_DIR="$(cd "$(dirname "$0")/../backend" && pwd)"
|
||||
FRONTEND_DIR="$(cd "$(dirname "$0")/../frontend" && pwd)"
|
||||
API_DOCS_URL="http://localhost:8080/api-docs"
|
||||
TIMEOUT=60
|
||||
BACKEND_PID=""
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "$BACKEND_PID" ]]; then
|
||||
echo "→ Backend wird gestoppt (PID $BACKEND_PID)..."
|
||||
kill "$BACKEND_PID" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
wait_for_backend() {
|
||||
echo "→ Warte auf Backend ($TIMEOUT s)..."
|
||||
local elapsed=0
|
||||
until curl -sf "$API_DOCS_URL" -o /dev/null; do
|
||||
if (( elapsed >= TIMEOUT )); then
|
||||
echo "✗ Backend nicht erreichbar nach ${TIMEOUT}s" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
(( elapsed += 2 ))
|
||||
done
|
||||
echo "✓ Backend bereit"
|
||||
}
|
||||
|
||||
# Backend starten falls nicht erreichbar
|
||||
if curl -sf "$API_DOCS_URL" -o /dev/null 2>/dev/null; then
|
||||
echo "✓ Backend läuft bereits"
|
||||
else
|
||||
echo "→ Backend wird gestartet..."
|
||||
mvn -f "$BACKEND_DIR/pom.xml" spring-boot:run -q &
|
||||
BACKEND_PID=$!
|
||||
wait_for_backend
|
||||
fi
|
||||
|
||||
echo "→ OpenAPI-Spec wird generiert..."
|
||||
curl -sf "$API_DOCS_URL" -o "$FRONTEND_DIR/openapi.json"
|
||||
echo "✓ openapi.json aktualisiert"
|
||||
|
||||
echo "→ TypeScript-Typen werden generiert..."
|
||||
pnpm --filter @effigenix/types --prefix "$FRONTEND_DIR" generate:types
|
||||
echo "✓ src/generated/api.ts aktualisiert"
|
||||
|
||||
echo ""
|
||||
echo "Fertig. Bitte committen:"
|
||||
echo " git add frontend/openapi.json frontend/packages/types/src/generated/api.ts"
|
||||
Loading…
Add table
Add a link
Reference in a new issue