forked from Yara724/api
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { ExpertModel } from "src/users/entities/schema/expert.schema";
|
|
import { DamageExpertModel } from "src/users/entities/schema/damage-expert.schema";
|
|
import { ExpertProfileSnapshot } from "src/request-management/entities/schema/expert-profile-snapshot.schema";
|
|
|
|
export function snapshotFromFieldExpert(
|
|
doc: ExpertModel | null | undefined,
|
|
): ExpertProfileSnapshot | undefined {
|
|
if (!doc) return undefined;
|
|
return {
|
|
firstName: doc.firstName ?? undefined,
|
|
lastName: doc.lastName ?? undefined,
|
|
email: doc.email ?? undefined,
|
|
insuActivityCo: doc.insuActivityCo ?? undefined,
|
|
mobile: (doc.mobile ?? doc.phone) ?? undefined,
|
|
};
|
|
}
|
|
|
|
export function snapshotFromDamageExpert(
|
|
doc: DamageExpertModel | null | undefined,
|
|
): ExpertProfileSnapshot | undefined {
|
|
if (!doc) return undefined;
|
|
return {
|
|
firstName: doc.firstName ?? undefined,
|
|
lastName: doc.lastName ?? undefined,
|
|
email: doc.email ?? undefined,
|
|
insuActivityCo: doc.insuActivityCo ?? undefined,
|
|
mobile: doc.mobile ?? undefined,
|
|
};
|
|
}
|