website refactor
This commit is contained in:
@@ -3,7 +3,9 @@ import type { UserDto, DashboardStats, UserListResponse, ListUsersQuery } from '
|
||||
import { Result } from '@/lib/contracts/Result';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
||||
import { DomainError } from '@/lib/contracts/services/Service';
|
||||
import { DomainError, Service } from '@/lib/contracts/services/Service';
|
||||
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
|
||||
import { getWebsiteServerEnv } from '@/lib/config/env';
|
||||
|
||||
/**
|
||||
* Admin Service - DTO Only
|
||||
@@ -12,16 +14,17 @@ import { DomainError } from '@/lib/contracts/services/Service';
|
||||
* All client-side presentation logic must be handled by presenters/templates.
|
||||
* @server-safe
|
||||
*/
|
||||
export class AdminService {
|
||||
export class AdminService implements Service {
|
||||
private apiClient: AdminApiClient;
|
||||
|
||||
constructor() {
|
||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3001';
|
||||
const baseUrl = getWebsiteApiBaseUrl();
|
||||
const logger = new ConsoleLogger();
|
||||
const { NODE_ENV } = getWebsiteServerEnv();
|
||||
const errorReporter = new EnhancedErrorReporter(logger, {
|
||||
showUserNotifications: false,
|
||||
logToConsole: true,
|
||||
reportToExternal: process.env.NODE_ENV === 'production',
|
||||
reportToExternal: NODE_ENV === 'production',
|
||||
});
|
||||
this.apiClient = new AdminApiClient(baseUrl, errorReporter, logger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user