website refactor
This commit is contained in:
@@ -20,7 +20,7 @@ export class DeleteUserMutation implements Mutation<{ userId: string }, void, Mu
|
||||
// Manual construction: Service creates its own dependencies
|
||||
const service = new AdminService();
|
||||
|
||||
const result = await service.deleteUser(input.userId);
|
||||
const result = await service.deleteUser();
|
||||
|
||||
if (result.isErr()) {
|
||||
return Result.err(mapToMutationError(result.getError()));
|
||||
|
||||
@@ -16,19 +16,19 @@ import { Mutation } from '@/lib/contracts/mutations/Mutation';
|
||||
*/
|
||||
export class UpdateUserStatusMutation implements Mutation<{ userId: string; status: string }, void, MutationError> {
|
||||
async execute(input: { userId: string; status: string }): Promise<Result<void, MutationError>> {
|
||||
try {
|
||||
// Manual construction: Service creates its own dependencies
|
||||
const service = new AdminService();
|
||||
|
||||
const result = await service.updateUserStatus(input.userId, input.status);
|
||||
|
||||
if (result.isErr()) {
|
||||
return Result.err(mapToMutationError(result.getError()));
|
||||
}
|
||||
|
||||
return Result.ok(undefined);
|
||||
} catch (err) {
|
||||
return Result.err('updateFailed');
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Manual construction: Service creates its own dependencies
|
||||
const service = new AdminService();
|
||||
|
||||
const result = await service.updateUserStatus(input.userId, input.status);
|
||||
|
||||
if (result.isErr()) {
|
||||
return Result.err(mapToMutationError(result.getError()));
|
||||
}
|
||||
|
||||
return Result.ok(undefined);
|
||||
} catch (err) {
|
||||
return Result.err('updateFailed');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export class CreateLeagueMutation {
|
||||
const logger = new ConsoleLogger();
|
||||
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
||||
|
||||
this.service = new LeagueService(apiClient);
|
||||
this.service = new LeagueService();
|
||||
}
|
||||
|
||||
async execute(input: CreateLeagueInputDTO): Promise<Result<string, string>> {
|
||||
|
||||
@@ -21,7 +21,7 @@ export class RosterAdminMutation {
|
||||
const logger = new ConsoleLogger();
|
||||
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
||||
|
||||
this.service = new LeagueService(apiClient);
|
||||
this.service = new LeagueService();
|
||||
}
|
||||
|
||||
async approveJoinRequest(leagueId: string, joinRequestId: string): Promise<Result<void, string>> {
|
||||
|
||||
@@ -22,7 +22,7 @@ export class ScheduleAdminMutation {
|
||||
const logger = new ConsoleLogger();
|
||||
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
||||
|
||||
this.service = new LeagueService(apiClient);
|
||||
this.service = new LeagueService();
|
||||
}
|
||||
|
||||
async publishSchedule(leagueId: string, seasonId: string): Promise<Result<void, string>> {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class StewardingMutation {
|
||||
const logger = new ConsoleLogger();
|
||||
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
||||
|
||||
this.service = new LeagueService(apiClient);
|
||||
this.service = new LeagueService();
|
||||
}
|
||||
|
||||
async applyPenalty(input: {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class WalletMutation {
|
||||
const logger = new ConsoleLogger();
|
||||
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
||||
|
||||
this.service = new LeagueService(apiClient);
|
||||
this.service = new LeagueService();
|
||||
}
|
||||
|
||||
async withdraw(leagueId: string, amount: number): Promise<Result<void, string>> {
|
||||
|
||||
Reference in New Issue
Block a user