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:
consultoria-as
2026-02-22 03:16:02 +00:00
parent 0855333a8c
commit 1ae432a266
9 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1 @@
export * from "./types";

View 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;
};
};
}

View 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;
}

View 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;
}

View 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;
}

View File

@@ -0,0 +1,4 @@
export * from "./game";
export * from "./documentary";
export * from "./chapter";
export * from "./api";