ucap-doc/documents/업무/2월/3째주/file-viewer-prj/video-conference.event-json.ts
2020-02-21 09:35:58 +09:00

34 lines
930 B
TypeScript

import { EventJsonDecoder } from './event-json';
import { JsonAnalization } from '@ucap-webmessenger/api';
import { VideoConferenceContentsType } from '@ucap-webmessenger/protocol-event';
export interface VideoConferenceEventJson {
conferenceSeq?: number;
title?: string;
contents?: VideoConferenceContentsType;
startDate?: string;
endDate?: string;
register?: string;
attendee?: string;
}
export const decodeVideoConferenceEventJson: EventJsonDecoder<VideoConferenceEventJson> = (
message: string
) => {
try {
const json = JsonAnalization.receiveAnalization(message);
return {
conferenceSeq: Number(json.confSeq),
title: json.title,
contents: json.contents,
startDate: json.startDate,
endDate: json.endDate,
register: json.register,
attendee: json.attendee
} as VideoConferenceEventJson;
} catch (e) {
return {} as VideoConferenceEventJson;
}
};