Some checks failed
Anatid Blog CI Workflow / test (./backend) (push) Failing after 39s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 30s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Has been skipped
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Has been skipped
Anatid Blog CI Workflow / deploy (push) Has been skipped
25 lines
585 B
TypeScript
25 lines
585 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { User } from './user.entity';
|
|
|
|
@Injectable()
|
|
export class UsersService {
|
|
constructor(
|
|
@InjectRepository(User)
|
|
private usersRepository: Repository<User>,
|
|
) {}
|
|
|
|
findAll(): Promise<User[]> {
|
|
return this.usersRepository.find();
|
|
}
|
|
|
|
findOne(id: number): Promise<User | null> {
|
|
return this.usersRepository.findOneBy({ id });
|
|
}
|
|
|
|
async remove(id: number): Promise<void> {
|
|
await this.usersRepository.delete(id);
|
|
}
|
|
}
|