feat: add generated code

This commit is contained in:
aid-orchestrator
2026-04-25 16:21:27 +00:00
parent 1f60aca20b
commit dfe34e3f91
84 changed files with 2468 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CategoryResource, Prisma } from '@prisma/client';
@Injectable()
export class CategoryResourceService {
constructor(private prisma: PrismaService) {}
async findAll(params: {
skip?: number;
take?: number;
where?: Prisma.CategoryResourceWhereInput;
orderBy?: Prisma.CategoryResourceOrderByWithRelationInput;
}): Promise<{ data: CategoryResource[]; total: number }> {
const { skip, take, where, orderBy } = params;
const [data, total] = await this.prisma.$transaction([
this.prisma.categoryResource.findMany({
skip,
take,
where,
orderBy,
include: {
part: true,
employee: true,
},
}),
this.prisma.categoryResource.count({ where }),
]);
return { data, total };
}
async findOne(where: Prisma.CategoryResourceWhereUniqueInput): Promise<CategoryResource | null> {
return this.prisma.categoryResource.findUnique({
where,
include: {
part: true,
employee: true,
},
});
}
async create(data: Prisma.CategoryResourceCreateInput): Promise<CategoryResource> {
return this.prisma.categoryResource.create({
data,
include: {
part: true,
employee: true,
},
});
}
async update(params: {
where: Prisma.CategoryResourceWhereUniqueInput;
data: Prisma.CategoryResourceUpdateInput;
}): Promise<CategoryResource> {
return this.prisma.categoryResource.update({
...params,
include: {
part: true,
employee: true,
},
});
}
async remove(where: Prisma.CategoryResourceWhereUniqueInput): Promise<CategoryResource> {
return this.prisma.categoryResource.delete({
where,
include: {
part: true,
employee: true,
},
});
}
}