fix(injection): findUnique 改为 findFirst 避免命名唯一索引类型错误
Prisma @@unique 单字段命名索引 uk_adoption_id 的 TypeScript 类型 与 findUnique where 输入不兼容(TS2322)。改用 findFirst + where 字段查询,走同一个唯一索引,性能相同。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1baed76d8e
commit
126169c631
|
|
@ -43,8 +43,8 @@ export class AdoptionInjectionRecordRepositoryImpl implements IAdoptionInjection
|
|||
}
|
||||
|
||||
async findByAdoptionId(adoptionId: string): Promise<AdoptionInjectionRecordDto | null> {
|
||||
const record = await this.prisma.adoptionInjectionRecord.findUnique({
|
||||
where: { uk_adoption_id: { adoptionId } },
|
||||
const record = await this.prisma.adoptionInjectionRecord.findFirst({
|
||||
where: { adoptionId },
|
||||
});
|
||||
return record ? this.mapToDto(record) : null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue