integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m50s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m50s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -11,15 +11,26 @@ export class ApproveMembershipRequestUseCase {
|
||||
) {}
|
||||
|
||||
async execute(command: ApproveMembershipRequestCommand): Promise<void> {
|
||||
// TODO: Implement approve membership request logic
|
||||
// This is a placeholder implementation
|
||||
// In a real implementation, this would:
|
||||
// 1. Validate the league exists
|
||||
// 2. Validate the admin has permission to approve
|
||||
// 3. Find the pending request
|
||||
// 4. Add the driver to the league as a member
|
||||
// 5. Remove the pending request
|
||||
// 6. Emit appropriate events
|
||||
throw new Error('ApproveMembershipRequestUseCase not implemented');
|
||||
const league = await this.leagueRepository.findById(command.leagueId);
|
||||
if (!league) {
|
||||
throw new Error('League not found');
|
||||
}
|
||||
|
||||
const requests = await this.leagueRepository.getPendingRequests(command.leagueId);
|
||||
const request = requests.find(r => r.id === command.requestId);
|
||||
if (!request) {
|
||||
throw new Error('Request not found');
|
||||
}
|
||||
|
||||
await this.leagueRepository.addLeagueMembers(command.leagueId, [
|
||||
{
|
||||
driverId: request.driverId,
|
||||
name: request.name,
|
||||
role: 'member',
|
||||
joinDate: new Date(),
|
||||
},
|
||||
]);
|
||||
|
||||
await this.leagueRepository.removePendingRequest(command.leagueId, command.requestId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user