forked from Yara724/api
fanavaran V15 tejaratno
This commit is contained in:
@@ -671,7 +671,7 @@ export class LookupsController {
|
||||
description:
|
||||
"Generic cached Fanavaran lookup fetcher. Configured names use their catalogue URL; " +
|
||||
"unlisted slugs (e.g. vehicle-groups) fall back to car/base-info/{lookupName}. " +
|
||||
"TejaratNo notifier-type and notifier-relation use the supplied local tenant codebooks without a remote fetch.",
|
||||
"TejaratNo notifier-type and notifier-relation are read from the lookups collection and are not fetched from Fanavaran.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "lookupName",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tejaratNotifierLookup } from "src/fanavaran/tejarat-notifier";
|
||||
import { isTejaratNotifierLookup } from "src/fanavaran/tejarat-notifier";
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
@@ -126,12 +126,15 @@ export class LookupsService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
async getClientRemoteLookup(lookupName: string): Promise<unknown> {
|
||||
const clientKey = this.activeClientKey();
|
||||
const notifier = tejaratNotifierLookup(lookupName);
|
||||
if (notifier) {
|
||||
if (isTejaratNotifierLookup(lookupName)) {
|
||||
if (clientKey !== "tejaratno") {
|
||||
throw new BadRequestException("Notifier lookups apply only to TejaratNo.");
|
||||
}
|
||||
return notifier;
|
||||
const stored = await this.fanavaranLookupService.readStoredLookup(lookupName);
|
||||
if (stored == null) {
|
||||
throw new NotFoundException(`Lookup "${lookupName}" not found`);
|
||||
}
|
||||
return stored;
|
||||
}
|
||||
const definition = this.findRemoteLookup(lookupName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user