location default changed

This commit is contained in:
2026-11-11 14:39:55 +03:30
parent 658a8a74cc
commit 5d84b9697f
3 changed files with 1224 additions and 1220 deletions
File diff suppressed because it is too large Load Diff
+37 -37
View File
@@ -1,9 +1,9 @@
export type FanavaranClientKey = "parsian" | "tejaratno" | "moallem";
export type FanavaranClientKey = 'parsian' | 'tejaratno' | 'moallem';
const FANAVARAN_API_ROOTS: Record<FanavaranClientKey, string> = {
parsian: "https://apimanager.iraneit.com/BimeApiManager/api",
tejaratno: "https://apimanager.iraneit.com/BimeApiManager/api",
moallem: "https://apimanager.iraneit.com/BimeApiManager/api",
parsian: 'https://apimanager.iraneit.com/BimeApiManager/api',
tejaratno: 'https://apimanager.iraneit.com/BimeApiManager/api',
moallem: 'https://apimanager.iraneit.com/BimeApiManager/api',
};
export function getFanavaranApiRoot(clientKey: FanavaranClientKey): string {
@@ -17,9 +17,9 @@ export function getFanavaranLookupBaseUrl(
}
export const FANAVARAN_CLIENT_KEYS: readonly FanavaranClientKey[] = [
"parsian",
"tejaratno",
"moallem",
'parsian',
'tejaratno',
'moallem',
] as const;
/** Swagger `@ApiParam({ enum })` value — keep in sync with {@link FANAVARAN_CLIENT_KEYS}. */
@@ -40,7 +40,7 @@ export function normalizeFanavaranClientKey(value: string): FanavaranClientKey {
return normalized;
}
throw new Error(
`Invalid Fanavaran client "${value}". Expected one of: ${FANAVARAN_CLIENT_KEYS.join(", ")}`,
`Invalid Fanavaran client "${value}". Expected one of: ${FANAVARAN_CLIENT_KEYS.join(', ')}`,
);
}
@@ -126,15 +126,15 @@ export const SEED_FANAVARAN_CLIENT_PROFILES: Record<
FanavaranClientProfile
> = {
tejaratno: {
key: "tejaratno",
key: 'tejaratno',
auth: {
appName: "fanhab",
secret: "5Fa@N#A2B",
username: "fanhabUser",
password: "Fan#@2U$3er",
corpId: "3539",
contractId: "263",
location: "100",
appName: 'fanhab',
secret: '5Fa@N#A2B',
username: 'fanhabUser',
password: 'Fan#@2U$3er',
corpId: '3539',
contractId: '263',
location: '100',
},
defaults: {
...SHARED_FANAVARAN_DEFAULTS,
@@ -146,15 +146,15 @@ export const SEED_FANAVARAN_CLIENT_PROFILES: Record<
},
},
parsian: {
key: "parsian",
key: 'parsian',
auth: {
appName: "ParsianService",
secret: "P@r30@n$erv!ce",
username: "ParsianServiceUser",
password: "P@r30@n123",
corpId: "543",
contractId: "28",
location: "210050",
appName: 'ParsianService',
secret: 'P@r30@n$erv!ce',
username: 'ParsianServiceUser',
password: 'P@r30@n123',
corpId: '543',
contractId: '28',
location: '110011',
},
defaults: {
...SHARED_FANAVARAN_DEFAULTS,
@@ -168,15 +168,15 @@ export const SEED_FANAVARAN_CLIENT_PROFILES: Record<
},
},
moallem: {
key: "moallem",
key: 'moallem',
auth: {
appName: "ItTalie",
secret: "itT@l!3@api",
username: "itTalieUser",
password: "itT@l!3@user",
corpId: "5650",
contractId: "304",
location: "1",
appName: 'ItTalie',
secret: 'itT@l!3@api',
username: 'itTalieUser',
password: 'itT@l!3@user',
corpId: '5650',
contractId: '304',
location: '1',
},
defaults: {
...SHARED_FANAVARAN_DEFAULTS,
@@ -217,11 +217,11 @@ export function resolveFanavaranClientKey(): FanavaranClientKey {
}
// Optional deployment hint when FANAVARAN_CLIENT is not set.
if (String(process.env.CLIENT_ID ?? "") === "8") {
return "parsian";
if (String(process.env.CLIENT_ID ?? '') === '8') {
return 'parsian';
}
return "tejaratno";
return 'tejaratno';
}
export function resolveFanavaranClientProfile(): FanavaranClientProfile {
@@ -239,10 +239,10 @@ export function getFanavaranClientProfile(
/** ثالث uses `contractId`. بدنه uses `hullContractId` when configured. */
export function resolveFanavaranProductContractId(
clientKey: FanavaranClientKey,
product: "third-party" | "car-body",
product: 'third-party' | 'car-body',
): string {
const profile = getFanavaranClientProfile(clientKey);
if (product === "car-body") {
if (product === 'car-body') {
const hull = profile.auth.hullContractId?.trim();
if (hull) return hull;
}
@@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional, OmitType } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
IsArray,
IsEmail,
@@ -10,20 +10,20 @@ import {
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
import { RoleEnum } from "src/Types&Enums/role.enum";
import { UserType } from "src/Types&Enums/userType.enum";
} from 'class-validator';
import { RoleEnum } from 'src/Types&Enums/role.enum';
import { UserType } from 'src/Types&Enums/userType.enum';
export class ExpertLocationDto {
@ApiProperty({
example: "210050",
description: "Fanavaran Location / OpBUId",
example: '110011',
description: 'Fanavaran Location / OpBUId',
})
@IsString()
@IsNotEmpty()
id: string;
@ApiProperty({ example: "شعبه غرب" })
@ApiProperty({ example: 'شعبه غرب' })
@IsString()
@IsNotEmpty()
name: string;
@@ -36,62 +36,62 @@ export class CreateInsurerExpertDto {
@Matches(/^\d+$/)
expertCode?: string;
@ApiPropertyOptional({ description: "کارشناس مسئول پرونده مالی" })
@ApiPropertyOptional({ description: 'کارشناس مسئول پرونده مالی' })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
ThirdPartyClaimExpertId?: string;
@ApiPropertyOptional({ description: "کارشناس مسئول پرونده بدنه" })
@ApiPropertyOptional({ description: 'کارشناس مسئول پرونده بدنه' })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
CarBodyClaimExpertId?: string;
@ApiPropertyOptional({ description: "کارشناس ارزیاب خسارت ثالث مالی" })
@ApiPropertyOptional({ description: 'کارشناس ارزیاب خسارت ثالث مالی' })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
ThirdPartyExpertiseClaim?: string;
@ApiPropertyOptional({ description: "کارشناس ارزیاب خسارت بدنه" })
@ApiPropertyOptional({ description: 'کارشناس ارزیاب خسارت بدنه' })
@IsOptional()
@IsString()
@Matches(/^\d+$/)
CarBodyExpertiseClaim?: string;
@ApiProperty({ example: "Ali" })
@ApiProperty({ example: 'Ali' })
@IsString()
@IsNotEmpty()
firstName: string;
@ApiProperty({ example: "Ahmadi" })
@ApiProperty({ example: 'Ahmadi' })
@IsString()
@IsNotEmpty()
lastName: string;
@ApiProperty({ example: "1234567890" })
@ApiProperty({ example: '1234567890' })
@IsString()
@IsNotEmpty()
nationalCode: string;
@ApiProperty({ example: "expert@example.com" })
@ApiProperty({ example: 'expert@example.com' })
@IsEmail()
email: string;
@ApiProperty({ example: "StrongPass!123" })
@ApiProperty({ example: 'StrongPass!123' })
@IsString()
@IsNotEmpty()
password: string;
@ApiProperty({ example: "09121234567" })
@ApiProperty({ example: '09121234567' })
@IsString()
@IsNotEmpty()
mobile: string;
@ApiProperty({
example: "665f0e5ab74d670939b08920",
description: "Branch id this expert belongs to",
example: '665f0e5ab74d670939b08920',
description: 'Branch id this expert belongs to',
})
@IsMongoId()
branchId: string;
@@ -101,22 +101,22 @@ export class CreateInsurerExpertDto {
@IsEnum(UserType)
userType?: UserType;
@ApiPropertyOptional({ example: "02112345678" })
@ApiPropertyOptional({ example: '02112345678' })
@IsOptional()
@IsString()
phone?: string;
@ApiPropertyOptional({ example: "Tehran" })
@ApiPropertyOptional({ example: 'Tehran' })
@IsOptional()
@IsString()
state?: string;
@ApiPropertyOptional({ example: "Tehran" })
@ApiPropertyOptional({ example: 'Tehran' })
@IsOptional()
@IsString()
city?: string;
@ApiPropertyOptional({ example: "No. 12, Sample St." })
@ApiPropertyOptional({ example: 'No. 12, Sample St.' })
@IsOptional()
@IsString()
address?: string;
@@ -124,7 +124,7 @@ export class CreateInsurerExpertDto {
@ApiPropertyOptional({
type: [ExpertLocationDto],
description:
"Fanavaran Location entries (id = OpBUId). Sent as the HTTP Location header on Fanavaran business calls for this expert.",
'Fanavaran Location entries (id = OpBUId). Sent as the HTTP Location header on Fanavaran business calls for this expert.',
})
@IsOptional()
@IsArray()
@@ -151,7 +151,7 @@ export class CreateClaimExpertByInsurerDto extends CreateInsurerExpertDto {
export class CreateFileMakerByInsurerDto extends OmitType(
CreateInsurerExpertDto,
["ThirdPartyExpertiseClaim", "CarBodyExpertiseClaim"] as const,
['ThirdPartyExpertiseClaim', 'CarBodyExpertiseClaim'] as const,
) {
@ApiPropertyOptional({
enum: [RoleEnum.FILE_MAKER],
@@ -162,7 +162,7 @@ export class CreateFileMakerByInsurerDto extends OmitType(
export class CreateFileReviewerByInsurerDto extends OmitType(
CreateInsurerExpertDto,
["ThirdPartyClaimExpertId", "CarBodyClaimExpertId"] as const,
['ThirdPartyClaimExpertId', 'CarBodyClaimExpertId'] as const,
) {
@ApiPropertyOptional({
enum: [RoleEnum.FILE_REVIEWER],