260326:1455 Fixing Refactor ADR-019 Naming convention uuid #02
This commit is contained in:
@@ -100,20 +100,18 @@ export class ContractService {
|
|||||||
return contract;
|
return contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOneByPublicId(publicId: string) {
|
async findOneByUuid(uuid: string) {
|
||||||
const contract = await this.contractRepo.findOne({
|
const contract = await this.contractRepo.findOne({
|
||||||
where: { publicId },
|
where: { publicId: uuid },
|
||||||
relations: ['project'],
|
relations: ['project'],
|
||||||
});
|
});
|
||||||
if (!contract)
|
if (!contract)
|
||||||
throw new NotFoundException(
|
throw new NotFoundException(`Contract with UUID ${uuid} not found`);
|
||||||
`Contract with publicId ${publicId} not found`
|
|
||||||
);
|
|
||||||
return contract;
|
return contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(publicId: string, dto: UpdateContractDto) {
|
async update(publicId: string, dto: UpdateContractDto) {
|
||||||
const contract = await this.findOneByPublicId(publicId);
|
const contract = await this.findOneByUuid(publicId);
|
||||||
if (dto.projectId) {
|
if (dto.projectId) {
|
||||||
dto.projectId = await this.uuidResolver.resolveProjectId(dto.projectId);
|
dto.projectId = await this.uuidResolver.resolveProjectId(dto.projectId);
|
||||||
}
|
}
|
||||||
@@ -122,7 +120,7 @@ export class ContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async remove(publicId: string) {
|
async remove(publicId: string) {
|
||||||
const contract = await this.findOneByPublicId(publicId);
|
const contract = await this.findOneByUuid(publicId);
|
||||||
return this.contractRepo.remove(contract);
|
return this.contractRepo.remove(contract);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user