feat: add shared TypeScript types for Game, Documentary, Chapter
Create @afterlife/shared package with type definitions for the core domain models (Game, Documentary, Chapter) and Strapi API interfaces (StrapiMedia, StrapiResponse, StrapiListResponse). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1
packages/shared/src/index.ts
Normal file
1
packages/shared/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./types";
|
||||
33
packages/shared/src/types/api.ts
Normal file
33
packages/shared/src/types/api.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
export interface StrapiMedia {
|
||||
id: number;
|
||||
url: string;
|
||||
alternativeText: string | null;
|
||||
width: number | null;
|
||||
height: number | null;
|
||||
mime: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface StrapiResponse<T> {
|
||||
data: T;
|
||||
meta: {
|
||||
pagination?: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
pageCount: number;
|
||||
total: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface StrapiListResponse<T> {
|
||||
data: T[];
|
||||
meta: {
|
||||
pagination: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
pageCount: number;
|
||||
total: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
12
packages/shared/src/types/chapter.ts
Normal file
12
packages/shared/src/types/chapter.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { StrapiMedia } from "./api";
|
||||
|
||||
export interface Chapter {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
audioFile: StrapiMedia | null;
|
||||
audioDuration: number | null;
|
||||
order: number;
|
||||
coverImage: StrapiMedia | null;
|
||||
locale: string;
|
||||
}
|
||||
12
packages/shared/src/types/documentary.ts
Normal file
12
packages/shared/src/types/documentary.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Chapter } from "./chapter";
|
||||
|
||||
export interface Documentary {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
chapters: Chapter[];
|
||||
publishedAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
locale: string;
|
||||
}
|
||||
25
packages/shared/src/types/game.ts
Normal file
25
packages/shared/src/types/game.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { Documentary } from "./documentary";
|
||||
import type { StrapiMedia } from "./api";
|
||||
|
||||
export type Genre = "MMORPG" | "FPS" | "Casual" | "Strategy" | "Sports" | "Other";
|
||||
export type ServerStatus = "online" | "maintenance" | "coming_soon";
|
||||
|
||||
export interface Game {
|
||||
id: number;
|
||||
title: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
genre: Genre;
|
||||
releaseYear: number;
|
||||
shutdownYear: number;
|
||||
developer: string;
|
||||
publisher: string;
|
||||
screenshots: StrapiMedia[];
|
||||
coverImage: StrapiMedia;
|
||||
serverStatus: ServerStatus;
|
||||
serverLink: string | null;
|
||||
documentary: Documentary | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
locale: string;
|
||||
}
|
||||
4
packages/shared/src/types/index.ts
Normal file
4
packages/shared/src/types/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./game";
|
||||
export * from "./documentary";
|
||||
export * from "./chapter";
|
||||
export * from "./api";
|
||||
Reference in New Issue
Block a user