Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7ade96371 | ||
|
|
5a56245218 |
No files matched your search
+2
-2
@@ -11,13 +11,13 @@ COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* ./
|
|||||||
RUN apk add --no-cache python3 make g++
|
RUN apk add --no-cache python3 make g++
|
||||||
|
|
||||||
# Installation mit deiner funktionierenden Workspace-Konfiguration
|
# Installation mit deiner funktionierenden Workspace-Konfiguration
|
||||||
RUN pnpm i --frozen-lockfile
|
RUN npm i --frozen-lockfile
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm run build
|
RUN npm run openapi:generate; npm run build
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
// @/app/api/docs/api/routes.ts
|
// @/app/api/docs/api/routes.ts
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /api/docs/api:
|
||||||
|
* get:
|
||||||
|
* summary: OpenAPI-Spezifikation abrufen
|
||||||
|
* tags:
|
||||||
|
* - Docs
|
||||||
|
* description: Gibt die vollständige OpenAPI-JSON-Spezifikation der API zurück.
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Erfolgreich generierte OpenAPI-Spezifikation.
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
*/
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import spec from '@/src/generated/openapi.json';
|
import spec from '@/src/generated/openapi.json';
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
// @/app/api/docs/routes.ts
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// @/app/api/songbooks/[songBookId]/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSongBookById, updateSongBook, deleteSongBook } from "@/lib/db/songbook";
|
import { getSongBookById, updateSongBook, deleteSongBook } from "@/lib/db/songbook";
|
||||||
|
|
||||||
@@ -9,38 +11,51 @@ interface RouteParams {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songbooks/{id}:
|
* /api/songbooks/{songBookId}:
|
||||||
* get:
|
* get:
|
||||||
* summary: Einzelnen Songbook abrufen
|
* summary: Einzelnes Songbook abrufen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbooks
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songBookId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songbooks
|
* description: Die ID des Songbooks
|
||||||
|
* example: 1
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Songbook erfolgreich gefunden
|
* description: Songbook erfolgreich gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBook'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Songbook-ID
|
* description: Ungültige Songbook-ID
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Songbook nicht gefunden
|
* description: Songbook nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export async function GET(_request: Request, { params }: RouteParams) {
|
export async function GET(_request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
const { songBookId } = await params;
|
const { songBookId } = await params;
|
||||||
|
|
||||||
|
|
||||||
const res = await getSongBookById(parseInt(songBookId));
|
const res = await getSongBookById(parseInt(songBookId));
|
||||||
|
|
||||||
|
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return NextResponse.json({ message: res.error }, { status: res.status });
|
return NextResponse.json({ message: res.error }, { status: res.status });
|
||||||
}
|
}
|
||||||
@@ -58,33 +73,57 @@ export async function GET(_request: Request, { params }: RouteParams) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songbooks/{id}:
|
* /api/songbooks/{songBookId}:
|
||||||
* patch:
|
* patch:
|
||||||
* summary: Songbook aktualisieren
|
* summary: Songbook aktualisieren
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbooks
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songBookId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songbooks
|
* description: Die ID des Songbooks
|
||||||
|
* example: 1
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* title:
|
||||||
|
* type: string
|
||||||
|
* example: "Feiert Jesus 1"
|
||||||
|
* language:
|
||||||
|
* type: string
|
||||||
|
* example: "DE"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Songbook erfolgreich aktualisiert
|
* description: Songbook erfolgreich aktualisiert
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBook'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Parameter oder Daten
|
* description: Ungültige Parameter oder Daten
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Songbook nicht gefunden
|
* description: Songbook nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function PATCH(request: Request, { params }: RouteParams) {
|
export async function PATCH(request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -100,7 +139,7 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songbookinfos" },
|
{ error: "Fehler beim Aktualisieren des Songbooks" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -109,27 +148,44 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songbooks/{id}:
|
* /api/songbooks/{songBookId}:
|
||||||
* delete:
|
* delete:
|
||||||
* summary: Songbook löschen
|
* summary: Songbook löschen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbooks
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songBookId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songbooks
|
* description: Die ID des Songbooks
|
||||||
|
* example: 1
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Songbook erfolgreich gelöscht
|
* description: Songbook erfolgreich gelöscht (gibt das gelöschte Songbook zurück)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBook'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Songbook-ID
|
* description: Ungültige Songbook-ID
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Songbook nicht gefunden
|
* description: Songbook nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function DELETE(_request: Request, { params }: RouteParams) {
|
export async function DELETE(_request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -144,7 +200,7 @@ export async function DELETE(_request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songbookinfos" },
|
{ error: "Fehler beim Löschen des Songbooks" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// @/app/api/songbooks/[songBookId]/songs/[songId]/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { addSongToBook, updateSongInBook, removeSongFromBook } from "@/lib/db/songbooksongs";
|
import { addSongToBook, updateSongInBook, removeSongFromBook } from "@/lib/db/songbooksongs";
|
||||||
|
|
||||||
@@ -14,7 +16,7 @@ interface RouteParams {
|
|||||||
* post:
|
* post:
|
||||||
* summary: Song zu Liederbuch hinzufügen
|
* summary: Song zu Liederbuch hinzufügen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbook
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songBookId
|
* name: songBookId
|
||||||
@@ -22,12 +24,14 @@ interface RouteParams {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Liederbuchs
|
* description: Die ID des Liederbuchs
|
||||||
|
* example: 1
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songId
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
@@ -44,12 +48,28 @@ interface RouteParams {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Song erfolgreich zugewiesen
|
* description: Song erfolgreich zugewiesen
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBookEntry'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Parameter oder fehlende Songnummer
|
* description: Ungültige Parameter oder fehlende Songnummer
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 409:
|
* 409:
|
||||||
* description: Songnummer bereits vergeben oder Song existiert bereits im Buch
|
* description: Songnummer bereits vergeben oder Song existiert bereits im Buch
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function POST(request: Request, { params }: RouteParams) {
|
export async function POST(request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -68,7 +88,7 @@ export async function POST(request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songbookinfos" },
|
{ error: "Fehler beim Zuweisen des Songs" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -81,7 +101,7 @@ export async function POST(request: Request, { params }: RouteParams) {
|
|||||||
* patch:
|
* patch:
|
||||||
* summary: Songnummer eines Songs im Liederbuch aktualisieren
|
* summary: Songnummer eines Songs im Liederbuch aktualisieren
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbook
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songBookId
|
* name: songBookId
|
||||||
@@ -89,12 +109,14 @@ export async function POST(request: Request, { params }: RouteParams) {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Liederbuchs
|
* description: Die ID des Liederbuchs
|
||||||
|
* example: 1
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songId
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
@@ -111,14 +133,34 @@ export async function POST(request: Request, { params }: RouteParams) {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Songnummer erfolgreich aktualisiert
|
* description: Songnummer erfolgreich aktualisiert
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBookEntry'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Parameter oder fehlende Daten
|
* description: Ungültige Parameter oder fehlende Daten
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Zuweisung nicht gefunden
|
* description: Zuweisung nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 409:
|
* 409:
|
||||||
* description: Neue Songnummer bereits vergeben
|
* description: Neue Songnummer bereits vergeben
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function PATCH(request: Request, { params }: RouteParams) {
|
export async function PATCH(request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -134,7 +176,7 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songbookinfos" },
|
{ error: "Fehler beim Aktualisieren der Songnummer" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -147,7 +189,7 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
* delete:
|
* delete:
|
||||||
* summary: Song aus Liederbuch entfernen
|
* summary: Song aus Liederbuch entfernen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbook
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songBookId
|
* name: songBookId
|
||||||
@@ -155,21 +197,39 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Liederbuchs
|
* description: Die ID des Liederbuchs
|
||||||
|
* example: 1
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: songId
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Song erfolgreich aus dem Liederbuch entfernt
|
* description: Song erfolgreich aus dem Liederbuch entfernt (gibt die entfernte Zuweisung zurück)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBookEntry'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Parameter
|
* description: Ungültige Parameter
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Zuweisung nicht gefunden
|
* description: Zuweisung nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function DELETE(_request: Request, { params }: RouteParams) {
|
export async function DELETE(_request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -185,7 +245,7 @@ export async function DELETE(_request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songbookinfos" },
|
{ error: "Fehler beim Entfernen des Songs" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// @/app/api/songbooks/[songBookId]/songs/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSongByNumber } from "@/lib/db/songbooksongs";
|
import { getSongByNumber } from "@/lib/db/songbooksongs";
|
||||||
|
|
||||||
@@ -9,27 +11,58 @@ interface RouteParams {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songbooks/{id}/songs:
|
* /api/songbooks/{songBookId}/songs:
|
||||||
* get:
|
* get:
|
||||||
* summary: Einen Song nach Nummer in einem Songbook suchen
|
* summary: Einen Song nach Nummer in einem Songbook suchen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songbook
|
* - Songbooks
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songBookId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songbooks
|
* description: Die ID des Songbooks
|
||||||
|
* example: 1
|
||||||
|
* - in: query
|
||||||
|
* name: number
|
||||||
|
* required: true
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Die Nummer des Songs im Songbook
|
||||||
|
* example: "123"
|
||||||
|
* - in: query
|
||||||
|
* name: n
|
||||||
|
* required: false
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Alias für `number`
|
||||||
|
* example: "123"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Songbook erfolgreich gefunden
|
* description: Song im Songbook erfolgreich gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/SongBookEntry'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Songbook-ID
|
* description: Ungültige Songbook-ID oder fehlender number-Parameter
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Songbook nicht gefunden
|
* description: Songbook oder Song nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function GET(request: Request, { params }: RouteParams) {
|
export async function GET(request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+47
-21
@@ -1,22 +1,45 @@
|
|||||||
// @wikiCategory: Liederbücher
|
// @/app/api/songbooks/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSongBooks, searchSongBooksByTitle, createSongBook } from "@/lib/db/songbook";
|
import { getSongBooks, searchSongBooksByTitle, createSongBook } from "@/lib/db/songbook";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songbooks:
|
* /api/songbooks:
|
||||||
* get:
|
* get:
|
||||||
* summary: Get all songbooks
|
* summary: Get all songbooks or search songbooks by title
|
||||||
|
* tags:
|
||||||
|
* - Songbooks
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: query
|
||||||
|
* required: false
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Search term for the songbook title
|
||||||
|
* example: "Feiert Jesus"
|
||||||
|
* - in: query
|
||||||
|
* name: q
|
||||||
|
* required: false
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Alias for `query`
|
||||||
|
* example: "Feiert Jesus"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: List of songbooks
|
* description: List of songbooks (filtered by title if a query is given)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/SongBook'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Internal Server Error
|
* description: Internal Server Error
|
||||||
*
|
* content:
|
||||||
* @wikiDescription: Liste aller Liederbücher abrufen
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
@@ -60,6 +83,8 @@ export async function GET(request: Request) {
|
|||||||
* /api/songbooks:
|
* /api/songbooks:
|
||||||
* post:
|
* post:
|
||||||
* summary: Creates a new songbook
|
* summary: Creates a new songbook
|
||||||
|
* tags:
|
||||||
|
* - Songbooks
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
@@ -68,6 +93,7 @@ export async function GET(request: Request) {
|
|||||||
* type: object
|
* type: object
|
||||||
* required:
|
* required:
|
||||||
* - title
|
* - title
|
||||||
|
* - language
|
||||||
* properties:
|
* properties:
|
||||||
* title:
|
* title:
|
||||||
* type: string
|
* type: string
|
||||||
@@ -87,25 +113,25 @@ export async function GET(request: Request) {
|
|||||||
* type: boolean
|
* type: boolean
|
||||||
* example: true
|
* example: true
|
||||||
* songBook:
|
* songBook:
|
||||||
* type: object
|
* $ref: '#/components/schemas/SongBook'
|
||||||
* properties:
|
|
||||||
* id:
|
|
||||||
* type: integer
|
|
||||||
* example: 1
|
|
||||||
* title:
|
|
||||||
* type: string
|
|
||||||
* example: "Feiert Jesus 1"
|
|
||||||
* language:
|
|
||||||
* type: string
|
|
||||||
* example: "DE"
|
|
||||||
* 400:
|
* 400:
|
||||||
* description: Bad Request (missing title)
|
* description: Bad Request (missing title or language)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 409:
|
* 409:
|
||||||
* description: Conflict (title already exists)
|
* description: Conflict (title already exists)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Internal Server Error
|
* description: Internal Server Error
|
||||||
*
|
* content:
|
||||||
* @wikiDescription: Neues Liederbuch erstellen
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// @/app/api/songs/[songId]/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSongById, updateSong, deleteSong } from "@/lib/db/song";
|
import { getSongById, updateSong, deleteSong } from "@/lib/db/song";
|
||||||
|
|
||||||
@@ -9,27 +11,44 @@ interface RouteParams {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songs/{id}:
|
* /api/songs/{songId}:
|
||||||
* get:
|
* get:
|
||||||
* summary: Einzelnen Song abrufen
|
* summary: Einzelnen Song abrufen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songs
|
* - Songs
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Song erfolgreich gefunden
|
* description: Song erfolgreich gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Song'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Song-ID
|
* description: Ungültige Song-ID
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Song nicht gefunden
|
* description: Song nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function GET(_request: Request, { params }: RouteParams) {
|
export async function GET(_request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -53,33 +72,54 @@ export async function GET(_request: Request, { params }: RouteParams) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songs/{id}:
|
* /api/songs/{songId}:
|
||||||
* patch:
|
* patch:
|
||||||
* summary: Song aktualisieren
|
* summary: Song aktualisieren
|
||||||
* tags:
|
* tags:
|
||||||
* - Songs
|
* - Songs
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* title:
|
||||||
|
* type: string
|
||||||
|
* example: "Großer Gott"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Song erfolgreich aktualisiert
|
* description: Song erfolgreich aktualisiert
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Song'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Parameter oder Daten
|
* description: Ungültige Parameter oder Daten
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Song nicht gefunden
|
* description: Song nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function PATCH(request: Request, { params }: RouteParams) {
|
export async function PATCH(request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -95,7 +135,7 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songinfos" },
|
{ error: "Fehler beim Aktualisieren des Songs" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -104,27 +144,44 @@ export async function PATCH(request: Request, { params }: RouteParams) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songs/{id}:
|
* /api/songs/{songId}:
|
||||||
* delete:
|
* delete:
|
||||||
* summary: Song löschen
|
* summary: Song löschen
|
||||||
* tags:
|
* tags:
|
||||||
* - Songs
|
* - Songs
|
||||||
* parameters:
|
* parameters:
|
||||||
* - in: path
|
* - in: path
|
||||||
* name: id
|
* name: songId
|
||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: Die ID des Songs
|
* description: Die ID des Songs
|
||||||
|
* example: 1
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Song erfolgreich gelöscht
|
* description: Song erfolgreich gelöscht (gibt den gelöschten Song zurück)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Song'
|
||||||
* 400:
|
* 400:
|
||||||
* description: Ungültige Song-ID
|
* description: Ungültige Song-ID
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 404:
|
* 404:
|
||||||
* description: Song nicht gefunden
|
* description: Song nicht gefunden
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Serverfehler
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function DELETE(_request: Request, { params }: RouteParams) {
|
export async function DELETE(_request: Request, { params }: RouteParams) {
|
||||||
try {
|
try {
|
||||||
@@ -139,7 +196,7 @@ export async function DELETE(_request: Request, { params }: RouteParams) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("API Error:", error);
|
console.error("API Error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: "Fehler beim Laden der Songinfos" },
|
{ error: "Fehler beim Löschen des Songs" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+53
-23
@@ -1,27 +1,51 @@
|
|||||||
// @wikiCategory: Lieder
|
// @/app/api/songs/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSongs, searchSongsByTitle, createSong, } from "@/lib/db/song";
|
import { getSongs, searchSongsByTitle, createSong } from "@/lib/db/song";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songs:
|
* /api/songs:
|
||||||
* get:
|
* get:
|
||||||
* summary: Get all songs
|
* summary: Get all songs or search songs by title
|
||||||
|
* tags:
|
||||||
|
* - Songs
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: query
|
||||||
|
* required: false
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Search term for the song title
|
||||||
|
* example: "Großer Gott"
|
||||||
|
* - in: query
|
||||||
|
* name: q
|
||||||
|
* required: false
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Alias for `query`
|
||||||
|
* example: "Großer Gott"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: List of songs
|
* description: List of songs (filtered by title if a query is given)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Song'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Internal Server Error
|
* description: Internal Server Error
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const query = searchParams.get("query") || searchParams.get("q");
|
const query = searchParams.get("query") || searchParams.get("q");
|
||||||
|
|
||||||
|
|
||||||
if (query) {
|
if (query) {
|
||||||
const res = await searchSongsByTitle(query/*, 20*/); // You can enter a limit (default: 20)
|
const res = await searchSongsByTitle(query/*, 20*/); // You can enter a limit (default: 20)
|
||||||
|
|
||||||
@@ -42,7 +66,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json(res.songs, { status: res.status });
|
return NextResponse.json(res.songs, { status: res.status });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("POST /api/songs error:", error);
|
console.error("GET /api/songs error:", error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ message: "Internal Server Error" },
|
{ message: "Internal Server Error" },
|
||||||
{ status: 500 }
|
{ status: 500 }
|
||||||
@@ -50,12 +74,13 @@ export async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/songs:
|
* /api/songs:
|
||||||
* post:
|
* post:
|
||||||
* summary: Creates a new song
|
* summary: Creates a new song
|
||||||
|
* tags:
|
||||||
|
* - Songs
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
@@ -63,14 +88,14 @@ export async function GET(request: Request) {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
* required:
|
* required:
|
||||||
* - name
|
* - title
|
||||||
* properties:
|
* properties:
|
||||||
* name:
|
* title:
|
||||||
* type: string
|
* type: string
|
||||||
* example: "Großer Gott"
|
* example: "Großer Gott"
|
||||||
* responses:
|
* responses:
|
||||||
* 201:
|
* 201:
|
||||||
* description: Songbook successfully created
|
* description: Song successfully created
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
@@ -79,21 +104,26 @@ export async function GET(request: Request) {
|
|||||||
* success:
|
* success:
|
||||||
* type: boolean
|
* type: boolean
|
||||||
* example: true
|
* example: true
|
||||||
* songBook:
|
* song:
|
||||||
* type: object
|
* $ref: '#/components/schemas/Song'
|
||||||
* properties:
|
|
||||||
* id:
|
|
||||||
* type: integer
|
|
||||||
* example: 1
|
|
||||||
* title:
|
|
||||||
* type: string
|
|
||||||
* example: "Großer Gott"
|
|
||||||
* 400:
|
* 400:
|
||||||
* description: Bad Request (missing name)
|
* description: Bad Request (missing title)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 409:
|
* 409:
|
||||||
* description: Conflict (title already exists)
|
* description: Conflict (title already exists)
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
* 500:
|
* 500:
|
||||||
* description: Internal Server Error
|
* description: Internal Server Error
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Error'
|
||||||
*/
|
*/
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
@@ -101,7 +131,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
if (!data.title) {
|
if (!data.title) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ message: "Field 'title' is required"},
|
{ message: "Field 'title' is required" },
|
||||||
{ status: 400 }
|
{ status: 400 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+97
-3
@@ -1,7 +1,22 @@
|
|||||||
// @wikiCategory: Stream
|
// @/app/api/stream/route.ts
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* components:
|
||||||
|
* schemas:
|
||||||
|
* StreamError:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* success:
|
||||||
|
* type: boolean
|
||||||
|
* example: false
|
||||||
|
* error:
|
||||||
|
* type: string
|
||||||
|
* example: "Fields incomplete!"
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
let currentSong = {
|
let currentSong = {
|
||||||
number: "",
|
number: "",
|
||||||
@@ -11,7 +26,23 @@ let currentSong = {
|
|||||||
const clients = new Set<ReadableStreamDefaultController>();
|
const clients = new Set<ReadableStreamDefaultController>();
|
||||||
|
|
||||||
|
|
||||||
// @wikiDescription: Akutell gestreamtes Lied abrufen
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /api/stream:
|
||||||
|
* get:
|
||||||
|
* summary: Aktuell gestreamtes Lied abrufen (Server-Sent Events)
|
||||||
|
* description: Öffnet einen SSE-Stream. Beim Verbinden wird das aktuelle Lied gesendet (falls gesetzt), danach bei jeder Änderung ein neues Event.
|
||||||
|
* tags:
|
||||||
|
* - Stream
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Event-Stream mit dem aktuellen Lied
|
||||||
|
* content:
|
||||||
|
* text/event-stream:
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* example: 'data: {"number":"104a","song":"Großer Gott","songbook":"Feiert Jesus 1"}'
|
||||||
|
*/
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
let controllerRef: ReadableStreamDefaultController;
|
let controllerRef: ReadableStreamDefaultController;
|
||||||
|
|
||||||
@@ -38,7 +69,70 @@ export async function GET() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// @wikiDescription: Lied zum Streamen festlegen
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /api/stream:
|
||||||
|
* post:
|
||||||
|
* summary: Lied zum Streamen festlegen
|
||||||
|
* description: Setzt das aktuelle Lied und sendet es an alle verbundenen Stream-Clients.
|
||||||
|
* tags:
|
||||||
|
* - Stream
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* required:
|
||||||
|
* - song
|
||||||
|
* - songBook
|
||||||
|
* - number
|
||||||
|
* properties:
|
||||||
|
* song:
|
||||||
|
* type: string
|
||||||
|
* example: "Großer Gott"
|
||||||
|
* songBook:
|
||||||
|
* type: string
|
||||||
|
* example: "Feiert Jesus 1"
|
||||||
|
* number:
|
||||||
|
* type: string
|
||||||
|
* example: "104a"
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Lied gesetzt und an alle Clients gesendet
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* success:
|
||||||
|
* type: boolean
|
||||||
|
* example: true
|
||||||
|
* currentSong:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* number:
|
||||||
|
* type: string
|
||||||
|
* example: "104a"
|
||||||
|
* song:
|
||||||
|
* type: string
|
||||||
|
* example: "Großer Gott"
|
||||||
|
* songbook:
|
||||||
|
* type: string
|
||||||
|
* example: "Feiert Jesus 1"
|
||||||
|
* 400:
|
||||||
|
* description: Felder unvollständig
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/StreamError'
|
||||||
|
* 500:
|
||||||
|
* description: Serverfehler
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/StreamError'
|
||||||
|
*/
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
const data = await request.json();
|
const data = await request.json();
|
||||||
|
|||||||
Generated
+2000
-1752
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
"better-sqlite3": "^13.0.2",
|
"better-sqlite3": "^13.0.2",
|
||||||
"dotenv": "^17.4.2",
|
"dotenv": "^17.4.2",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"next": "16.2.9",
|
"next": "^16.4.0",
|
||||||
"next-mdx-remote": "^6.0.0",
|
"next-mdx-remote": "^6.0.0",
|
||||||
"papaparse": "^5.5.4",
|
"papaparse": "^5.5.4",
|
||||||
"react": "19.2.4",
|
"react": "19.2.4",
|
||||||
|
|||||||
+740
-145
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user