fanavaran stage by stage implemented i am so bored to send smart commit sorry MR sina

This commit is contained in:
2026-07-01 15:13:22 +03:30
parent 99c819caeb
commit 67471fb9ce
16 changed files with 2366 additions and 146 deletions

View File

@@ -1,5 +1,10 @@
import { Controller, Get } from "@nestjs/common";
import { ApiOkResponse, ApiTags } from "@nestjs/swagger";
import { Controller, Get, Param } from "@nestjs/common";
import {
ApiOkResponse,
ApiOperation,
ApiParam,
ApiTags,
} from "@nestjs/swagger";
import { LookupsService } from "./lookups.service";
@ApiTags("lookups")
@@ -96,9 +101,113 @@ export class LookupsController {
return await this.lookupsService.getAccidentCulpritType();
}
@Get("inspection-place")
@ApiOperation({
summary: "Fanavaran GEN.08 inspection place lookup",
description:
"Returns values for expertise payload field InspectionPlaceId from car/code-list/inspection-place.",
})
@ApiOkResponse({
description: "Returns Fanavaran inspection place lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getInspectionPlace() {
return await this.lookupsService.getInspectionPlace();
}
@Get("drop-amount-status")
@ApiOperation({
summary: "Fanavaran GEN.08 drop amount status lookup",
description:
"Returns values for expertise payload field DropAmountStatus from car/code-list/drop-amount-status.",
})
@ApiOkResponse({
description: "Returns Fanavaran drop amount status lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getDropAmountStatus() {
return await this.lookupsService.getDropAmountStatus();
}
@Get("car-components")
@ApiOperation({
summary: "Fanavaran GEN.08 damaged section lookup",
description:
"Returns values for DmgSections[].DmgSectionId from car/base-info/car-components.",
})
@ApiOkResponse({
description: "Returns Fanavaran car component lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getCarComponents() {
return await this.lookupsService.getCarComponents();
}
@Get("accident-level")
@ApiOperation({
summary: "Fanavaran GEN.08 accident level lookup",
description:
"Returns values for DmgSections[].AccidentLevel from car/code-list/accident-level.",
})
@ApiOkResponse({
description: "Returns Fanavaran accident level lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getAccidentLevel() {
return await this.lookupsService.getAccidentLevel();
}
@Get("expert-status")
@ApiOperation({
summary: "Fanavaran GEN.08 expert status lookup",
description:
"Returns values for expertise response field Status from car/code-list/expert-status.",
})
@ApiOkResponse({
description: "Returns Fanavaran expert status lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getExpertStatus() {
return await this.lookupsService.getExpertStatus();
}
@Get("fanavaran")
@ApiOperation({
summary: "List configured Fanavaran remote lookups",
description:
"Returns the lookup names available through /lookups/fanavaran/{lookupName}.",
})
async listFanavaranRemoteLookups() {
return this.lookupsService.listFanavaranRemoteLookups().map((lookup) => ({
name: lookup.name,
cacheFile: lookup.cacheFile,
url: lookup.url,
}));
}
@Get("fanavaran/:lookupName")
@ApiOperation({
summary: "Fetch a Fanavaran remote lookup by name",
description:
"Generic cached Fanavaran lookup fetcher for configured lookup names, including GEN.08 expertise lookups.",
})
@ApiParam({
name: "lookupName",
description:
"Configured Fanavaran lookup name, for example inspection-place, drop-amount-status, car-components, accident-level, expert-status",
})
@ApiOkResponse({
description: "Returns cached or live Fanavaran lookup data",
schema: { type: "array", items: { type: "object" } },
})
async getFanavaranRemoteLookup(@Param("lookupName") lookupName: string) {
return await this.lookupsService.getClientRemoteLookup(lookupName);
}
@Get("accident-way")
@ApiOkResponse({
description: "Returns accident way options for the add-accident-fields step",
description:
"Returns accident way options for the add-accident-fields step",
schema: {
type: "array",
items: {
@@ -205,4 +314,3 @@ export class LookupsController {
return await this.lookupsService.getAccidentFields();
}
}