mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
remove config response
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from config.config_manager import config_manager as cm
|
||||
from decorators.auth import protected_route
|
||||
from endpoints.responses import ConfigurationResponse
|
||||
from endpoints.responses.config import ConfigResponse
|
||||
from exceptions.config_exceptions import (
|
||||
ConfigNotReadableException,
|
||||
@@ -45,7 +44,7 @@ def get_config() -> ConfigResponse:
|
||||
|
||||
|
||||
@protected_route(router.post, "/system/platforms", [Scope.PLATFORMS_WRITE])
|
||||
async def add_platform_binding(request: Request) -> ConfigurationResponse:
|
||||
async def add_platform_binding(request: Request) -> None:
|
||||
"""Add platform binding to the configuration"""
|
||||
|
||||
data = await request.json()
|
||||
@@ -60,15 +59,9 @@ async def add_platform_binding(request: Request) -> ConfigurationResponse:
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [fs_slug, slug],
|
||||
}
|
||||
|
||||
|
||||
@protected_route(router.delete, "/system/platforms/{fs_slug}", [Scope.PLATFORMS_WRITE])
|
||||
async def delete_platform_binding(
|
||||
request: Request, fs_slug: str
|
||||
) -> ConfigurationResponse:
|
||||
async def delete_platform_binding(request: Request, fs_slug: str) -> None:
|
||||
"""Delete platform binding from the configuration"""
|
||||
|
||||
try:
|
||||
@@ -79,13 +72,9 @@ async def delete_platform_binding(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [fs_slug],
|
||||
}
|
||||
|
||||
|
||||
@protected_route(router.post, "/system/versions", [Scope.PLATFORMS_WRITE])
|
||||
async def add_platform_version(request: Request) -> ConfigurationResponse:
|
||||
async def add_platform_version(request: Request) -> None:
|
||||
"""Add platform version to the configuration"""
|
||||
|
||||
data = await request.json()
|
||||
@@ -100,15 +89,9 @@ async def add_platform_version(request: Request) -> ConfigurationResponse:
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [fs_slug, slug],
|
||||
}
|
||||
|
||||
|
||||
@protected_route(router.delete, "/system/versions/{fs_slug}", [Scope.PLATFORMS_WRITE])
|
||||
async def delete_platform_version(
|
||||
request: Request, fs_slug: str
|
||||
) -> ConfigurationResponse:
|
||||
async def delete_platform_version(request: Request, fs_slug: str) -> None:
|
||||
"""Delete platform version from the configuration"""
|
||||
|
||||
try:
|
||||
@@ -119,13 +102,9 @@ async def delete_platform_version(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [fs_slug],
|
||||
}
|
||||
|
||||
|
||||
@protected_route(router.post, "/exclude", [Scope.PLATFORMS_WRITE])
|
||||
async def add_exclusion(request: Request) -> ConfigurationResponse:
|
||||
async def add_exclusion(request: Request) -> None:
|
||||
"""Add platform exclusion to the configuration"""
|
||||
|
||||
data = await request.json()
|
||||
@@ -139,10 +118,6 @@ async def add_exclusion(request: Request) -> ConfigurationResponse:
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [exclusion_value, exclusion_type],
|
||||
}
|
||||
|
||||
|
||||
@protected_route(
|
||||
router.delete,
|
||||
@@ -151,7 +126,7 @@ async def add_exclusion(request: Request) -> ConfigurationResponse:
|
||||
)
|
||||
async def delete_exclusion(
|
||||
request: Request, exclusion_type: str, exclusion_value: str
|
||||
) -> ConfigurationResponse:
|
||||
) -> None:
|
||||
"""Delete platform binding from the configuration"""
|
||||
|
||||
try:
|
||||
@@ -161,7 +136,3 @@ async def delete_exclusion(
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
|
||||
) from exc
|
||||
|
||||
return {
|
||||
"affected_items": [exclusion_value, exclusion_type],
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@ class TaskExecutionResponse(TypedDict):
|
||||
queued_at: str
|
||||
|
||||
|
||||
class ConfigurationResponse(TypedDict):
|
||||
affected_items: list[str]
|
||||
|
||||
|
||||
class BulkOperationResponse(TypedDict):
|
||||
total_items: int
|
||||
successful_items: int
|
||||
|
||||
1
frontend/src/__generated__/index.ts
generated
1
frontend/src/__generated__/index.ts
generated
@@ -20,7 +20,6 @@ export type { Body_update_rom_user_api_roms__id__props_put } from './models/Body
|
||||
export type { BulkOperationResponse } from './models/BulkOperationResponse';
|
||||
export type { CollectionSchema } from './models/CollectionSchema';
|
||||
export type { ConfigResponse } from './models/ConfigResponse';
|
||||
export type { ConfigurationResponse } from './models/ConfigurationResponse';
|
||||
export type { CustomLimitOffsetPage_SimpleRomSchema_ } from './models/CustomLimitOffsetPage_SimpleRomSchema_';
|
||||
export type { DetailedRomSchema } from './models/DetailedRomSchema';
|
||||
export type { EarnedAchievement } from './models/EarnedAchievement';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
/* generated using openapi-typescript-codegen -- do not edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type ConfigurationResponse = {
|
||||
affected_items: Array<string>;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { ConfigurationResponse } from "@/__generated__";
|
||||
import api from "@/services/api/index";
|
||||
|
||||
export const configApi = api;
|
||||
@@ -9,15 +8,11 @@ async function addPlatformBindConfig({
|
||||
}: {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
}) {
|
||||
return api.post("/config/system/platforms", { fs_slug: fsSlug, slug: slug });
|
||||
}
|
||||
|
||||
async function deletePlatformBindConfig({
|
||||
fsSlug,
|
||||
}: {
|
||||
fsSlug: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
async function deletePlatformBindConfig({ fsSlug }: { fsSlug: string }) {
|
||||
return api.delete(`/config/system/platforms/${fsSlug}`);
|
||||
}
|
||||
|
||||
@@ -27,15 +22,11 @@ async function addPlatformVersionConfig({
|
||||
}: {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
}) {
|
||||
return api.post("/config/system/versions", { fs_slug: fsSlug, slug: slug });
|
||||
}
|
||||
|
||||
async function deletePlatformVersionConfig({
|
||||
fsSlug,
|
||||
}: {
|
||||
fsSlug: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
async function deletePlatformVersionConfig({ fsSlug }: { fsSlug: string }) {
|
||||
return api.delete(`/config/system/versions/${fsSlug}`);
|
||||
}
|
||||
|
||||
@@ -45,7 +36,7 @@ async function addExclusion({
|
||||
}: {
|
||||
exclusionValue: string;
|
||||
exclusionType: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
}) {
|
||||
return api.post("/config/exclude", {
|
||||
exclusion_value: exclusionValue,
|
||||
exclusion_type: exclusionType,
|
||||
@@ -58,7 +49,7 @@ async function deleteExclusion({
|
||||
}: {
|
||||
exclusionValue: string;
|
||||
exclusionType: string;
|
||||
}): Promise<{ data: ConfigurationResponse }> {
|
||||
}) {
|
||||
return api.delete(`/config/exclude/${exclusionType}/${exclusionValue}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user