lookup vehicle-kinds added

This commit is contained in:
2026-09-28 17:09:45 +03:30
parent efef48d824
commit 7a8d96ab52
10 changed files with 614 additions and 10 deletions
+53 -1
View File
@@ -283,7 +283,7 @@ export class LookupsController {
@ApiOperation({
summary: "Fanavaran GEN.12 vehicle kind lookup",
description:
"Returns values for damage case payload field VehicleKindId from car/base-info/vehicle-kinds.",
"Returns all vehicle kinds and upserts them into the Mongo `vehicle-kinds` collection (refreshed at least weekly).",
})
@ApiOkResponse({
description: "Returns Fanavaran vehicle kinds lookup data",
@@ -293,6 +293,58 @@ export class LookupsController {
return await this.lookupsService.getVehicleKinds();
}
@Get("vehicle-list")
@ApiOperation({
summary: "Search active vehicle kinds for UI typeahead",
description:
"Searches Mongo `vehicle-kinds` by Caption (IsActive=1 only). " +
"Pass the exact current input as `q` on every keystroke. " +
"The response always echoes `q` — ignore a response when `response.q !== currentInput` " +
"so out-of-order network replies cannot paint a one-letter-behind list.",
})
@ApiQuery({
name: "q",
required: false,
description: "Caption substring (Persian/English). Echoed back in the response.",
example: "ول",
})
@ApiQuery({
name: "limit",
required: false,
description: "Max rows (1–100, default 50)",
example: 50,
})
@ApiOkResponse({
description: "Matched active vehicle kinds with echoed query",
schema: {
type: "object",
properties: {
q: { type: "string", example: "ول" },
count: { type: "number", example: 12 },
items: {
type: "array",
items: {
type: "object",
properties: {
Id: { type: "number" },
Caption: { type: "string" },
IsActive: { type: "number", example: 1 },
},
},
},
},
},
})
async getVehicleList(
@Query("q") q?: string,
@Query("limit") limit?: string,
) {
return await this.lookupsService.searchVehicleKindsList({
q,
limit: limit != null && limit !== "" ? Number(limit) : undefined,
});
}
@Get("person-role")
@ApiOperation({
summary: "Fanavaran person role lookup",