Merged in feat/LOY-232-DTMC-API-INTEGRATION (pull request #2454)
feat(LOY-232): DTMC API Integration * feat(LOY-232): DTMC API Integration * feat(LOY-232): use employment data in team member card * refactor(LOY-232): remove static data, return employment details in parsed response & fix tests * refactor(LOY-232): improve DTMC API Linking error control flow + make res type safe * fix(LOY-232): remove unused utils * fix(LOY-232): error vars Approved-by: Christian Andolf Approved-by: Erik Tiekstra
This commit is contained in:
@@ -221,6 +221,10 @@ export namespace endpoints {
|
||||
*/
|
||||
export namespace Profile {
|
||||
export const profile = `${base.path.profile}/${version}/${base.enitity.Profile}`
|
||||
|
||||
export function teamMemberCard(employeeId: string) {
|
||||
return `${profile}/${employeeId}/TeamMemberCard`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,15 @@ const pointExpirationSchema = z.object({
|
||||
expires: z.string(),
|
||||
})
|
||||
|
||||
export const employmentDetailsSchema = z
|
||||
.object({
|
||||
employeeId: z.string(),
|
||||
location: z.string(),
|
||||
country: z.string(),
|
||||
retired: z.boolean(),
|
||||
})
|
||||
.optional()
|
||||
|
||||
export const userLoyaltySchema = z.object({
|
||||
memberships: z.array(membershipSchema),
|
||||
points: z.object({
|
||||
@@ -102,6 +111,7 @@ export const getUserSchema = z
|
||||
.optional()
|
||||
.nullable(),
|
||||
loyalty: userLoyaltySchema.optional(),
|
||||
employmentDetails: employmentDetailsSchema,
|
||||
}),
|
||||
type: z.string(),
|
||||
}),
|
||||
|
||||
@@ -223,12 +223,13 @@ export function parsedUser(data: User, isMFA: boolean) {
|
||||
},
|
||||
dateOfBirth: data.dateOfBirth,
|
||||
email: data.email,
|
||||
employmentDetails: data.employmentDetails,
|
||||
firstName: data.firstName,
|
||||
language: data.language,
|
||||
lastName: data.lastName,
|
||||
loyalty: data.loyalty,
|
||||
membershipNumber: data.membershipNumber,
|
||||
membership: data.loyalty ? getFriendsMembership(data.loyalty) : null,
|
||||
loyalty: data.loyalty,
|
||||
name: `${data.firstName} ${data.lastName}`,
|
||||
phoneNumber: data.phoneNumber,
|
||||
profileId: data.profileId,
|
||||
|
||||
Reference in New Issue
Block a user