adding entities for taskmanager
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { TMWorkspace } from "../entities/workspace.entity";
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceRepository {
|
||||
constructor(
|
||||
@InjectRepository(TMWorkspace)
|
||||
private readonly repository: Repository<TMWorkspace>,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
return this.repository.find({
|
||||
relations: ["workspaceType", "projects", "users"],
|
||||
});
|
||||
}
|
||||
|
||||
findOneById(id: string) {
|
||||
return this.repository.findOne({
|
||||
where: { id },
|
||||
relations: ["workspaceType", "projects", "users"],
|
||||
});
|
||||
}
|
||||
|
||||
create(data: Partial<TMWorkspace>) {
|
||||
return this.repository.create(data);
|
||||
}
|
||||
|
||||
save(workspace: TMWorkspace) {
|
||||
return this.repository.save(workspace);
|
||||
}
|
||||
|
||||
update(id: string, data: Partial<TMWorkspace>) {
|
||||
return this.repository.update(id, data);
|
||||
}
|
||||
|
||||
delete(id: string) {
|
||||
return this.repository.delete(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user