UserInfo for Login is added
This commit is contained in:
parent
3ab7ed7aad
commit
2fe33a4c4f
|
@ -0,0 +1,51 @@
|
|||
import { RoleCode } from '../types/role-code';
|
||||
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
|
||||
|
||||
export interface UserInfo {
|
||||
/** 사용자SEQ */
|
||||
seq: number;
|
||||
/** 사용자명 */
|
||||
name: string;
|
||||
/** 사진파일 */
|
||||
profileImageFile: string;
|
||||
/** 직급 */
|
||||
grade: string;
|
||||
/** 업무소개 */
|
||||
intro: string;
|
||||
/** 기관코드 */
|
||||
companyCode: string;
|
||||
/** 핸드폰번호 */
|
||||
hpNumber: string;
|
||||
/** 내선번호 */
|
||||
lineNumber: string;
|
||||
/** 이메일 */
|
||||
email: string;
|
||||
/** 모바일YN */
|
||||
isMobile: boolean;
|
||||
/** 부서명 */
|
||||
deptName: string;
|
||||
/** 조회순서 */
|
||||
selectOrder: number;
|
||||
/** ActiveYN */
|
||||
isActive: boolean;
|
||||
/** 역할코드 */
|
||||
roleCd: RoleCode;
|
||||
/** 사번 */
|
||||
employeeNum: string;
|
||||
/** 사용자명(영어) */
|
||||
nameEn: string;
|
||||
/** 사용자명(중국어) */
|
||||
nameCn: string;
|
||||
/** 직급(영어) */
|
||||
gradeEn: string;
|
||||
/** 직급(중국어) */
|
||||
gradeCn: string;
|
||||
/** 부서명(영어) */
|
||||
deptNameEn: string;
|
||||
/** 부서명(중국어) */
|
||||
deptNameCn: string;
|
||||
/** 임직원유형(s) */
|
||||
employeeType: EmployeeType;
|
||||
/** 국내임직원여부(s) */
|
||||
inDomestic: boolean;
|
||||
}
|
|
@ -6,10 +6,13 @@ import {
|
|||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { SSOMode } from '../types/sso-mode';
|
||||
import { RoleCode } from '../types/role-code';
|
||||
import { UserInfo } from '../models/user-info';
|
||||
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
|
||||
|
||||
export interface LoginRequest extends ProtocolRequest {
|
||||
// 0. LoginID(s)
|
||||
|
@ -55,7 +58,7 @@ export interface LoginRequest extends ProtocolRequest {
|
|||
export interface LoginResponse extends ProtocolResponse {
|
||||
loginId: string;
|
||||
userSeq: number;
|
||||
userInfo: string;
|
||||
userInfo: UserInfo;
|
||||
token: number;
|
||||
companyCode: string;
|
||||
departmentCode: number;
|
||||
|
@ -88,6 +91,36 @@ export interface LoginResponse extends ProtocolResponse {
|
|||
havePermissionsForDevice: boolean;
|
||||
}
|
||||
|
||||
const decodeUserInfo = (encodedValue: string) => {
|
||||
const info = encodedValue.split(BodyStringDivider);
|
||||
|
||||
return {
|
||||
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],
|
||||
selectOrder: Number(info[11]),
|
||||
isActive: info[12] === 'Y' ? true : false,
|
||||
roleCd: Number(info[13]) as RoleCode,
|
||||
employeeNum: info[14],
|
||||
nameEn: info[15],
|
||||
nameCn: info[16],
|
||||
gradeEn: info[17],
|
||||
gradeCn: info[18],
|
||||
deptNameEn: info[19],
|
||||
deptNameCn: info[20],
|
||||
employeeType: info[21] as EmployeeType,
|
||||
inDomestic: info[22] === 'Y' ? true : false
|
||||
} as UserInfo;
|
||||
};
|
||||
|
||||
export const encodeLogin: ProtocolEncoder<LoginRequest> = (
|
||||
req: LoginRequest
|
||||
) => {
|
||||
|
@ -129,7 +162,7 @@ export const decodeLogin: ProtocolDecoder<LoginResponse> = (
|
|||
return {
|
||||
loginId: message.bodyList[0],
|
||||
userSeq: message.bodyList[1],
|
||||
userInfo: message.bodyList[2],
|
||||
userInfo: decodeUserInfo(message.bodyList[2]),
|
||||
token: message.bodyList[3],
|
||||
companyCode: message.bodyList[4],
|
||||
departmentCode: message.bodyList[5],
|
||||
|
|
Loading…
Reference in New Issue
Block a user