36 lines
1.9 KiB
TypeScript
36 lines
1.9 KiB
TypeScript
import {PerformanceFull, UserCompact} from "@/types/gwcf";
|
|
|
|
export const toNotificationParamValue = (value: unknown) => value == null ? "" : String(value);
|
|
|
|
export const buildUserMsgParam = (user: UserCompact): Record<string, string> => ({
|
|
...Object.fromEntries(
|
|
Object.entries(user.userDetail ?? {}).map(([key, value]) => [key, toNotificationParamValue(value)])
|
|
),
|
|
userId: toNotificationParamValue(user.userId),
|
|
userCmpn: toNotificationParamValue(user.userCmpn),
|
|
userTeam: toNotificationParamValue(user.userTeam),
|
|
userName: toNotificationParamValue(user.userName),
|
|
userRole: toNotificationParamValue(user.userRole),
|
|
});
|
|
|
|
export const buildPerformanceSmsParams = (performance: PerformanceFull): Record<string, string> => ({
|
|
businessType: toNotificationParamValue(performance.businessType),
|
|
performanceGenre: toNotificationParamValue(performance.performanceGenre),
|
|
performanceArea: toNotificationParamValue(performance.performanceArea),
|
|
artistName: toNotificationParamValue(performance.artistName),
|
|
performanceName: toNotificationParamValue(performance.performanceName),
|
|
performanceStartMonth: toNotificationParamValue(performance.performanceStartMonth),
|
|
performanceDtInfo: toNotificationParamValue(performance.performanceDtInfo),
|
|
performanceTimeInfo: toNotificationParamValue(performance.performanceTimeInfo),
|
|
ticketReservationStatus: toNotificationParamValue(performance.ticketReservationStatus),
|
|
ticketReservationMemo: toNotificationParamValue(performance.ticketReservationMemo),
|
|
performanceMemo: toNotificationParamValue(performance.performanceMemo),
|
|
...Object.fromEntries(
|
|
Object.entries(performance.performanceDetail ?? {}).map(([key, value]) => [key, toNotificationParamValue(value)])
|
|
),
|
|
...Object.fromEntries(
|
|
Object.entries(performance.performanceMonitoringSchedule ?? {}).map(([key, value]) => [key, toNotificationParamValue(value)])
|
|
),
|
|
performanceId: toNotificationParamValue(performance.id),
|
|
});
|