forked from Yara724/api
Enforce claim beneficiary access and retire unused legacy APIs
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
export interface PlateType {
|
||||
nationalCodeOfInsurer: string;
|
||||
userId: string;
|
||||
leftDigits: number;
|
||||
centerAlphabet: string;
|
||||
centerDigits: number;
|
||||
ir: number;
|
||||
}
|
||||
@@ -19,7 +19,9 @@ export class PlatesService {
|
||||
async addPlate(currentUser, body: AddPlateDto) {
|
||||
const { plate, nationalCodeOfInsurer } = body;
|
||||
|
||||
const normalizedAlphabet = this.plateNormalizer.normalizePlateText(String(plate.centerAlphabet || ""));
|
||||
const normalizedAlphabet = this.plateNormalizer.normalizePlateText(
|
||||
String(plate.centerAlphabet || ""),
|
||||
);
|
||||
const duplicate = await this.plateDbService.findOne({
|
||||
userId: currentUser,
|
||||
leftDigits: plate.leftDigits,
|
||||
@@ -45,28 +47,6 @@ export class PlatesService {
|
||||
};
|
||||
}
|
||||
|
||||
private async checkUniquePlate(plate): Promise<boolean> {
|
||||
const {
|
||||
userId,
|
||||
leftDigits,
|
||||
centerAlphabet,
|
||||
centerDigits,
|
||||
ir,
|
||||
nationalCodeOfInsurer,
|
||||
} = plate;
|
||||
|
||||
const found = await this.plateDbService.findOne({
|
||||
leftDigits,
|
||||
centerAlphabet,
|
||||
centerDigits,
|
||||
userId,
|
||||
nationalCodeOfInsurer,
|
||||
ir,
|
||||
});
|
||||
|
||||
return !found;
|
||||
}
|
||||
|
||||
async deletePlate(id: Types.ObjectId) {
|
||||
const deleted = await this.plateDbService.findAndRemove(id);
|
||||
if (!deleted) throw new NotFoundException("Plate not found");
|
||||
|
||||
Reference in New Issue
Block a user