Ignore generated OpenAPI types
This commit is contained in:
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
@@ -2,8 +2,8 @@ from fastapi import APIRouter, Depends
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from fastapi_demo.app.db.deps import get_db
|
from fastapi_demo.app.infrastructure.db.deps import get_db
|
||||||
from fastapi_demo.app.repositories.sql_assets_repo import SqlAssetsRepo
|
from fastapi_demo.app.infrastructure.repositories.sql_assets_repo import SqlAssetsRepo
|
||||||
from fastapi_demo.app.services.assets_service import AssetsService
|
from fastapi_demo.app.services.assets_service import AssetsService
|
||||||
from fastapi_demo.app.schemas.asset import (
|
from fastapi_demo.app.schemas.asset import (
|
||||||
AssetCreate,
|
AssetCreate,
|
||||||
|
|||||||
7
fastapi_demo/app/api/schemas/api_router.py
Normal file
7
fastapi_demo/app/api/schemas/api_router.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
from fastapi_demo.app.api.routes.health import router as health_router
|
||||||
|
from fastapi_demo.app.api.routes.assets import router as assets_router
|
||||||
|
|
||||||
|
api_router = APIRouter(prefix="/api")
|
||||||
|
api_router.include_router(health_router)
|
||||||
|
api_router.include_router(assets_router)
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
from fastapi_demo.app.db.session import Base # noqa: F401
|
|
||||||
from fastapi_demo.app.db import models # noqa: F401
|
|
||||||
2
fastapi_demo/app/infrastructure/db/base.py
Normal file
2
fastapi_demo/app/infrastructure/db/base.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from fastapi_demo.app.infrastructure.db.session import Base # noqa: F401
|
||||||
|
from fastapi_demo.app.infrastructure.db import models # noqa: F401
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
from fastapi_demo.app.db.session import SessionLocal
|
from fastapi_demo.app.infrastructure.db.session import SessionLocal
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ from sqlalchemy import String, DateTime, Text, ForeignKey, Integer, text
|
|||||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from fastapi_demo.app.db.session import Base
|
from fastapi_demo.app.infrastructure.db.session import Base
|
||||||
|
|
||||||
|
|
||||||
class Asset(Base):
|
class Asset(Base):
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
from fastapi_demo.app.repositories.assets_repo import AssetsRepo
|
from fastapi_demo.app.infrastructure.repositories.assets_repo import AssetsRepo
|
||||||
from fastapi_demo.app.schemas.asset import AssetOut, AssetEventOut
|
from fastapi_demo.app.schemas.asset import AssetOut, AssetEventOut
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +7,10 @@ from fastapi import HTTPException
|
|||||||
from sqlalchemy import select, update
|
from sqlalchemy import select, update
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from fastapi_demo.app.db.models import Asset as AssetORM, AssetEvent as AssetEventORM
|
from fastapi_demo.app.infrastructure.db.models import (
|
||||||
|
Asset as AssetORM,
|
||||||
|
AssetEvent as AssetEventORM,
|
||||||
|
)
|
||||||
from fastapi_demo.app.domain.status import AssetStatus
|
from fastapi_demo.app.domain.status import AssetStatus
|
||||||
from fastapi_demo.app.schemas.asset import AssetOut, AssetEventOut
|
from fastapi_demo.app.schemas.asset import AssetOut, AssetEventOut
|
||||||
|
|
||||||
@@ -1,24 +1,15 @@
|
|||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
from fastapi_demo.app.db.session import dispose_engine
|
from fastapi_demo.app.infrastructure.db.session import dispose_engine
|
||||||
from fastapi_demo.app.api.routes.health import router as health_router
|
from fastapi_demo.app.api.schemas.api_router import api_router
|
||||||
from fastapi_demo.app.api.routes.assets import router as assets_router
|
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
# Startup
|
|
||||||
yield
|
yield
|
||||||
# Shutdown
|
|
||||||
dispose_engine()
|
dispose_engine()
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(title="FASTAPI_DEMO", version="0.1.0", lifespan=lifespan)
|
||||||
title="FASTAPI_DEMO",
|
app.include_router(api_router)
|
||||||
version="0.1.0",
|
|
||||||
lifespan=lifespan,
|
|
||||||
)
|
|
||||||
|
|
||||||
app.include_router(health_router)
|
|
||||||
app.include_router(assets_router)
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from fastapi import HTTPException
|
|||||||
|
|
||||||
from fastapi_demo.app.domain.status import AssetStatus
|
from fastapi_demo.app.domain.status import AssetStatus
|
||||||
from fastapi_demo.app.domain.transitions import ensure_transition_allowed
|
from fastapi_demo.app.domain.transitions import ensure_transition_allowed
|
||||||
from fastapi_demo.app.repositories.assets_repo import AssetsRepo
|
from fastapi_demo.app.infrastructure.repositories.assets_repo import AssetsRepo
|
||||||
from fastapi_demo.app.schemas.asset import (
|
from fastapi_demo.app.schemas.asset import (
|
||||||
AssetCreate,
|
AssetCreate,
|
||||||
AssetOut,
|
AssetOut,
|
||||||
|
|||||||
14
fastapi_demo/package.json
Normal file
14
fastapi_demo/package.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "fastapi-vue-dev",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.1.0",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "concurrently -n api,web \"python -m uvicorn fastapi_demo.app.main:app --reload --host 127.0.0.1 --port 8000\" \"npm --prefix frontend run dev\"",
|
||||||
|
"gen:api": "npm --prefix frontend run gen:api",
|
||||||
|
"build": "npm --prefix frontend run build",
|
||||||
|
"preview": "npm --prefix frontend run preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"concurrently": "^9.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
2
frontend/.env.development
Normal file
2
frontend/.env.development
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
VITE_API_BASE=/api
|
||||||
|
VITE_OPENAPI_URL=http://127.0.0.1:8000/openapi.json
|
||||||
24
frontend/.gitignore
vendored
Normal file
24
frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
5
frontend/README.md
Normal file
5
frontend/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Vue 3 + TypeScript + Vite
|
||||||
|
|
||||||
|
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||||
|
|
||||||
|
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
||||||
13
frontend/index.html
Normal file
13
frontend/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>frontend</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
2246
frontend/package-lock.json
generated
Normal file
2246
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
frontend/package.json
Normal file
26
frontend/package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"gen:api": "dotenv -e .env.development -- node scripts/gen-openapi.mjs",
|
||||||
|
"build": "npm run gen:api && vue-tsc -b && vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.13.5",
|
||||||
|
"vue": "^3.5.25"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^24.10.1",
|
||||||
|
"@vitejs/plugin-vue": "^6.0.2",
|
||||||
|
"@vue/tsconfig": "^0.8.1",
|
||||||
|
"dotenv-cli": "^11.0.0",
|
||||||
|
"openapi-typescript": "^7.13.0",
|
||||||
|
"typescript": "~5.9.3",
|
||||||
|
"vite": "^7.3.1",
|
||||||
|
"vue-tsc": "^3.1.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
frontend/public/vite.svg
Normal file
1
frontend/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
11
frontend/scripts/gen-openapi.mjs
Normal file
11
frontend/scripts/gen-openapi.mjs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// scripts/gen-openapi.mjs
|
||||||
|
import { execSync } from "node:child_process"
|
||||||
|
|
||||||
|
const url =
|
||||||
|
process.env.VITE_OPENAPI_URL ?? "http://127.0.0.1:8000/openapi.json"
|
||||||
|
|
||||||
|
console.log(`[gen:api] OpenAPI URL: ${url}`)
|
||||||
|
|
||||||
|
execSync(`npx openapi-typescript "${url}" -o src/generated/api.d.ts`, {
|
||||||
|
stdio: "inherit",
|
||||||
|
})
|
||||||
33
frontend/src/App.vue
Normal file
33
frontend/src/App.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from "vue"
|
||||||
|
import { checkBackendHealth } from "./features/health/health.service"
|
||||||
|
|
||||||
|
const health = ref<any>(null)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
health.value = await checkBackendHealth()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main style="padding: 16px">
|
||||||
|
<h1>Frontend</h1>
|
||||||
|
<pre>{{ health }}</pre>
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.logo {
|
||||||
|
height: 6em;
|
||||||
|
padding: 1.5em;
|
||||||
|
will-change: filter;
|
||||||
|
transition: filter 300ms;
|
||||||
|
}
|
||||||
|
.logo:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #646cffaa);
|
||||||
|
}
|
||||||
|
.logo.vue:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #42b883aa);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
37
frontend/src/api/assets.api.ts
Normal file
37
frontend/src/api/assets.api.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// src/api/assets.api.ts
|
||||||
|
import type { paths } from "../generated/api"
|
||||||
|
import { http, apiUrl } from "./http"
|
||||||
|
|
||||||
|
// Request bodies
|
||||||
|
export type AssetCreateIn =
|
||||||
|
paths["/api/assets"]["post"]["requestBody"]["content"]["application/json"]
|
||||||
|
|
||||||
|
export type AssetTransitionIn =
|
||||||
|
paths["/api/assets/{asset_id}/transition"]["post"]["requestBody"]["content"]["application/json"]
|
||||||
|
|
||||||
|
// Responses
|
||||||
|
export type AssetOut =
|
||||||
|
paths["/api/assets/{asset_id}"]["get"]["responses"]["200"]["content"]["application/json"]
|
||||||
|
|
||||||
|
export type AssetEventsOut =
|
||||||
|
paths["/api/assets/{asset_id}/events"]["get"]["responses"]["200"]["content"]["application/json"]
|
||||||
|
|
||||||
|
export async function createAsset(payload: AssetCreateIn): Promise<AssetOut> {
|
||||||
|
const r = await http.post<AssetOut>(apiUrl("/assets"), payload)
|
||||||
|
return r.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getAsset(assetId: string): Promise<AssetOut> {
|
||||||
|
const r = await http.get<AssetOut>(apiUrl(`/assets/${assetId}`))
|
||||||
|
return r.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function transitionAsset(assetId: string, payload: AssetTransitionIn): Promise<AssetOut> {
|
||||||
|
const r = await http.post<AssetOut>(apiUrl(`/assets/${assetId}/transition`), payload)
|
||||||
|
return r.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listAssetEvents(assetId: string): Promise<AssetEventsOut> {
|
||||||
|
const r = await http.get<AssetEventsOut>(apiUrl(`/assets/${assetId}/events`))
|
||||||
|
return r.data
|
||||||
|
}
|
||||||
11
frontend/src/api/health.api.ts
Normal file
11
frontend/src/api/health.api.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// src/api/health.api.ts
|
||||||
|
import type { paths } from "../generated/api"
|
||||||
|
import { http, apiUrl } from "./http"
|
||||||
|
|
||||||
|
type HealthOk =
|
||||||
|
paths["/api/health"]["get"]["responses"]["200"]["content"]["application/json"]
|
||||||
|
|
||||||
|
export async function getHealth(): Promise<HealthOk> {
|
||||||
|
const r = await http.get<HealthOk>(apiUrl("/health"))
|
||||||
|
return r.data
|
||||||
|
}
|
||||||
14
frontend/src/api/http.ts
Normal file
14
frontend/src/api/http.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// src/api/http.ts
|
||||||
|
import axios from "axios"
|
||||||
|
|
||||||
|
export const API_BASE = (import.meta.env.VITE_API_BASE ?? "/api").replace(/\/$/, "")
|
||||||
|
|
||||||
|
export const http = axios.create({
|
||||||
|
baseURL: "", // same-origin (Vite Proxy übernimmt /api)
|
||||||
|
timeout: 10_000,
|
||||||
|
})
|
||||||
|
|
||||||
|
export function apiUrl(path: string): string {
|
||||||
|
const p = path.startsWith("/") ? path : `/${path}`
|
||||||
|
return `${API_BASE}${p}`
|
||||||
|
}
|
||||||
41
frontend/src/components/HelloWorld.vue
Normal file
41
frontend/src/components/HelloWorld.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
defineProps<{ msg: string }>()
|
||||||
|
|
||||||
|
const count = ref(0)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<h1>{{ msg }}</h1>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<button type="button" @click="count++">count is {{ count }}</button>
|
||||||
|
<p>
|
||||||
|
Edit
|
||||||
|
<code>components/HelloWorld.vue</code> to test HMR
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Check out
|
||||||
|
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
||||||
|
>create-vue</a
|
||||||
|
>, the official Vue + Vite starter
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Learn more about IDE Support for Vue in the
|
||||||
|
<a
|
||||||
|
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
||||||
|
target="_blank"
|
||||||
|
>Vue Docs Scaling up Guide</a
|
||||||
|
>.
|
||||||
|
</p>
|
||||||
|
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.read-the-docs {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
0
frontend/src/features/assets/AssetsPage.vue
Normal file
0
frontend/src/features/assets/AssetsPage.vue
Normal file
18
frontend/src/features/assets/assets.service.ts
Normal file
18
frontend/src/features/assets/assets.service.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// src/features/assets/assets.service.ts
|
||||||
|
import { createAsset, getAsset, listAssetEvents, transitionAsset } from "../../api/assets.api"
|
||||||
|
import type { AssetCreateIn, AssetTransitionIn } from "../../api/assets.api"
|
||||||
|
|
||||||
|
export const AssetsService = {
|
||||||
|
create(payload: AssetCreateIn) {
|
||||||
|
return createAsset(payload)
|
||||||
|
},
|
||||||
|
get(assetId: string) {
|
||||||
|
return getAsset(assetId)
|
||||||
|
},
|
||||||
|
transition(assetId: string, payload: AssetTransitionIn) {
|
||||||
|
return transitionAsset(assetId, payload)
|
||||||
|
},
|
||||||
|
events(assetId: string) {
|
||||||
|
return listAssetEvents(assetId)
|
||||||
|
},
|
||||||
|
}
|
||||||
1
frontend/src/features/assets/vue.svg
Normal file
1
frontend/src/features/assets/vue.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 496 B |
6
frontend/src/features/health/health.service.ts
Normal file
6
frontend/src/features/health/health.service.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// src/features/health/health.service.ts
|
||||||
|
import { getHealth } from "../../api/health.api"
|
||||||
|
|
||||||
|
export async function checkBackendHealth() {
|
||||||
|
return getHealth()
|
||||||
|
}
|
||||||
330
frontend/src/generated/api.d.ts
vendored
Normal file
330
frontend/src/generated/api.d.ts
vendored
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
/**
|
||||||
|
* This file was auto-generated by openapi-typescript.
|
||||||
|
* Do not make direct changes to the file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface paths {
|
||||||
|
"/api/health": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** Health */
|
||||||
|
get: operations["health_api_health_get"];
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/assets": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get?: never;
|
||||||
|
put?: never;
|
||||||
|
/** Create Asset */
|
||||||
|
post: operations["create_asset_api_assets_post"];
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/assets/{asset_id}": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** Get Asset */
|
||||||
|
get: operations["get_asset_api_assets__asset_id__get"];
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/assets/{asset_id}/transition": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get?: never;
|
||||||
|
put?: never;
|
||||||
|
/** Transition Asset */
|
||||||
|
post: operations["transition_asset_api_assets__asset_id__transition_post"];
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
"/api/assets/{asset_id}/events": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
/** List Events */
|
||||||
|
get: operations["list_events_api_assets__asset_id__events_get"];
|
||||||
|
put?: never;
|
||||||
|
post?: never;
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export type webhooks = Record<string, never>;
|
||||||
|
export interface components {
|
||||||
|
schemas: {
|
||||||
|
/** AssetCreate */
|
||||||
|
AssetCreate: {
|
||||||
|
/** Name */
|
||||||
|
name: string;
|
||||||
|
/** Serial */
|
||||||
|
serial?: string | null;
|
||||||
|
};
|
||||||
|
/** AssetEventOut */
|
||||||
|
AssetEventOut: {
|
||||||
|
/**
|
||||||
|
* Asset Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
asset_id: string;
|
||||||
|
from_status: components["schemas"]["AssetStatus"];
|
||||||
|
to_status: components["schemas"]["AssetStatus"];
|
||||||
|
/**
|
||||||
|
* At
|
||||||
|
* Format: date-time
|
||||||
|
*/
|
||||||
|
at: string;
|
||||||
|
/** Note */
|
||||||
|
note?: string | null;
|
||||||
|
};
|
||||||
|
/** AssetOut */
|
||||||
|
AssetOut: {
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
* Format: uuid
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/** Name */
|
||||||
|
name: string;
|
||||||
|
/** Serial */
|
||||||
|
serial: string | null;
|
||||||
|
status: components["schemas"]["AssetStatus"];
|
||||||
|
/** Revision */
|
||||||
|
revision: number;
|
||||||
|
/**
|
||||||
|
* Updated At
|
||||||
|
* Format: date-time
|
||||||
|
*/
|
||||||
|
updated_at: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* AssetStatus
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
AssetStatus: "WARENEINGANG" | "SICHTPRUEFUNG" | "WARTESCHLANGE" | "IN_BEARBEITUNG" | "QUALITAETSKONTROLLE" | "WARENAUSGANG";
|
||||||
|
/** AssetTransitionIn */
|
||||||
|
AssetTransitionIn: {
|
||||||
|
to_status: components["schemas"]["AssetStatus"];
|
||||||
|
/** Expected Revision */
|
||||||
|
expected_revision: number;
|
||||||
|
/** Note */
|
||||||
|
note?: string | null;
|
||||||
|
};
|
||||||
|
/** HTTPValidationError */
|
||||||
|
HTTPValidationError: {
|
||||||
|
/** Detail */
|
||||||
|
detail?: components["schemas"]["ValidationError"][];
|
||||||
|
};
|
||||||
|
/** ValidationError */
|
||||||
|
ValidationError: {
|
||||||
|
/** Location */
|
||||||
|
loc: (string | number)[];
|
||||||
|
/** Message */
|
||||||
|
msg: string;
|
||||||
|
/** Error Type */
|
||||||
|
type: string;
|
||||||
|
/** Input */
|
||||||
|
input?: unknown;
|
||||||
|
/** Context */
|
||||||
|
ctx?: Record<string, never>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: never;
|
||||||
|
parameters: never;
|
||||||
|
requestBodies: never;
|
||||||
|
headers: never;
|
||||||
|
pathItems: never;
|
||||||
|
}
|
||||||
|
export type $defs = Record<string, never>;
|
||||||
|
export interface operations {
|
||||||
|
health_api_health_get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": unknown;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
create_asset_api_assets_post: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetCreate"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
201: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetOut"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
get_asset_api_assets__asset_id__get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
asset_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetOut"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
transition_asset_api_assets__asset_id__transition_post: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
asset_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetTransitionIn"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetOut"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
list_events_api_assets__asset_id__events_get: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path: {
|
||||||
|
asset_id: string;
|
||||||
|
};
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody?: never;
|
||||||
|
responses: {
|
||||||
|
/** @description Successful Response */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["AssetEventOut"][];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/** @description Validation Error */
|
||||||
|
422: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["HTTPValidationError"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
5
frontend/src/lib/api.ts
Normal file
5
frontend/src/lib/api.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import axios from "axios"
|
||||||
|
|
||||||
|
export const api = axios.create({
|
||||||
|
baseURL: "/api",
|
||||||
|
})
|
||||||
5
frontend/src/main.ts
Normal file
5
frontend/src/main.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import './style.css'
|
||||||
|
import App from './App.vue'
|
||||||
|
|
||||||
|
createApp(App).mount('#app')
|
||||||
79
frontend/src/style.css
Normal file
79
frontend/src/style.css
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
:root {
|
||||||
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
max-width: 1280px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
frontend/tsconfig.app.json
Normal file
16
frontend/tsconfig.app.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"types": ["vite/client"],
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||||
|
}
|
||||||
7
frontend/tsconfig.json
Normal file
7
frontend/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
26
frontend/tsconfig.node.json
Normal file
26
frontend/tsconfig.node.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2023",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"types": ["node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
15
frontend/vite.config.ts
Normal file
15
frontend/vite.config.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { defineConfig } from "vite"
|
||||||
|
import vue from "@vitejs/plugin-vue"
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
// wir rufen im FE später /api/... auf
|
||||||
|
"/api": {
|
||||||
|
target: "http://127.0.0.1:8000",
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "FastAPI_Demo",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
BIN
structure.txt
Normal file
BIN
structure.txt
Normal file
Binary file not shown.
Reference in New Issue
Block a user