well deserved clean up (#1)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-03-18 21:53:07 +01:00
parent 3a8404f704
commit b7513f24d5
106 changed files with 453 additions and 1275 deletions

View File

@@ -129,7 +129,7 @@ export async function getProfilesByExternalId(
export type IServiceProfile = Omit<
IClickhouseProfile,
'max_created_at' | 'properties'
'max_created_at' | 'properties' | 'first_name' | 'last_name'
> & {
firstName: string;
lastName: string;
@@ -169,12 +169,14 @@ export interface IServiceUpsertProfile {
function transformProfile({
max_created_at,
first_name,
last_name,
...profile
}: IClickhouseProfile): IServiceProfile {
return {
...profile,
firstName: profile.first_name,
lastName: profile.last_name,
firstName: first_name,
lastName: last_name,
properties: toObject(profile.properties),
createdAt: new Date(max_created_at),
};
@@ -216,3 +218,8 @@ export async function upsertProfile({
],
});
}
export function getProfileName(profile: IServiceProfile | undefined | null) {
if (!profile) return 'No name';
return [profile.firstName, profile.lastName].filter(Boolean).join(' ');
}