Refactor code structure for improved readability and maintainability

This commit is contained in:
Firman Ramdhani
2026-05-22 17:53:35 +07:00
parent af0fe70ac6
commit 4260e240a0
37 changed files with 2915 additions and 74 deletions
@@ -0,0 +1,40 @@
import { CommonRemoteDataServices } from '@repo/core-api/data-services';
import type { BaseEntity } from '@repo/core-api/data-services';
import { publicClient } from '../../../lib/api-client';
// ─── Domain Entity ──────────────────────────────────────────────
/**
* Public content entity for the landing page.
*
* Represents promotional content, blog posts, or announcements
* served from a public API without authentication.
*/
export interface PublicContentEntity extends BaseEntity {
title: string;
slug: string;
excerpt: string;
imageUrl: string;
publishedAt: string;
}
// ─── Data Services Instance ─────────────────────────────────────
/**
* Public content data services — wired to the lightweight `publicClient`.
*
* No auth, no OTel — pure zero-overhead HTTP calls.
*
* @example
* ```ts
* const { data } = await publicContentServices.getMany();
* const { data: post } = await publicContentServices.getOne('hello-world');
* ```
*/
export const publicContentServices = new CommonRemoteDataServices<PublicContentEntity>(
publicClient,
{
apiUrl: '/content',
moduleKey: 'PUBLIC_CONTENT',
},
);