/opt/mawid/apps/api/src/clinic
Edit: /opt/mawid/apps/api/src/clinic/clinic.service.ts (798B)
import { Injectable, NotFoundException } from '@nestjs/common';
import type { UpdateClinicInput } from '@mawid/shared';
import { PrismaService } from '../prisma/prisma.service';
@Injectable()
export class ClinicService {
constructor(private readonly prisma: PrismaService) {}
async get(clinicId: string) {
const clinic = await this.prisma.clinic.findUnique({ where: { id: clinicId } });
if (!clinic) throw new NotFoundException('Clinic not found');
return clinic;
}
async update(clinicId: string, input: UpdateClinicInput) {
await this.get(clinicId);
// workingHours and settings are replaced wholesale, not deep-merged —
// the dashboard always submits the complete object.
return this.prisma.clinic.update({ where: { id: clinicId }, data: input });
}
}