2026-05-09 18:25:04 +08:00
|
|
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
|
|
|
import { FocusItemsRepository } from './focus-items.repository';
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class FocusItemsService {
|
|
|
|
|
constructor(private readonly repository: FocusItemsRepository) {}
|
|
|
|
|
|
2026-05-17 19:08:07 +08:00
|
|
|
async findAll(userId: string, pagination?: { page?: number; limit?: number }) {
|
|
|
|
|
return this.repository.findAll(userId, pagination);
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 00:39:46 +08:00
|
|
|
async create(userId: string, dto: any) {
|
|
|
|
|
return this.repository.create({ userId, ...dto });
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 00:39:46 +08:00
|
|
|
async update(id: string, dto: any) {
|
|
|
|
|
return this.repository.update(id, dto);
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 00:39:46 +08:00
|
|
|
async complete(id: string) {
|
|
|
|
|
return this.repository.update(id, {
|
2026-05-09 18:25:04 +08:00
|
|
|
status: 'completed',
|
|
|
|
|
completedAt: new Date(),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|