78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
|
import {
|
||
|
ProtocolDecoder,
|
||
|
ProtocolMessage,
|
||
|
BodyStringDivider,
|
||
|
decodeProtocolMessage,
|
||
|
ProtocolResponse
|
||
|
} from '@ucap-webmessenger/protocol';
|
||
|
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
|
||
|
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||
|
import {
|
||
|
UserInfoSS,
|
||
|
DataUserResponse
|
||
|
} from '@ucap-webmessenger/protocol-query';
|
||
|
|
||
|
// export interface UserInfoSSForDaesang extends UserInfoSS {
|
||
|
// /****** For daesang ******/
|
||
|
// /** 사업장 */
|
||
|
// workplace: string;
|
||
|
// /** 담당업무 */
|
||
|
// responsibilities: string;
|
||
|
// /** 업무 상태 */
|
||
|
// workstatus: string;
|
||
|
// }
|
||
|
|
||
|
// export interface DataUserResponse extends ProtocolResponse {
|
||
|
// // DivCD(s)
|
||
|
// divCd: string;
|
||
|
// // {사용자정보-SS}
|
||
|
// userInfo?: UserInfoSS;
|
||
|
// }
|
||
|
|
||
|
export const decodeDataUser: ProtocolDecoder<DataUserResponse> = (
|
||
|
message: ProtocolMessage
|
||
|
) => {
|
||
|
let userInfo: UserInfoSS;
|
||
|
if (message.bodyList.length > 1) {
|
||
|
const info = message.bodyList[1].split(BodyStringDivider);
|
||
|
userInfo = {
|
||
|
seq: Number(info[0]),
|
||
|
name: info[1],
|
||
|
profileImageFile: info[2],
|
||
|
grade: info[3],
|
||
|
intro: info[4],
|
||
|
companyCode: info[5],
|
||
|
hpNumber: info[6],
|
||
|
lineNumber: info[7],
|
||
|
email: info[8],
|
||
|
isMobile: info[9] === 'Y' ? true : false,
|
||
|
deptName: info[10],
|
||
|
order: info[11],
|
||
|
isActive: info[12] === 'Y' ? true : false,
|
||
|
roleCd: info[13] as RoleCode,
|
||
|
employeeNum: info[14],
|
||
|
madn: info[15],
|
||
|
hardSadn: info[16],
|
||
|
fmcSadn: info[17],
|
||
|
callMode: info[18],
|
||
|
nameEn: info[19],
|
||
|
nameCn: info[20],
|
||
|
gradeEn: info[21],
|
||
|
gradeCn: info[22],
|
||
|
deptNameEn: info[23],
|
||
|
deptNameCn: info[24],
|
||
|
deptSeq: info[25],
|
||
|
isPrivacyAgree: info[26] === 'Y' ? true : false,
|
||
|
isValidLogin: info[27] === 'Y' ? true : false,
|
||
|
employeeType: info[28] as EmployeeType,
|
||
|
workplace: info[29],
|
||
|
responsibilities: info[30],
|
||
|
workstatus: info[31]
|
||
|
};
|
||
|
}
|
||
|
return decodeProtocolMessage(message, {
|
||
|
divCd: message.bodyList[0],
|
||
|
userInfo
|
||
|
} as DataUserResponse);
|
||
|
};
|