import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';

@Injectable()
export class ServiceStandardsService {
  constructor(private prisma: PrismaService) {}

  async findAll() {
    return this.prisma.serviceStandard.findMany({ orderBy: { orderNo: 'asc' } });
  }

  async create(data: { title: string; content: string; orderNo?: number }) {
    return this.prisma.serviceStandard.create({ data });
  }

  async update(id: number, data: { title?: string; content?: string; orderNo?: number }) {
    return this.prisma.serviceStandard.update({ where: { id }, data });
  }

  async remove(id: number) {
    return this.prisma.serviceStandard.delete({ where: { id } });
  }
}
