Compare commits
No commits in common. "3216fd00f601f1f1674b01b27defaa0aa024a696" and "489184b8412b63ccd035a96e256fff81eca8c7ed" have entirely different histories.
3216fd00f6
...
489184b841
@ -84,20 +84,6 @@ export class TasksController {
|
|||||||
return this.tasksService.findOneById(id);
|
return this.tasksService.findOneById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation({ summary: 'Get tasks by project ID' })
|
|
||||||
@ApiParam({ name: 'projectId', type: 'number' })
|
|
||||||
@ApiResponse({
|
|
||||||
status: 200,
|
|
||||||
description: 'List of tasks for the specified project',
|
|
||||||
type: Task,
|
|
||||||
isArray: true,
|
|
||||||
})
|
|
||||||
@Get('project/:projectId')
|
|
||||||
async findByProject(@Param('projectId') projectId: number): Promise<Task[]> {
|
|
||||||
return this.tasksService.findByProjectId(projectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation({ summary: 'Update task' })
|
@ApiOperation({ summary: 'Update task' })
|
||||||
@ApiParam({ name: 'id', type: 'number' })
|
@ApiParam({ name: 'id', type: 'number' })
|
||||||
@ApiBody({
|
@ApiBody({
|
||||||
|
|||||||
@ -42,13 +42,6 @@ export class TasksService {
|
|||||||
return this.tasksRepository.findOne({ where: { id } });
|
return this.tasksRepository.findOne({ where: { id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async findByProjectId(projectId: number): Promise<Task[]> {
|
|
||||||
return this.tasksRepository.find({
|
|
||||||
where: { project: { id: projectId } },
|
|
||||||
relations: ['assigned_user'], // Загружаем связанные данные о назначенном пользователе
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async update(id: number, data: { title?: string; status?: string; deadline?: Date; assignedUserId?: number }) {
|
async update(id: number, data: { title?: string; status?: string; deadline?: Date; assignedUserId?: number }) {
|
||||||
const task = await this.findOneById(id);
|
const task = await this.findOneById(id);
|
||||||
if (!task) throw new NotFoundException('Task not found');
|
if (!task) throw new NotFoundException('Task not found');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user