Refactor code structure for improved readability and maintainability
This commit is contained in:
17
src/project/project.service.ts
Normal file
17
src/project/project.service.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { Project } from "./entities/project.entity";
|
||||
|
||||
@Injectable()
|
||||
export class ProjectService {
|
||||
constructor(
|
||||
@InjectRepository(Project)
|
||||
private readonly projectRepository: Repository<Project>
|
||||
) {}
|
||||
|
||||
create(name: string) {
|
||||
const project = this.projectRepository.create({ name });
|
||||
return this.projectRepository.save(project);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user