feature/search-prototype (#1)

### Description
This pull request migrates to Nuxt 4.0.0, adds docker, and uses Orval and OpenAPI 3.0 specification to interact with backend

Reviewed-on: #1
Co-authored-by: bivashy <botyrbojey@gmail.com>
Co-committed-by: bivashy <botyrbojey@gmail.com>
This commit is contained in:
2025-07-19 18:05:51 +00:00
committed by bivashy
parent 0bf60ad783
commit 57b071d47f
71 changed files with 2977 additions and 737 deletions

184
app/openapi/extractor.ts Normal file
View File

@ -0,0 +1,184 @@
/**
* Generated by orval v7.10.0 🍺
* Do not edit manually.
* OpenAPI definition
* OpenAPI spec version: v0
*/
export interface KodikMetadata {
title?: string;
translations?: KodikTranslation[];
}
export interface KodikTranslation {
id?: string;
title?: string;
mediaId?: string;
mediaHash?: string;
mediaType?: string;
translationType?: string;
episodeCount?: number;
}
export interface KodikTranslationDTO {
mediaType?: string;
mediaId?: string;
mediaHash?: string;
}
export type KodikVideoLinksLinks = {[key: string]: Link[]};
export interface KodikVideoLinks {
links?: KodikVideoLinksLinks;
}
export interface Link {
type?: string;
src?: string;
}
export type ShikimoriParams = {
id: string;
};
export type KodikParams = {
id: string;
};
export type VideoParams = {
translationDTO: KodikTranslationDTO;
quality: string;
episode: number;
};
export type shikimoriResponse200 = {
data: KodikMetadata
status: 200
}
export type shikimoriResponseComposite = shikimoriResponse200;
export type shikimoriResponse = shikimoriResponseComposite & {
headers: Headers;
}
export const getShikimoriUrl = (params: ShikimoriParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString())
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `http://localhost:8081/metadata/shikimori?${stringifiedParams}` : `http://localhost:8081/metadata/shikimori`
}
export const shikimori = async (params: ShikimoriParams, options?: RequestInit): Promise<shikimoriResponse> => {
const res = await fetch(getShikimoriUrl(params),
{
...options,
method: 'GET'
}
)
const body = [204, 205, 304].includes(res.status) ? null : await res.text()
const data: shikimoriResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as shikimoriResponse
}
export type kodikResponse200 = {
data: KodikMetadata
status: 200
}
export type kodikResponseComposite = kodikResponse200;
export type kodikResponse = kodikResponseComposite & {
headers: Headers;
}
export const getKodikUrl = (params: KodikParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString())
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `http://localhost:8081/metadata/kodik?${stringifiedParams}` : `http://localhost:8081/metadata/kodik`
}
export const kodik = async (params: KodikParams, options?: RequestInit): Promise<kodikResponse> => {
const res = await fetch(getKodikUrl(params),
{
...options,
method: 'GET'
}
)
const body = [204, 205, 304].includes(res.status) ? null : await res.text()
const data: kodikResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as kodikResponse
}
export type videoResponse200 = {
data: KodikVideoLinks
status: 200
}
export type videoResponseComposite = videoResponse200;
export type videoResponse = videoResponseComposite & {
headers: Headers;
}
export const getVideoUrl = (params: VideoParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString())
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `http://localhost:8081/extract/video?${stringifiedParams}` : `http://localhost:8081/extract/video`
}
export const video = async (params: VideoParams, options?: RequestInit): Promise<videoResponse> => {
const res = await fetch(getVideoUrl(params),
{
...options,
method: 'GET'
}
)
const body = [204, 205, 304].includes(res.status) ? null : await res.text()
const data: videoResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as videoResponse
}