Add genres and actors

This commit is contained in:
2024-07-06 20:09:02 +04:00
parent ea723b88b0
commit 05cfd9c955
34 changed files with 671 additions and 324 deletions

View File

@@ -10,6 +10,12 @@ import {
TypesOfItems,
} from "../types";
import { ItemService } from "../item";
import {
GameGenreCreateType,
gameGenreSchema,
gameGenresSchema,
} from "./schemas/genre";
import { RequiredFrom } from "@/shared/utils/types";
@staticImplements<IItemService>()
export abstract class GameService {
@@ -26,7 +32,7 @@ export abstract class GameService {
public static async GetCards() {
return await HTTPService.get(
`/${this.urlPrefix}/cards`,
`/${this.urlPrefix}`,
gameCardsSchema,
this.cacheOptions(`/${this.urlPrefix}/cards`)
);
@@ -49,7 +55,7 @@ export abstract class GameService {
});
}
public static GetEmpty(): GameCreateType {
public static GetEmpty(): RequiredFrom<GameCreateType> {
return {
title: "",
torrent_file: "",
@@ -57,6 +63,20 @@ export abstract class GameService {
};
}
public static async GetGenres() {
return await HTTPService.get(`/genres/${this.urlPrefix}`, gameGenresSchema);
}
public static async CreateGenre(info: GameGenreCreateType) {
return await HTTPService.post(
`/genres/${this.urlPrefix}`,
gameGenreSchema,
{
body: info,
}
);
}
static propertiesDescription: ItemPropertiesDescriptionType<GameType> = [
[
{ name: "Система", key: "system" },