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:
1
app/openapi/extractor.json
Normal file
1
app/openapi/extractor.json
Normal file
@ -0,0 +1 @@
|
||||
{"openapi":"3.1.0","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8081","description":"Generated server url"}],"paths":{"/metadata/shikimori":{"get":{"tags":["metadata-controller"],"operationId":"shikimori","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikMetadata"}}}}}}},"/metadata/kodik":{"get":{"tags":["metadata-controller"],"operationId":"kodik","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikMetadata"}}}}}}},"/extract/video":{"get":{"tags":["extract-controller"],"operationId":"video","parameters":[{"name":"translationDTO","in":"query","required":true,"schema":{"$ref":"#/components/schemas/KodikTranslationDTO"}},{"name":"quality","in":"query","required":true,"schema":{"type":"string"}},{"name":"episode","in":"query","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/KodikVideoLinks"}}}}}}}},"components":{"schemas":{"KodikMetadata":{"type":"object","properties":{"title":{"type":"string"},"translations":{"type":"array","items":{"$ref":"#/components/schemas/KodikTranslation"}}}},"KodikTranslation":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"mediaId":{"type":"string"},"mediaHash":{"type":"string"},"mediaType":{"type":"string"},"translationType":{"type":"string"},"episodeCount":{"type":"integer","format":"int32"}}},"KodikTranslationDTO":{"type":"object","properties":{"mediaType":{"type":"string"},"mediaId":{"type":"string"},"mediaHash":{"type":"string"}}},"KodikVideoLinks":{"type":"object","properties":{"links":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/Link"}}}}},"Link":{"type":"object","properties":{"type":{"type":"string"},"src":{"type":"string"}}}}}}
|
184
app/openapi/extractor.ts
Normal file
184
app/openapi/extractor.ts
Normal 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
|
||||
}
|
365
app/openapi/search.json
Normal file
365
app/openapi/search.json
Normal file
@ -0,0 +1,365 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "OpenAPI definition",
|
||||
"version": "v0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://localhost:8080",
|
||||
"description": "Generated server url"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/search": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"search-controller"
|
||||
],
|
||||
"operationId": "search",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "title",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"*/*": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/KodikResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"KodikResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"results": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Result"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"MaterialData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"year": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"screenshots": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"countries": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"genres": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"actors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"directors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"producers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"writers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"composers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"editors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"designers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"operators": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"anime_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"title_en": {
|
||||
"type": "string"
|
||||
},
|
||||
"other_titles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"other_titles_en": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"other_titles_jp": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"anime_license_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"anime_licensed_by": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"anime_kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"all_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"anime_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"anime_description": {
|
||||
"type": "string"
|
||||
},
|
||||
"poster_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"anime_poster_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"all_genres": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"anime_genres": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"anime_studios": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"kinopoisk_rating": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"kinopoisk_votes": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"imdb_rating": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"imdb_votes": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"shikimori_rating": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"shikimori_votes": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"premiere_world": {
|
||||
"type": "string"
|
||||
},
|
||||
"aired_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"released_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating_mpaa": {
|
||||
"type": "string"
|
||||
},
|
||||
"minimal_age": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"episodes_total": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"episodes_aired": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Result": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"link": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"translation": {
|
||||
"$ref": "#/components/schemas/Translation"
|
||||
},
|
||||
"year": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"quality": {
|
||||
"type": "string"
|
||||
},
|
||||
"camrip": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"lgbt": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"screenshots": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"title_orig": {
|
||||
"type": "string"
|
||||
},
|
||||
"other_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_season": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"last_episode": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"episodes_count": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"kinopoisk_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"imdb_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"worldart_link": {
|
||||
"type": "string"
|
||||
},
|
||||
"shikimori_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"blocked_countries": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"material_data": {
|
||||
"$ref": "#/components/schemas/MaterialData"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Translation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
136
app/openapi/search.ts
Normal file
136
app/openapi/search.ts
Normal file
@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Generated by orval v7.10.0 🍺
|
||||
* Do not edit manually.
|
||||
* OpenAPI definition
|
||||
* OpenAPI spec version: v0
|
||||
*/
|
||||
export interface KodikResponse {
|
||||
total?: number;
|
||||
results?: Result[];
|
||||
}
|
||||
|
||||
export interface MaterialData {
|
||||
title?: string;
|
||||
year?: number;
|
||||
description?: string;
|
||||
screenshots?: string[];
|
||||
duration?: number;
|
||||
countries?: string[];
|
||||
genres?: string[];
|
||||
actors?: string[];
|
||||
directors?: string[];
|
||||
producers?: string[];
|
||||
writers?: string[];
|
||||
composers?: string[];
|
||||
editors?: string[];
|
||||
designers?: string[];
|
||||
operators?: string[];
|
||||
anime_title?: string;
|
||||
title_en?: string;
|
||||
other_titles?: string[];
|
||||
other_titles_en?: string[];
|
||||
other_titles_jp?: string[];
|
||||
anime_license_name?: string;
|
||||
anime_licensed_by?: string[];
|
||||
anime_kind?: string;
|
||||
all_status?: string;
|
||||
anime_status?: string;
|
||||
anime_description?: string;
|
||||
poster_url?: string;
|
||||
anime_poster_url?: string;
|
||||
all_genres?: string[];
|
||||
anime_genres?: string[];
|
||||
anime_studios?: string[];
|
||||
kinopoisk_rating?: number;
|
||||
kinopoisk_votes?: number;
|
||||
imdb_rating?: number;
|
||||
imdb_votes?: number;
|
||||
shikimori_rating?: number;
|
||||
shikimori_votes?: number;
|
||||
premiere_world?: string;
|
||||
aired_at?: string;
|
||||
released_at?: string;
|
||||
rating_mpaa?: string;
|
||||
minimal_age?: number;
|
||||
episodes_total?: number;
|
||||
episodes_aired?: number;
|
||||
}
|
||||
|
||||
export interface Result {
|
||||
id?: string;
|
||||
type?: string;
|
||||
link?: string;
|
||||
title?: string;
|
||||
translation?: Translation;
|
||||
year?: number;
|
||||
quality?: string;
|
||||
camrip?: boolean;
|
||||
lgbt?: boolean;
|
||||
screenshots?: string[];
|
||||
title_orig?: string;
|
||||
other_title?: string;
|
||||
last_season?: number;
|
||||
last_episode?: number;
|
||||
episodes_count?: number;
|
||||
kinopoisk_id?: string;
|
||||
imdb_id?: string;
|
||||
worldart_link?: string;
|
||||
shikimori_id?: string;
|
||||
blocked_countries?: string[];
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
material_data?: MaterialData;
|
||||
}
|
||||
|
||||
export interface Translation {
|
||||
id?: number;
|
||||
title?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export type SearchParams = {
|
||||
title: string;
|
||||
};
|
||||
|
||||
export type searchResponse200 = {
|
||||
data: KodikResponse
|
||||
status: 200
|
||||
}
|
||||
|
||||
export type searchResponseComposite = searchResponse200;
|
||||
|
||||
export type searchResponse = searchResponseComposite & {
|
||||
headers: Headers;
|
||||
}
|
||||
|
||||
export const getSearchUrl = (params: SearchParams,) => {
|
||||
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:8080/search?${stringifiedParams}` : `http://localhost:8080/search`
|
||||
}
|
||||
|
||||
export const search = async (params: SearchParams, options?: RequestInit): Promise<searchResponse> => {
|
||||
|
||||
const res = await fetch(getSearchUrl(params),
|
||||
{
|
||||
...options,
|
||||
method: 'GET'
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
const body = [204, 205, 304].includes(res.status) ? null : await res.text()
|
||||
const data: searchResponse['data'] = body ? JSON.parse(body) : {}
|
||||
|
||||
return { data, status: res.status, headers: res.headers } as searchResponse
|
||||
}
|
Reference in New Issue
Block a user