mirror of
https://github.com/StepanovPlaton/torrent_frontend.git
synced 2026-04-04 04:40:50 +04:00
Add genres and actors
This commit is contained in:
@@ -14,6 +14,12 @@ import {
|
||||
TypesOfItems,
|
||||
} from "../types";
|
||||
import { ItemService } from "../item";
|
||||
import {
|
||||
AudiobookGenreCreateType,
|
||||
audiobookGenreSchema,
|
||||
audiobookGenresSchema,
|
||||
} from "./schemas/genre";
|
||||
import { RequiredFrom } from "@/shared/utils/types";
|
||||
|
||||
@staticImplements<IItemService>()
|
||||
export abstract class AudiobookService {
|
||||
@@ -30,7 +36,7 @@ export abstract class AudiobookService {
|
||||
|
||||
public static async GetCards() {
|
||||
return await HTTPService.get(
|
||||
`/${this.urlPrefix}/cards`,
|
||||
`/${this.urlPrefix}`,
|
||||
audiobookCardsSchema,
|
||||
this.cacheOptions(`/${this.urlPrefix}/cards`)
|
||||
);
|
||||
@@ -53,7 +59,7 @@ export abstract class AudiobookService {
|
||||
});
|
||||
}
|
||||
|
||||
public static GetEmpty(): AudiobookCreateType {
|
||||
public static GetEmpty(): RequiredFrom<AudiobookCreateType> {
|
||||
return {
|
||||
title: "",
|
||||
torrent_file: "",
|
||||
@@ -61,6 +67,23 @@ export abstract class AudiobookService {
|
||||
};
|
||||
}
|
||||
|
||||
public static async GetGenres() {
|
||||
return await HTTPService.get(
|
||||
`/genres/${this.urlPrefix}`,
|
||||
audiobookGenresSchema
|
||||
);
|
||||
}
|
||||
|
||||
public static async CreateGenre(info: AudiobookGenreCreateType) {
|
||||
return await HTTPService.post(
|
||||
`/genres/${this.urlPrefix}`,
|
||||
audiobookGenreSchema,
|
||||
{
|
||||
body: info,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static propertiesDescription: ItemPropertiesDescriptionType<AudiobookType> = [
|
||||
[
|
||||
{ name: "Автор", key: "author" },
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import { audiobookCardBaseSchema } from "./audiobookCard";
|
||||
import { audiobookGenresSchema } from "./genre";
|
||||
import { ownerSchema } from "../../schemas/owner";
|
||||
import { TypesOfItems } from "../../types";
|
||||
|
||||
export const audiobookBaseSchema = audiobookCardBaseSchema.merge(
|
||||
z.object({
|
||||
@@ -22,6 +25,8 @@ export const audiobookBaseSchema = audiobookCardBaseSchema.merge(
|
||||
})
|
||||
: undefined
|
||||
),
|
||||
|
||||
genres: audiobookGenresSchema.optional().nullable(),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -31,15 +36,11 @@ export type AudiobookCreateType = z.infer<typeof audiobookCreateSchema>;
|
||||
export const audiobookSchema = audiobookBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
owner_id: z.number().positive(),
|
||||
owner: ownerSchema,
|
||||
update_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
upload_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
})
|
||||
);
|
||||
export type AudiobookType = z.infer<typeof audiobookSchema>;
|
||||
@@ -56,3 +57,7 @@ export const audiobooksSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return audiobooks;
|
||||
});
|
||||
|
||||
export const isAudiobook = (a: any): a is AudiobookType => {
|
||||
return (a as AudiobookType).type === TypesOfItems.audiobook;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,3 @@ export const audiobookCardsSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
|
||||
export const isAudiobook = (a: any): a is AudiobookCardType => {
|
||||
return (a as AudiobookCardType).type === TypesOfItems.audiobook;
|
||||
};
|
||||
|
||||
32
src/entities/item/audiobook/schemas/genre.ts
Normal file
32
src/entities/item/audiobook/schemas/genre.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const audiobookGenreBaseSchema = z.object({
|
||||
genre: z.string().min(3),
|
||||
});
|
||||
|
||||
export const audiobookGenreCreateSchema = audiobookGenreBaseSchema.merge(
|
||||
z.object({})
|
||||
);
|
||||
export type AudiobookGenreCreateType = z.infer<
|
||||
typeof audiobookGenreCreateSchema
|
||||
>;
|
||||
|
||||
export const audiobookGenreSchema = audiobookGenreBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
})
|
||||
);
|
||||
export type AudiobookGenreType = z.infer<typeof audiobookGenreSchema>;
|
||||
|
||||
export const isAudiobookGenreStrict = (a: any): a is AudiobookGenreType => {
|
||||
return audiobookGenreSchema.safeParse(a).success;
|
||||
};
|
||||
|
||||
export const audiobookGenresSchema = z.array(z.any()).transform((a) => {
|
||||
const cards: AudiobookGenreType[] = [];
|
||||
a.forEach((e) => {
|
||||
if (isAudiobookGenreStrict(e)) cards.push(audiobookGenreSchema.parse(e));
|
||||
else console.error("AudiobookGenre parse error - ", e);
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
@@ -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" },
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import { gameCardBaseSchema } from "./gameCard";
|
||||
import { gameGenresSchema } from "./genre";
|
||||
import { ownerSchema } from "../../schemas/owner";
|
||||
import { TypesOfItems } from "../../types";
|
||||
|
||||
export const gameBaseSchema = gameCardBaseSchema.merge(
|
||||
z.object({
|
||||
@@ -27,6 +30,8 @@ export const gameBaseSchema = gameCardBaseSchema.merge(
|
||||
})
|
||||
: undefined
|
||||
),
|
||||
|
||||
genres: gameGenresSchema.optional().nullable(),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -36,15 +41,11 @@ export type GameCreateType = z.infer<typeof gameCreateSchema>;
|
||||
export const gameSchema = gameBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
owner_id: z.number().positive(),
|
||||
owner: ownerSchema,
|
||||
update_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
upload_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
})
|
||||
);
|
||||
export type GameType = z.infer<typeof gameSchema>;
|
||||
@@ -61,3 +62,7 @@ export const gamesSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return games;
|
||||
});
|
||||
|
||||
export const isGame = (a: any): a is GameType => {
|
||||
return (a as GameType).type === TypesOfItems.game;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,3 @@ export const gameCardsSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
|
||||
export const isGame = (a: any): a is GameCardType => {
|
||||
return (a as GameCardType).type === TypesOfItems.game;
|
||||
};
|
||||
|
||||
28
src/entities/item/game/schemas/genre.ts
Normal file
28
src/entities/item/game/schemas/genre.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const gameGenreBaseSchema = z.object({
|
||||
genre: z.string().min(3),
|
||||
});
|
||||
|
||||
export const gameGenreCreateSchema = gameGenreBaseSchema.merge(z.object({}));
|
||||
export type GameGenreCreateType = z.infer<typeof gameGenreCreateSchema>;
|
||||
|
||||
export const gameGenreSchema = gameGenreBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
})
|
||||
);
|
||||
export type GameGenreType = z.infer<typeof gameGenreSchema>;
|
||||
|
||||
export const isGameGenreStrict = (a: any): a is GameGenreType => {
|
||||
return gameGenreSchema.safeParse(a).success;
|
||||
};
|
||||
|
||||
export const gameGenresSchema = z.array(z.any()).transform((a) => {
|
||||
const cards: GameGenreType[] = [];
|
||||
a.forEach((e) => {
|
||||
if (isGameGenreStrict(e)) cards.push(gameGenreSchema.parse(e));
|
||||
else console.error("GameGenre parse error - ", e);
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
@@ -1,100 +1,37 @@
|
||||
import {
|
||||
gameSchema,
|
||||
gamesSchema,
|
||||
gameCreateSchema,
|
||||
type GameType,
|
||||
type GameCreateType,
|
||||
} from "./game/schemas/game";
|
||||
export {
|
||||
gameSchema,
|
||||
gamesSchema,
|
||||
gameCreateSchema,
|
||||
type GameType,
|
||||
type GameCreateType,
|
||||
};
|
||||
|
||||
import {
|
||||
gameCardSchema,
|
||||
gameCardsSchema,
|
||||
type GameCardType,
|
||||
isGame,
|
||||
} from "./game/schemas/gameCard";
|
||||
export { gameCardSchema, gameCardsSchema, type GameCardType, isGame };
|
||||
|
||||
import { GameService } from "./game/game";
|
||||
export { GameService };
|
||||
|
||||
import {
|
||||
movieSchema,
|
||||
moviesSchema,
|
||||
movieCreateSchema,
|
||||
type MovieType,
|
||||
type MovieCreateType,
|
||||
} from "./movie/schemas/movie";
|
||||
export {
|
||||
movieSchema,
|
||||
moviesSchema,
|
||||
movieCreateSchema,
|
||||
type MovieType,
|
||||
type MovieCreateType,
|
||||
};
|
||||
|
||||
import {
|
||||
movieCardSchema,
|
||||
movieCardsSchema,
|
||||
type MovieCardType,
|
||||
isMovie,
|
||||
} from "./movie/schemas/movieCard";
|
||||
export { movieCardSchema, movieCardsSchema, type MovieCardType, isMovie };
|
||||
import { isGame } from "./game/schemas/game";
|
||||
export { isGame };
|
||||
|
||||
import { MovieService } from "./movie/movie";
|
||||
export { MovieService };
|
||||
|
||||
import {
|
||||
audiobookSchema,
|
||||
audiobooksSchema,
|
||||
audiobookCreateSchema,
|
||||
type AudiobookType,
|
||||
type AudiobookCreateType,
|
||||
} from "./audiobook/schemas/audiobook";
|
||||
export {
|
||||
audiobookSchema,
|
||||
audiobooksSchema,
|
||||
audiobookCreateSchema,
|
||||
type AudiobookType,
|
||||
type AudiobookCreateType,
|
||||
};
|
||||
import { isMovie } from "./movie/schemas/movie";
|
||||
export { isMovie };
|
||||
|
||||
import {
|
||||
audiobookCardSchema,
|
||||
audiobookCardsSchema,
|
||||
type AudiobookCardType,
|
||||
isAudiobook,
|
||||
} from "./audiobook/schemas/audiobookCard";
|
||||
export {
|
||||
audiobookCardSchema,
|
||||
audiobookCardsSchema,
|
||||
type AudiobookCardType,
|
||||
isAudiobook,
|
||||
};
|
||||
|
||||
import { AudiobookService } from "./audiobook/audiobook";
|
||||
export { AudiobookService };
|
||||
import { isAudiobook } from "./audiobook/schemas/audiobook";
|
||||
export { isAudiobook };
|
||||
|
||||
import { ItemService } from "./item";
|
||||
export { ItemService };
|
||||
|
||||
import {
|
||||
TypesOfItems,
|
||||
isGenre,
|
||||
type IItemService,
|
||||
type ItemType,
|
||||
type ItemCardType,
|
||||
type ItemCreateType,
|
||||
type GenreType,
|
||||
type CreateGenreType,
|
||||
type ItemListPropertyType,
|
||||
} from "./types";
|
||||
export {
|
||||
TypesOfItems,
|
||||
isGenre,
|
||||
type IItemService,
|
||||
type ItemType,
|
||||
type ItemCardType,
|
||||
type ItemCreateType,
|
||||
type GenreType,
|
||||
type CreateGenreType,
|
||||
type ItemListPropertyType,
|
||||
};
|
||||
|
||||
@@ -10,6 +10,17 @@ import {
|
||||
TypesOfItems,
|
||||
} from "../types";
|
||||
import { ItemService } from "../item";
|
||||
import {
|
||||
MovieGenreCreateType,
|
||||
movieGenreSchema,
|
||||
movieGenresSchema,
|
||||
} from "./schemas/genre";
|
||||
import {
|
||||
MovieActorCreateType,
|
||||
movieActorSchema,
|
||||
movieActorsSchema,
|
||||
} from "./schemas/actors";
|
||||
import { RequiredFrom } from "@/shared/utils/types";
|
||||
|
||||
@staticImplements<IItemService>()
|
||||
export abstract class MovieService {
|
||||
@@ -26,7 +37,7 @@ export abstract class MovieService {
|
||||
|
||||
public static async GetCards() {
|
||||
return await HTTPService.get(
|
||||
`/${this.urlPrefix}/cards`,
|
||||
`/${this.urlPrefix}`,
|
||||
movieCardsSchema,
|
||||
this.cacheOptions(`/${this.urlPrefix}/cards`)
|
||||
);
|
||||
@@ -49,7 +60,7 @@ export abstract class MovieService {
|
||||
});
|
||||
}
|
||||
|
||||
public static GetEmpty(): MovieCreateType {
|
||||
public static GetEmpty(): RequiredFrom<MovieCreateType> {
|
||||
return {
|
||||
title: "",
|
||||
torrent_file: "",
|
||||
@@ -57,6 +68,33 @@ export abstract class MovieService {
|
||||
};
|
||||
}
|
||||
|
||||
public static async GetGenres() {
|
||||
return await HTTPService.get(
|
||||
`/genres/${this.urlPrefix}`,
|
||||
movieGenresSchema
|
||||
);
|
||||
}
|
||||
|
||||
public static async CreateGenre(info: MovieGenreCreateType) {
|
||||
return await HTTPService.post(
|
||||
`/genres/${this.urlPrefix}`,
|
||||
movieGenreSchema,
|
||||
{
|
||||
body: info,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static async GetActors() {
|
||||
return await HTTPService.get(`/actors`, movieActorsSchema);
|
||||
}
|
||||
|
||||
public static async CreateActor(info: MovieActorCreateType) {
|
||||
return await HTTPService.post(`/actors`, movieActorSchema, {
|
||||
body: info,
|
||||
});
|
||||
}
|
||||
|
||||
public static propertiesDescription: ItemPropertiesDescriptionType<MovieType> =
|
||||
[
|
||||
[
|
||||
|
||||
28
src/entities/item/movie/schemas/actors.ts
Normal file
28
src/entities/item/movie/schemas/actors.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const movieActorBaseSchema = z.object({
|
||||
actor: z.string().min(3),
|
||||
});
|
||||
|
||||
export const movieActorCreateSchema = movieActorBaseSchema.merge(z.object({}));
|
||||
export type MovieActorCreateType = z.infer<typeof movieActorCreateSchema>;
|
||||
|
||||
export const movieActorSchema = movieActorBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
})
|
||||
);
|
||||
export type MovieActorType = z.infer<typeof movieActorSchema>;
|
||||
|
||||
export const isMovieActorStrict = (a: any): a is MovieActorType => {
|
||||
return movieActorSchema.safeParse(a).success;
|
||||
};
|
||||
|
||||
export const movieActorsSchema = z.array(z.any()).transform((a) => {
|
||||
const cards: MovieActorType[] = [];
|
||||
a.forEach((e) => {
|
||||
if (isMovieActorStrict(e)) cards.push(movieActorSchema.parse(e));
|
||||
else console.error("MovieActor parse error - ", e);
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
28
src/entities/item/movie/schemas/genre.ts
Normal file
28
src/entities/item/movie/schemas/genre.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const movieGenreBaseSchema = z.object({
|
||||
genre: z.string().min(3),
|
||||
});
|
||||
|
||||
export const movieGenreCreateSchema = movieGenreBaseSchema.merge(z.object({}));
|
||||
export type MovieGenreCreateType = z.infer<typeof movieGenreCreateSchema>;
|
||||
|
||||
export const movieGenreSchema = movieGenreBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
})
|
||||
);
|
||||
export type MovieGenreType = z.infer<typeof movieGenreSchema>;
|
||||
|
||||
export const isMovieGenreStrict = (a: any): a is MovieGenreType => {
|
||||
return movieGenreSchema.safeParse(a).success;
|
||||
};
|
||||
|
||||
export const movieGenresSchema = z.array(z.any()).transform((a) => {
|
||||
const cards: MovieGenreType[] = [];
|
||||
a.forEach((e) => {
|
||||
if (isMovieGenreStrict(e)) cards.push(movieGenreSchema.parse(e));
|
||||
else console.error("MovieGenre parse error - ", e);
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
@@ -1,5 +1,9 @@
|
||||
import { z } from "zod";
|
||||
import { movieCardBaseSchema } from "./movieCard";
|
||||
import { movieGenresSchema } from "./genre";
|
||||
import { movieActorsSchema } from "./actors";
|
||||
import { ownerSchema } from "../../schemas/owner";
|
||||
import { TypesOfItems } from "../../types";
|
||||
|
||||
export const movieBaseSchema = movieCardBaseSchema.merge(
|
||||
z.object({
|
||||
@@ -24,6 +28,9 @@ export const movieBaseSchema = movieCardBaseSchema.merge(
|
||||
})
|
||||
: undefined
|
||||
),
|
||||
|
||||
actors: movieActorsSchema.optional().nullable(),
|
||||
genres: movieGenresSchema.optional().nullable(),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -33,15 +40,11 @@ export type MovieCreateType = z.infer<typeof movieCreateSchema>;
|
||||
export const movieSchema = movieBaseSchema.merge(
|
||||
z.object({
|
||||
id: z.number().positive(),
|
||||
owner_id: z.number().positive(),
|
||||
owner: ownerSchema,
|
||||
update_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
upload_date: z
|
||||
.string()
|
||||
.min(1)
|
||||
.transform((d) => new Date(d)),
|
||||
})
|
||||
);
|
||||
export type MovieType = z.infer<typeof movieSchema>;
|
||||
@@ -58,3 +61,7 @@ export const moviesSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return games;
|
||||
});
|
||||
|
||||
export const isMovie = (a: any): a is MovieType => {
|
||||
return (a as MovieType).type === TypesOfItems.movie;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,3 @@ export const movieCardsSchema = z.array(z.any()).transform((a) => {
|
||||
});
|
||||
return cards;
|
||||
});
|
||||
|
||||
export const isMovie = (a: any): a is MovieCardType => {
|
||||
return (a as MovieCardType).type === TypesOfItems.movie;
|
||||
};
|
||||
|
||||
7
src/entities/item/schemas/owner.ts
Normal file
7
src/entities/item/schemas/owner.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const ownerSchema = z.object({
|
||||
id: z.number().positive(),
|
||||
name: z.string().min(3),
|
||||
email: z.string().min(3),
|
||||
});
|
||||
@@ -7,6 +7,13 @@ import {
|
||||
AudiobookType,
|
||||
} from "./audiobook/schemas/audiobook";
|
||||
import { AudiobookCardType } from "./audiobook/schemas/audiobookCard";
|
||||
import { GameGenreCreateType, GameGenreType } from "./game/schemas/genre";
|
||||
import { MovieGenreCreateType, MovieGenreType } from "./movie/schemas/genre";
|
||||
import {
|
||||
AudiobookGenreCreateType,
|
||||
AudiobookGenreType,
|
||||
} from "./audiobook/schemas/genre";
|
||||
import { MovieActorType } from "./movie/schemas/actors";
|
||||
|
||||
export type ItemType = GameType | MovieType | AudiobookType;
|
||||
export type ItemCardType = GameCardType | MovieCardType | AudiobookCardType;
|
||||
@@ -14,9 +21,20 @@ export type ItemCreateType =
|
||||
| GameCreateType
|
||||
| MovieCreateType
|
||||
| AudiobookCreateType;
|
||||
|
||||
export type UnionItemType = GameType & MovieType & AudiobookType;
|
||||
|
||||
export type GenreType = GameGenreType | MovieGenreType | AudiobookGenreType;
|
||||
export type CreateGenreType =
|
||||
| GameGenreCreateType
|
||||
| MovieGenreCreateType
|
||||
| AudiobookGenreCreateType;
|
||||
|
||||
export type ItemListPropertyType = GenreType | MovieActorType;
|
||||
|
||||
export const isGenre = (g: any): g is GenreType => {
|
||||
return (g as GenreType).genre !== undefined;
|
||||
};
|
||||
|
||||
export enum TypesOfItems {
|
||||
game,
|
||||
movie,
|
||||
@@ -39,6 +57,8 @@ export interface IItemService {
|
||||
Change(id: number, info: ItemCreateType): Promise<ItemType | null>;
|
||||
GetEmpty(): ItemCreateType;
|
||||
propertiesDescription: ItemPropertiesDescriptionType<UnionItemType>;
|
||||
CreateGenre(info: CreateGenreType): Promise<GenreType | null>;
|
||||
GetGenres(): Promise<GenreType[] | null>;
|
||||
}
|
||||
export const staticImplements =
|
||||
<T>() =>
|
||||
|
||||
Reference in New Issue
Block a user