commit
7b999a670c
243 files changed
+24818
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { ISSUE_REPOSITORY, type IIssueRepository } from '../../../domain/repositories/issue.repository.interface.js';
|
||||
import { IssueNotFoundException } from '../../../domain/exceptions/issue-not-found.exception.js';
|
||||
import { GetIssueQuery } from './get-issue.query.js';
|
||||
import { IssueWithUsersDto } from '../../dto/issue-with-users.dto.js';
|
||||
import { IssueUserExpanderService } from '../../services/issue-user-expander.service.js';
|
||||
|
||||
@Injectable()
|
||||
export class GetIssueUseCase {
|
||||
constructor(
|
||||
@Inject(ISSUE_REPOSITORY)
|
||||
private readonly issueRepository: IIssueRepository,
|
||||
private readonly issueUserExpander: IssueUserExpanderService,
|
||||
) {}
|
||||
|
||||
async execute(query: GetIssueQuery): Promise<IssueWithUsersDto> {
|
||||
const issue = await this.issueRepository.findById(query.id, query.userId);
|
||||
|
||||
if (!issue) {
|
||||
throw new IssueNotFoundException(query.id);
|
||||
}
|
||||
|
||||
return this.issueUserExpander.expand(issue);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user