22 lines
549 B
TypeScript
22 lines
549 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { PrismaService } from '../../prisma/prisma.service';
|
|
|
|
@Injectable()
|
|
export class ModelsService {
|
|
constructor(private prisma: PrismaService) {}
|
|
|
|
async findAll(params: { featured?: boolean }) {
|
|
const where: any = { status: 'ACTIVE' };
|
|
if (params.featured) where.isFeatured = true;
|
|
|
|
return this.prisma.aiModel.findMany({
|
|
where,
|
|
orderBy: { sortOrder: 'asc' },
|
|
});
|
|
}
|
|
|
|
async findById(id: number) {
|
|
return this.prisma.aiModel.findUnique({ where: { id } });
|
|
}
|
|
}
|