refactor: removed unnecessary methods from checkListItem repo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, MoreThan } from 'typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { TMCheckListItem } from '../entities/check-list-item.entity';
|
||||
|
||||
@Injectable()
|
||||
@@ -10,38 +10,4 @@ export class CheckListItemRepository extends Repository<TMCheckListItem>{
|
||||
) {
|
||||
super(checkListItemRepository.target, checkListItemRepository.manager, checkListItemRepository.queryRunner);
|
||||
}
|
||||
|
||||
findAllItems(limit: number, cursor?: Date) {
|
||||
return this.findAndCount({
|
||||
where: cursor ? { createdAt: MoreThan(cursor) } : {},
|
||||
order: { createdAt: 'ASC' },
|
||||
take: limit + 1,
|
||||
relations: ['task'],
|
||||
});
|
||||
}
|
||||
|
||||
findByTask(taskId: string, limit: number, cursor?: Date) {
|
||||
return this.findAndCount({
|
||||
where: cursor
|
||||
? { taskId, createdAt: MoreThan(cursor) }
|
||||
: { taskId },
|
||||
order: { createdAt: 'ASC' },
|
||||
take: limit + 1,
|
||||
relations: ['task'],
|
||||
});
|
||||
}
|
||||
|
||||
findOneById(id: string) {
|
||||
return this.findOne({
|
||||
where: { id },
|
||||
relations: ['task'],
|
||||
});
|
||||
}
|
||||
|
||||
findOneByCreatedAt(createdAt: Date) {
|
||||
return this.findOne({
|
||||
where: { createdAt },
|
||||
order: { createdAt: 'ASC' },
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user