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