forked from Yara724/api
lookup vehicle-kinds added
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user