Jelajahi Sumber

Enhance TypeScript formatting and refactor banner config service functions

- Updated .vscode/settings.json to set Biome as the default formatter for TypeScript files.
- Refactored banner config service functions for improved readability by formatting parameters across multiple lines.
- Cleaned up unused type imports in user.ts and consolidated banner config types in api index.ts.
0es 2 bulan lalu
induk
melakukan
9f83e4e44d
4 mengubah file dengan 29 tambahan dan 20 penghapusan
  1. 3 0
      .vscode/settings.json
  2. 9 5
      src/services/bannerConfig.ts
  3. 9 7
      src/services/user.ts
  4. 8 8
      src/types/api/index.ts

+ 3 - 0
.vscode/settings.json

@@ -3,5 +3,8 @@
   "editor.formatOnSave": true,
   "editor.codeActionsOnSave": {
     "source.fixAll.biome": "explicit"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "biomejs.biome"
   }
 }

+ 9 - 5
src/services/bannerConfig.ts

@@ -23,21 +23,27 @@ export async function getBannerConfigPage(
 /**
  * Get single banner config record
  */
-export async function getBannerConfig(req: IdReq): Promise<BannerConfigAdminDTO> {
+export async function getBannerConfig(
+  req: IdReq,
+): Promise<BannerConfigAdminDTO> {
   return post<BannerConfigAdminDTO>("/config/banner-config/get", req);
 }
 
 /**
  * Create banner config record
  */
-export async function createBannerConfig(data: BannerConfigAdminDTO): Promise<void> {
+export async function createBannerConfig(
+  data: BannerConfigAdminDTO,
+): Promise<void> {
   return post<void>("/config/banner-config/create", data);
 }
 
 /**
  * Update banner config record
  */
-export async function updateBannerConfig(data: BannerConfigAdminDTO): Promise<void> {
+export async function updateBannerConfig(
+  data: BannerConfigAdminDTO,
+): Promise<void> {
   return post<void>("/config/banner-config/update", data);
 }
 
@@ -47,5 +53,3 @@ export async function updateBannerConfig(data: BannerConfigAdminDTO): Promise<vo
 export async function deleteBannerConfigs(req: IdListReq): Promise<void> {
   return post<void>("/config/banner-config/delete", req);
 }
-
-

+ 9 - 7
src/services/user.ts

@@ -3,6 +3,11 @@
  */
 
 import { post } from "@/lib/request";
+import type {
+  PagerUserRandomProfileAdminDTO,
+  UserRandomProfileAdminDTO,
+  UserRandomProfileAdminQuery,
+} from "@/types/api";
 import type {
   EditPlaymateInfoAdminQuery,
   PagerUserInfoAdminDTO,
@@ -10,11 +15,6 @@ import type {
   UserInfoDetailAdminQuery,
   UserInfoFullAdminDTO,
 } from "@/types/api/user";
-import type {
-  PagerUserRandomProfileAdminDTO,
-  UserRandomProfileAdminDTO,
-  UserRandomProfileAdminQuery,
-} from "@/types/api";
 
 /**
  * Get user list with pagination
@@ -49,7 +49,10 @@ export async function updateUserBaseInfo(data: EditPlaymateInfoAdminQuery) {
 export async function getUserRandomProfilePage(
   query: UserRandomProfileAdminQuery,
 ): Promise<PagerUserRandomProfileAdminDTO> {
-  return post<PagerUserRandomProfileAdminDTO>("/user/random-profile/page", query);
+  return post<PagerUserRandomProfileAdminDTO>(
+    "/user/random-profile/page",
+    query,
+  );
 }
 
 /**
@@ -76,4 +79,3 @@ export async function updateUserRandomProfile(
 export async function deleteUserRandomProfiles(ids: string[]): Promise<void> {
   await post<unknown>("/user/random-profile/delete", { ids });
 }
-

+ 8 - 8
src/types/api/index.ts

@@ -32,6 +32,14 @@ export type {
   User,
   UserInfoResponse,
 } from "./auth";
+// Banner config types
+export type {
+  BannerConfigAdminDTO,
+  BannerConfigAdminQuery,
+  IdListReq,
+  IdReq,
+  PagerBannerConfigAdminDTO,
+} from "./bannerConfig";
 // Base config types
 export type {
   BaseConfigAdminDTO,
@@ -92,14 +100,6 @@ export type {
   IndicatorCardAdminDTO,
   RevenueByCategoryAdminDTO,
 } from "./indexStat";
-// Banner config types
-export type {
-  BannerConfigAdminDTO,
-  BannerConfigAdminQuery,
-  IdListReq,
-  IdReq,
-  PagerBannerConfigAdminDTO,
-} from "./bannerConfig";
 // Operation log types
 export type {
   OperationLog,