Compare commits
3 commits
main
...
lazygit-te
Author | SHA1 | Date | |
---|---|---|---|
ef7c5f2750 | |||
bcea5099bc | |||
e11aa4c751 |
1 changed files with 22 additions and 17 deletions
|
@ -5,25 +5,30 @@ import { Cat } from "./cats.entity";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CatsService {
|
export class CatsService {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectRepository(Cat)
|
@InjectRepository(Cat)
|
||||||
private catsRepository: Repository<Cat>,
|
private catsRepository: Repository<Cat>,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
private readonly logger = new Logger(CatsService.name);
|
private readonly logger = new Logger(CatsService.name);
|
||||||
|
|
||||||
findAll(): Promise<Cat[]> {
|
findAll(): Promise<Cat[]> {
|
||||||
this.logger.log("[findAll] Starting...");
|
this.logger.log("[findAll] Starting...");
|
||||||
return this.catsRepository.find();
|
return this.catsRepository.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
findOne(id: number): Promise<Cat | null> {
|
findOne(id: number): Promise<Cat | null> {
|
||||||
this.logger.log("[findOne] Starting...");
|
this.logger.log("[findOne] Starting...");
|
||||||
return this.catsRepository.findOneBy({ id });
|
return this.catsRepository.findOneBy({ id });
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(id: number): Promise<void> {
|
async remove(id: number): Promise<void> {
|
||||||
this.logger.log("[remove] Starting...");
|
this.logger.log("[remove] Starting...");
|
||||||
await this.catsRepository.delete(id)
|
await this.catsRepository.delete(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazygitTest(): void {
|
||||||
|
this.logger.log("[lazygitTest] test no. 1")
|
||||||
|
this.logger.log("[lazygitTest] Test no. 2")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue