Răsfoiți Sursa

refactor: update ApiResponse structure to replace success and message with error and status fields

Dave 13 ore în urmă
părinte
comite
7fd1e9942e

+ 2 - 2
libs/common/src/filters/http-exception.filter.ts

@@ -44,9 +44,9 @@ export class HttpExceptionFilter implements ExceptionFilter {
     }
 
     const apiResponse: ApiResponse<null> = {
-      success: false,
+      error: message,
+      status: 0,
       code: this.mapStatusToCode(status),
-      message,
       data: null,
       timestamp: new Date().toISOString(),
     };

+ 2 - 2
libs/common/src/interceptors/response.interceptor.ts

@@ -18,9 +18,9 @@ export class ResponseInterceptor implements NestInterceptor {
         }
 
         return {
-          success: true,
+          error: '',
+          status: 1,
           code: 'OK',
-          message: 'success',
           data,
           timestamp: new Date().toISOString(),
         };

+ 2 - 2
libs/common/src/interfaces/api-response.interface.ts

@@ -1,7 +1,7 @@
 export interface ApiResponse<T = unknown> {
-  success: boolean;
+  error: string;
+  status: 1 | 0;
   code: string;
-  message: string;
   data: T;
   timestamp: string;
 }