Files
noahspan-root/api/src/project/project.service.ts
2025-02-17 07:52:50 -06:00

39 lines
1.1 KiB
TypeScript

import { InjectRepository, Repository } from '@noahspan/azure-database';
import { Injectable } from '@nestjs/common';
import { Project } from './project.entity';
import { v4 as uuidv4 } from 'uuid';
@Injectable()
export class ProjectService {
constructor(
@InjectRepository(Project)
private readonly projectRepository: Repository<Project>
) {}
async find(partitionKey: string, rowKey: string): Promise<Project> {
return await this.projectRepository.find(partitionKey, rowKey);
}
async findAll(): Promise<Project[]> {
return await this.projectRepository.findAll();
}
async create(project: Project): Promise<Project> {
project.partitionKey = 'project';
return await this.projectRepository.create(project);
}
async update(
partitionKey: string,
rowKey: string,
project: Project
): Promise<Project> {
return await this.projectRepository.update(partitionKey, rowKey, project);
}
async delete(partitionKey: string, rowKey: string): Promise<void> {
await this.projectRepository.delete(partitionKey, rowKey);
}
}