Compare commits
6
Commits
bdc864cf94
...
5d6d8f15f3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d6d8f15f3 | ||
|
|
1d1976ed07 | ||
|
|
14b8a0c65f | ||
|
|
df9143e95c | ||
|
|
c234c28d15 | ||
|
|
87801c5b9b |
No files matched your search
@@ -0,0 +1,8 @@
|
||||
// @/app/api/docs/api/routes.ts
|
||||
|
||||
import { NextResponse } from 'next/server';
|
||||
import spec from '@/src/generated/openapi.json';
|
||||
|
||||
export function GET() {
|
||||
return NextResponse.json(spec);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// @/app/api/docs/routes.ts
|
||||
@@ -0,0 +1,8 @@
|
||||
'use client';
|
||||
|
||||
import SwaggerUI from 'swagger-ui-react';
|
||||
import 'swagger-ui-react/swagger-ui.css';
|
||||
|
||||
export default function DocsPage() {
|
||||
return <SwaggerUI url="/api/docs/api" />;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import { getAllApis } from "@/lib/wiki";
|
||||
import Article from '@/components/wiki/Article';
|
||||
import { API } from '@/components/mdx-components';
|
||||
|
||||
export default async function Page() {
|
||||
const allApis = await getAllApis();
|
||||
|
||||
// Gruppiert die APIs nach ihrer Kategorie
|
||||
const groupedApis = Object.groupBy(allApis, (api) => api.category);
|
||||
|
||||
return (
|
||||
<Article title="API-Endpunkte">
|
||||
{Object.entries(groupedApis).map(([category, apis]) => (
|
||||
<div key={category} className="mb-10">
|
||||
{/* Kategorie-Überschrift wird nur EINMAL pro Kategorie gerendert */}
|
||||
<h2 className="text-2xl font-bold text-white mt-10 mb-4 border-b border-zinc-800 pb-2">
|
||||
{category}
|
||||
</h2>
|
||||
|
||||
{/* Routen innerhalb dieser Kategorie durchgehen */}
|
||||
{apis?.map((api, index) => (
|
||||
<div key={index} className="my-4">
|
||||
{api.methods.map((method, mIndex) => (
|
||||
<API route={api.route} method={method.method} key={mIndex}>
|
||||
{method.description}
|
||||
</API>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</Article>
|
||||
);
|
||||
}
|
||||
-228
@@ -1,228 +0,0 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import matter from 'gray-matter';
|
||||
import ts from 'typescript';
|
||||
import { ApiRoute, ApiMethod } from '@/types/api';
|
||||
|
||||
export type WikiArticle = {
|
||||
slug: string;
|
||||
title: string;
|
||||
rawContent: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export type WikiPage = {
|
||||
title: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
const wikiDirectory = path.join(process.cwd(), "data/wiki/pages");
|
||||
|
||||
export async function getWikiPageBySlug(slug: string): Promise<WikiArticle | null> {
|
||||
try {
|
||||
const fullPath = path.join(wikiDirectory, `${slug}.mdx`);
|
||||
const fileContents = fs.readFileSync(fullPath, "utf-8");
|
||||
|
||||
const { data, content } = matter(fileContents);
|
||||
|
||||
return {
|
||||
slug,
|
||||
rawContent: content,
|
||||
title: data.title || 'Unbenannt',
|
||||
updatedAt: data.updatedAt || null,
|
||||
...data,
|
||||
} as WikiArticle;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest rekursiv alle Dateien aus einem Verzeichnis aus.
|
||||
* @param dirPath - Der Startordner
|
||||
* @param extension - Optionale Dateiendung zur Filterung (z. B. ".ts" oder "ts")
|
||||
* @returns Array mit den Dateipfaden
|
||||
*/
|
||||
export function getAllFiles(dirPath: string, extension?: string): string[] {
|
||||
if (!fs.existsSync(dirPath)) return [];
|
||||
|
||||
let results: string[] = [];
|
||||
|
||||
// optionales führendes Dot sicherstellen (z. B. aus "ts" wird ".ts")
|
||||
const targetExt = extension && !extension.startsWith('.')
|
||||
? `.${extension}`
|
||||
: extension;
|
||||
|
||||
// withFileTypes: true spart zusätzliche fs.statSync Aufrufe
|
||||
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dirPath, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
results = results.concat(getAllFiles(fullPath, targetExt));
|
||||
} else if (!targetExt || entry.name.endsWith(targetExt)) {
|
||||
results.push(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest die Kategorie aus der Datei aus (@wikiCategory) oder ermittelt sie aus dem Ordnernamen.
|
||||
*/
|
||||
export function filterCategory(
|
||||
content: string,
|
||||
filePath: string,
|
||||
prefix: string = '@wikiCategory'
|
||||
): string {
|
||||
// 1. In Kommentaren nach @wikiCategory suchen
|
||||
const lines = content.split('\n');
|
||||
for (const line of lines) {
|
||||
const cleaned = line.replace(/^\/\/\s*/, '').replace(/^\/\*\*?\s*/, '').replace(/\*\/$/, '').trim();
|
||||
if (cleaned.startsWith(prefix)) {
|
||||
let category = cleaned.slice(prefix.length).trim().replace(/^:\s*/, '');
|
||||
if (category) return category;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Fallback: Ersten Ordnernamen unter app/api/ als Kategorie nutzen
|
||||
const normalizedPath = filePath.replace(/\\/g, '/');
|
||||
const apiMatch = normalizedPath.match(/app\/api\/([^/]+)/);
|
||||
if (apiMatch && apiMatch[1]) {
|
||||
const folderName = apiMatch[1];
|
||||
// Ersten Buchstaben großschreiben (z. B. "stream" -> "Stream")
|
||||
return folderName.charAt(0).toUpperCase() + folderName.slice(1);
|
||||
}
|
||||
|
||||
return 'Allgemein';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parst TypeScript-Code via AST und extrahiert HTTP-Methoden sowie deren Kommentare.
|
||||
*/
|
||||
export function filterMethods(
|
||||
content: string,
|
||||
prefix: string = '@wikiDescription'
|
||||
): ApiMethod[] {
|
||||
const sourceFile = ts.createSourceFile(
|
||||
'temp.ts',
|
||||
content,
|
||||
ts.ScriptTarget.Latest,
|
||||
/* setParentNodes */ true
|
||||
);
|
||||
|
||||
const methods: ApiMethod[] = [];
|
||||
const validMethods = new Set(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
||||
|
||||
ts.forEachChild(sourceFile, (node) => {
|
||||
if (ts.isFunctionDeclaration(node) && node.name) {
|
||||
const functionName = node.name.text;
|
||||
|
||||
if (validMethods.has(functionName)) {
|
||||
let description = '';
|
||||
|
||||
const commentRanges = ts.getLeadingCommentRanges(content, node.pos);
|
||||
|
||||
if (commentRanges && commentRanges.length > 0) {
|
||||
const lastCommentRange = commentRanges[commentRanges.length - 1];
|
||||
const rawComment = content.substring(
|
||||
lastCommentRange.pos,
|
||||
lastCommentRange.end
|
||||
);
|
||||
|
||||
const cleanedComment = rawComment
|
||||
.replace(/^\/\/\s*/, '')
|
||||
.replace(/^\/\*\*?\s*/, '')
|
||||
.replace(/\*\/$/, '')
|
||||
.split('\n')
|
||||
.map((line) => line.replace(/^\s*\*\s?/, '').trim())
|
||||
.join(' ')
|
||||
.trim();
|
||||
|
||||
if (cleanedComment.startsWith(prefix)) {
|
||||
let textAfterPrefix = cleanedComment.slice(prefix.length).trim();
|
||||
textAfterPrefix = textAfterPrefix.replace(/^:\s*/, '');
|
||||
description = textAfterPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
methods.push({
|
||||
method: functionName,
|
||||
description: description || 'Keine Beschreibung vorhanden.',
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest alle API-Dateien dynamisch aus und wandelt sie in ApiRoute-Objekte um.
|
||||
*/
|
||||
export async function getAllApis(): Promise<ApiRoute[]> {
|
||||
try {
|
||||
const apiBasePath = path.join(process.cwd(), "app/api");
|
||||
const allTsFiles = getAllFiles(apiBasePath, ".ts");
|
||||
const routes: ApiRoute[] = [];
|
||||
|
||||
allTsFiles.forEach((filePath) => {
|
||||
const fileContents = fs.readFileSync(filePath, "utf-8");
|
||||
|
||||
// 1. Methoden extrahieren
|
||||
const methods = filterMethods(fileContents, "@wikiDescription");
|
||||
|
||||
// Nur Routen hinzufügen, die auch API-Methoden exportieren
|
||||
if (methods.length > 0) {
|
||||
// 2. Kategorie ermitteln
|
||||
const category = filterCategory(fileContents, filePath, "@wikiCategory");
|
||||
|
||||
// 3. Route-Pfad automatisch aus dem Dateipfad generieren (app/api/stream/currentID/route.ts -> stream/currentID)
|
||||
const relativePath = path.relative(apiBasePath, filePath).replace(/\\/g, '/');
|
||||
const routePath = relativePath
|
||||
.replace(/\/route\.ts$/, '')
|
||||
.replace(/\.ts$/, '');
|
||||
|
||||
routes.push({
|
||||
route: routePath,
|
||||
category,
|
||||
methods,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return routes;
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Auslesen der API-Dateien:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAllWikiPages(): Promise<WikiPage[]> {
|
||||
try {
|
||||
const pagesBasePath = path.join(process.cwd(), "data/wiki/pages");
|
||||
const allPaths = getAllFiles(pagesBasePath, ".mdx");
|
||||
const allPages: WikiPage[] = [];
|
||||
|
||||
for (const filePath of allPaths) {
|
||||
// extract filename of the path (e. g. "test" at "data/wiki/pages/test.mdx")
|
||||
const slug = path.parse(filePath).name;
|
||||
|
||||
const wikiPage = await getWikiPageBySlug(slug);
|
||||
|
||||
if (wikiPage) {
|
||||
allPages.push({
|
||||
path: slug,
|
||||
title: wikiPage.title,
|
||||
});
|
||||
}
|
||||
}
|
||||
console.log(allPages);
|
||||
return allPages;
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Auslesen der Wiki-Seiten:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Generated
+8150
-1008
File diff suppressed because it is too large.
Load diff
+9
-4
@@ -6,11 +6,12 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
"lint": "eslint",
|
||||
"openapi:generate": "node scripts/generate-openapi.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/adapter-better-sqlite3": "^7.9.1",
|
||||
"@prisma/client": "^7.9.1",
|
||||
"@prisma/client": "^7.10.0",
|
||||
"@types/papaparse": "^5.5.2",
|
||||
"argon2": "^0.45.1",
|
||||
"better-sqlite3": "^13.0.2",
|
||||
@@ -19,7 +20,6 @@
|
||||
"next": "16.2.9",
|
||||
"next-mdx-remote": "^6.0.0",
|
||||
"papaparse": "^5.5.4",
|
||||
"prisma": "^7.9.1",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4",
|
||||
"rehype-autolink-headings": "^7.1.0",
|
||||
@@ -31,7 +31,8 @@
|
||||
"remark-html": "^16.0.1",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"shiki": "^4.4.1"
|
||||
"shiki": "^4.4.1",
|
||||
"swagger-ui-react": "^5.33.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
@@ -40,8 +41,12 @@
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/swagger-jsdoc": "^6.0.4",
|
||||
"@types/swagger-ui-react": "^5.18.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.2.9",
|
||||
"prisma": "^8.0.0-rc.22",
|
||||
"swagger-jsdoc": "^6.3.0",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import swaggerJsdoc from 'swagger-jsdoc';
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { dirname } from 'node:path';
|
||||
|
||||
const spec = swaggerJsdoc({
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: { title: 'PsalmTafel API', version: '1.0.0' },
|
||||
},
|
||||
apis: ['./app/api/**/*.ts'],
|
||||
failOnErrors: true,
|
||||
});
|
||||
|
||||
const out = 'src/generated/openapi.json';
|
||||
mkdirSync(dirname(out), { recursive: true });
|
||||
writeFileSync(out, JSON.stringify(spec, null, 2));
|
||||
|
||||
console.log(`OpenAPI: ${Object.keys(spec.paths ?? {}).length} Pfade -> ${out}`);
|
||||
@@ -0,0 +1,577 @@
|
||||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"title": "PsalmTafel API",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"paths": {
|
||||
"/api/songs": {
|
||||
"get": {
|
||||
"summary": "Get all songs",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of songs"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"summary": "Creates a new song",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "Großer Gott"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Songbook successfully created",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"songBook": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"example": "Großer Gott"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request (missing name)"
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict (title already exists)"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/songs/{id}": {
|
||||
"get": {
|
||||
"summary": "Einzelnen Song abrufen",
|
||||
"tags": [
|
||||
"Songs"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Song erfolgreich gefunden"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Song-ID"
|
||||
},
|
||||
"404": {
|
||||
"description": "Song nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"summary": "Song aktualisieren",
|
||||
"tags": [
|
||||
"Songs"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Song erfolgreich aktualisiert"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Parameter oder Daten"
|
||||
},
|
||||
"404": {
|
||||
"description": "Song nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"summary": "Song löschen",
|
||||
"tags": [
|
||||
"Songs"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Song erfolgreich gelöscht"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Song-ID"
|
||||
},
|
||||
"404": {
|
||||
"description": "Song nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/songbooks": {
|
||||
"get": {
|
||||
"summary": "Get all songbooks",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of songbooks"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"summary": "Creates a new songbook",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"example": "Feiert Jesus 1"
|
||||
},
|
||||
"language": {
|
||||
"type": "string",
|
||||
"example": "DE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Songbook successfully created",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"songBook": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"example": "Feiert Jesus 1"
|
||||
},
|
||||
"language": {
|
||||
"type": "string",
|
||||
"example": "DE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request (missing title)"
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict (title already exists)"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/songbooks/{id}": {
|
||||
"get": {
|
||||
"summary": "Einzelnen Songbook abrufen",
|
||||
"tags": [
|
||||
"Songbooks"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songbooks"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Songbook erfolgreich gefunden"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Songbook-ID"
|
||||
},
|
||||
"404": {
|
||||
"description": "Songbook nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"summary": "Songbook aktualisieren",
|
||||
"tags": [
|
||||
"Songbooks"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songbooks"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Songbook erfolgreich aktualisiert"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Parameter oder Daten"
|
||||
},
|
||||
"404": {
|
||||
"description": "Songbook nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"summary": "Songbook löschen",
|
||||
"tags": [
|
||||
"Songbooks"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songbooks"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Songbook erfolgreich gelöscht"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Songbook-ID"
|
||||
},
|
||||
"404": {
|
||||
"description": "Songbook nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/songbooks/{id}/songs": {
|
||||
"get": {
|
||||
"summary": "Einen Song nach Nummer in einem Songbook suchen",
|
||||
"tags": [
|
||||
"Songbook"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songbooks"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Songbook erfolgreich gefunden"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Songbook-ID"
|
||||
},
|
||||
"404": {
|
||||
"description": "Songbook nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/songbooks/{songBookId}/songs/{songId}": {
|
||||
"post": {
|
||||
"summary": "Song zu Liederbuch hinzufügen",
|
||||
"tags": [
|
||||
"Songbook"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songBookId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Liederbuchs"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"number"
|
||||
],
|
||||
"properties": {
|
||||
"number": {
|
||||
"type": "string",
|
||||
"example": "104a",
|
||||
"description": "Die Songnummer im Liederbuch"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Song erfolgreich zugewiesen"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Parameter oder fehlende Songnummer"
|
||||
},
|
||||
"409": {
|
||||
"description": "Songnummer bereits vergeben oder Song existiert bereits im Buch"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"summary": "Songnummer eines Songs im Liederbuch aktualisieren",
|
||||
"tags": [
|
||||
"Songbook"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songBookId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Liederbuchs"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"number"
|
||||
],
|
||||
"properties": {
|
||||
"number": {
|
||||
"type": "string",
|
||||
"example": "105",
|
||||
"description": "Die neue Songnummer im Liederbuch"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Songnummer erfolgreich aktualisiert"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Parameter oder fehlende Daten"
|
||||
},
|
||||
"404": {
|
||||
"description": "Zuweisung nicht gefunden"
|
||||
},
|
||||
"409": {
|
||||
"description": "Neue Songnummer bereits vergeben"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"summary": "Song aus Liederbuch entfernen",
|
||||
"tags": [
|
||||
"Songbook"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songBookId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Liederbuchs"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "songId",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "Die ID des Songs"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Song erfolgreich aus dem Liederbuch entfernt"
|
||||
},
|
||||
"400": {
|
||||
"description": "Ungültige Parameter"
|
||||
},
|
||||
"404": {
|
||||
"description": "Zuweisung nicht gefunden"
|
||||
},
|
||||
"500": {
|
||||
"description": "Serverfehler"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {},
|
||||
"tags": []
|
||||
}
|
||||
Reference in new issue
Block a user