feat: added workspace-type repository
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { TMWorkspaceType } from "../entities/workspace-type.entity";
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceTypeRepository {
|
||||
constructor(
|
||||
@InjectRepository(TMWorkspaceType)
|
||||
private readonly repository: Repository<TMWorkspaceType>,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
return this.repository.find({
|
||||
order: { order: "ASC" },
|
||||
});
|
||||
}
|
||||
|
||||
findOneById(id: string) {
|
||||
return this.repository.findOne({ where: { id } });
|
||||
}
|
||||
|
||||
findOneByName(name: string) {
|
||||
return this.repository.findOne({ where: { name } });
|
||||
}
|
||||
|
||||
create(data: Partial<TMWorkspaceType>) {
|
||||
return this.repository.create(data);
|
||||
}
|
||||
|
||||
save(workspaceType: TMWorkspaceType) {
|
||||
return this.repository.save(workspaceType);
|
||||
}
|
||||
|
||||
update(id: string, data: Partial<TMWorkspaceType>) {
|
||||
return this.repository.update(id, data);
|
||||
}
|
||||
|
||||
delete(id: string) {
|
||||
return this.repository.delete(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user