This commit is contained in:
병준 박 2019-09-25 17:26:27 +09:00
commit 6de48f83b4
22 changed files with 682 additions and 351 deletions

View File

@ -9,19 +9,17 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface BuddyAddRequest extends ProtocolRequest {
export interface AddRequest extends ProtocolRequest {
// 0n. 사용자SEQ(n)...
userSeqs: number[];
}
export interface BuddyAddResponse extends ProtocolResponse {
export interface AddResponse extends ProtocolResponse {
// 0n. 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
req: BuddyAddRequest
) => {
export const encodeAdd: ProtocolEncoder<AddRequest> = (req: AddRequest) => {
const bodyList: PacketBody[] = [];
for (const userSeq of req.userSeqs) {
@ -31,11 +29,11 @@ export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
return bodyList;
};
export const decodeBuddyAdd: ProtocolDecoder<BuddyAddResponse> = (
export const decodeAdd: ProtocolDecoder<AddResponse> = (
message: ProtocolMessage
) => {
const userSeqArray: number[] = [...message.bodyList];
return {
userSeqs: userSeqArray
} as BuddyAddResponse;
} as AddResponse;
};

View File

@ -9,19 +9,17 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface BuddyDelRequest extends ProtocolRequest {
export interface DelRequest extends ProtocolRequest {
// 0n. 사용자SEQ(n)...
userSeqs: number[];
}
export interface BuddyDelResponse extends ProtocolResponse {
export interface DelResponse extends ProtocolResponse {
// 0n. 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
req: BuddyDelRequest
) => {
export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
const bodyList: PacketBody[] = [];
for (const userSeq of req.userSeqs) {
@ -31,11 +29,11 @@ export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
return bodyList;
};
export const decodeBuddyDel: ProtocolDecoder<BuddyDelResponse> = (
export const decodeDel: ProtocolDecoder<DelResponse> = (
message: ProtocolMessage
) => {
const userSeqArray: number[] = [...message.bodyList];
return {
userSeqs: userSeqArray
} as BuddyDelResponse;
} as DelResponse;
};

View File

@ -9,22 +9,22 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface BuddyUpdateRequest extends ProtocolRequest {
export interface UpdateRequest extends ProtocolRequest {
// 0. 사용자SEQ(n)
seq: number;
// 1. 즐겨찾기여부(y)
isFavorit: boolean;
}
export interface BuddyUpdateResponse extends ProtocolResponse {
export interface UpdateResponse extends ProtocolResponse {
// 0. 사용자SEQ(n)
seq: number;
// 1. 즐겨찾기여부(y)
isFavorit: boolean;
}
export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
req: BuddyUpdateRequest
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
req: UpdateRequest
) => {
const bodyList: PacketBody[] = [];
@ -37,11 +37,11 @@ export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
return bodyList;
};
export const decodeBuddyUpdate: ProtocolDecoder<BuddyUpdateResponse> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage
) => {
return {
seq: message.bodyList[0],
isFavorit: message.bodyList[1] === 'Y' ? true : false
} as BuddyUpdateResponse;
} as UpdateResponse;
};

View File

@ -12,23 +12,13 @@ import {
SSVC_TYPE_BUDDY_UPD_REQ
} from '../types/service';
import { AddRequest, encodeAdd, decodeAdd, AddResponse } from '../models/add';
import { DelRequest, encodeDel, decodeDel, DelResponse } from '../models/del';
import {
BuddyAddRequest,
encodeBuddyAdd,
decodeBuddyAdd,
BuddyAddResponse
} from '../models/add';
import {
BuddyDelRequest,
encodeBuddyDel,
decodeBuddyDel,
BuddyDelResponse
} from '../models/del';
import {
BuddyUpdateRequest,
decodeBuddyUpdate,
encodeBuddyUpdate,
BuddyUpdateResponse
UpdateRequest,
decodeUpdate,
encodeUpdate,
UpdateResponse
} from '../models/update';
@Injectable({
@ -37,30 +27,30 @@ import {
export class BuddyProtocolService {
constructor(private protocolService: ProtocolService) {}
public buddyAdd(req: BuddyAddRequest): Observable<BuddyAddResponse> {
public add(req: AddRequest): Observable<AddResponse> {
return this.protocolService
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeBuddyAdd(req))
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeAdd(req))
.pipe(
take(1),
map(res => decodeBuddyAdd(res))
map(res => decodeAdd(res))
);
}
public buddyDel(req: BuddyDelRequest): Observable<BuddyDelResponse> {
public del(req: DelRequest): Observable<DelResponse> {
return this.protocolService
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeBuddyDel(req))
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeDel(req))
.pipe(
take(1),
map(res => decodeBuddyDel(res))
map(res => decodeDel(res))
);
}
public buddyUpdate(req: BuddyUpdateRequest): Observable<BuddyUpdateResponse> {
public update(req: UpdateRequest): Observable<UpdateResponse> {
return this.protocolService
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeBuddyUpdate(req))
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeUpdate(req))
.pipe(
take(1),
map(res => decodeBuddyUpdate(res))
map(res => decodeUpdate(res))
);
}
}

View File

@ -11,7 +11,7 @@ import {
import { EventType } from '../types/event.type';
import { PushStatus } from '../types/pushStatus.type';
export interface EventSendRequest extends ProtocolRequest {
export interface SendRequest extends ProtocolRequest {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1. 이벤트타입(s)
@ -20,7 +20,7 @@ export interface EventSendRequest extends ProtocolRequest {
sentMessage: string;
}
export interface EventSendResponse extends ProtocolResponse {
export interface SendResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 이벤트SEQ(n)
@ -41,7 +41,7 @@ export interface EventSendResponse extends ProtocolResponse {
senderName: string;
}
export interface EventSendNotification extends EventSendResponse {
export interface SendNotification extends SendResponse {
// 대화방SEQ(s)
// 이벤트SEQ(n)
// 이벤트타입(s)
@ -58,9 +58,7 @@ export interface EventSendNotification extends EventSendResponse {
companyCode?: string;
}
export const encodeEventSend: ProtocolEncoder<EventSendRequest> = (
req: EventSendRequest
) => {
export const encodeSend: ProtocolEncoder<SendRequest> = (req: SendRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push(
@ -72,7 +70,7 @@ export const encodeEventSend: ProtocolEncoder<EventSendRequest> = (
return bodyList;
};
export const decodeEventSend: ProtocolDecoder<EventSendResponse> = (
export const decodeSend: ProtocolDecoder<SendResponse> = (
message: ProtocolMessage
) => {
return {
@ -85,12 +83,12 @@ export const decodeEventSend: ProtocolDecoder<EventSendResponse> = (
pushStatus: message.bodyList[6] as PushStatus,
ForcedExitType: message.bodyList[7],
senderName: message.bodyList[8]
} as EventSendResponse;
} as SendResponse;
};
export const decodeEventSendNotification: ProtocolDecoder<
EventSendNotification
> = (message: ProtocolMessage) => {
export const decodeSendNotification: ProtocolDecoder<SendNotification> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0],
seq: message.bodyList[1],
@ -103,5 +101,5 @@ export const decodeEventSendNotification: ProtocolDecoder<
senderName: message.bodyList[8],
id: message.bodyList[9],
companyCode: message.bodyList[10]
} as EventSendNotification;
} as SendNotification;
};

View File

@ -21,11 +21,11 @@ import {
SSVC_TYPE_EVENT_SEND_REQ
} from '../types/service';
import {
EventSendRequest,
EventSendResponse,
decodeEventSend,
encodeEventSend
} from '../models/event-send';
SendRequest,
SendResponse,
decodeSend,
encodeSend
} from '../models/send';
@Injectable({
providedIn: 'root'
@ -53,13 +53,13 @@ export class EventProtocolService {
);
}
public eventSend(req: EventSendRequest): Observable<EventSendResponse> {
public send(req: SendRequest): Observable<SendResponse> {
return this.protocolService
.call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_SEND_REQ, ...encodeEventSend(req))
.call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_SEND_REQ, ...encodeSend(req))
.pipe(
take(1),
map(res => {
return decodeEventSend(res);
return decodeSend(res);
})
);
}

View File

@ -9,21 +9,19 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface GroupAddRequest extends ProtocolRequest {
export interface AddRequest extends ProtocolRequest {
// 0. 동료그룹이름
groupName: string;
}
export interface GroupAddResponse extends ProtocolResponse {
export interface AddResponse extends ProtocolResponse {
// 0: 동료그룹SEQ(n)
groupSeq: number;
// 1: 동료그룹이름(s)
groupName: string;
}
export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
req: GroupAddRequest
) => {
export const encodeAdd: ProtocolEncoder<AddRequest> = (req: AddRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.groupName });
@ -31,11 +29,11 @@ export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
return bodyList;
};
export const decodeGroupAdd: ProtocolDecoder<GroupAddResponse> = (
export const decodeAdd: ProtocolDecoder<AddResponse> = (
message: ProtocolMessage
) => {
return {
groupSeq: message.bodyList[0],
groupName: message.bodyList[1]
} as GroupAddResponse;
} as AddResponse;
};

View File

@ -9,19 +9,17 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface GroupDelRequest extends ProtocolRequest {
export interface DelRequest extends ProtocolRequest {
// 0: 동료그룹SEQ(n)
groupSeq: number;
}
export interface GroupDelResponse extends ProtocolResponse {
export interface DelResponse extends ProtocolResponse {
// 0: 동료그룹SEQ(n)
groupSeq: number;
}
export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
req: GroupDelRequest
) => {
export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.Integer, value: req.groupSeq });
@ -29,10 +27,10 @@ export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
return bodyList;
};
export const decodeGroupDel: ProtocolDecoder<GroupDelResponse> = (
export const decodeDel: ProtocolDecoder<DelResponse> = (
message: ProtocolMessage
) => {
return {
groupSeq: message.bodyList[0]
} as GroupDelResponse;
} as DelResponse;
};

View File

@ -9,7 +9,7 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface GroupUpdateRequest extends ProtocolRequest {
export interface UpdateRequest extends ProtocolRequest {
// 0: 동료그룹SEQ(n)
groupSeq: number;
// 1: 동료그룹이름(s)
@ -18,7 +18,7 @@ export interface GroupUpdateRequest extends ProtocolRequest {
userSeqs: number[];
}
export interface GroupUpdateResponse extends ProtocolResponse {
export interface UpdateResponse extends ProtocolResponse {
// 0: 동료그룹SEQ(n)
groupSeq: number;
// 1: 동료그룹이름(s)
@ -27,8 +27,8 @@ export interface GroupUpdateResponse extends ProtocolResponse {
userSeqs: number[];
}
export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
req: GroupUpdateRequest
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
req: UpdateRequest
) => {
const bodyList: PacketBody[] = [];
@ -41,7 +41,7 @@ export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
return bodyList;
};
export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage
) => {
let userSeqArray: number[] = [];
@ -53,11 +53,11 @@ export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
groupSeq: message.bodyList[0],
groupName: message.bodyList[1],
userSeqs: userSeqArray
} as GroupUpdateResponse;
} as UpdateResponse;
};
export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
req: GroupUpdateRequest
export const encodeUpdate2: ProtocolEncoder<UpdateRequest> = (
req: UpdateRequest
) => {
const bodyList: PacketBody[] = [];
@ -75,7 +75,7 @@ export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
return bodyList;
};
export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
export const decodeUpdate2: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage
) => {
let userSeqArray: number[] = [];
@ -87,5 +87,5 @@ export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
groupSeq: message.bodyList[0],
groupName: message.bodyList[1],
userSeqs: userSeqArray
} as GroupUpdateResponse;
} as UpdateResponse;
};

View File

@ -4,12 +4,6 @@ import { Observable } from 'rxjs';
import { map, take } from 'rxjs/operators';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import {
GroupAddRequest,
encodeGroupAdd,
decodeGroupAdd,
GroupAddResponse
} from '../models/add';
import {
SVC_TYPE_GROUP,
SSVC_TYPE_GROUP_ADD_REQ,
@ -17,19 +11,15 @@ import {
SSVC_TYPE_GROUP_UPD_REQ,
SSVC_TYPE_GROUP_UPD_REQ2
} from '../types/service';
import { AddRequest, encodeAdd, decodeAdd, AddResponse } from '../models/add';
import { DelRequest, encodeDel, decodeDel, DelResponse } from '../models/del';
import {
GroupDelRequest,
encodeGroupDel,
decodeGroupDel,
GroupDelResponse
} from '../models/del';
import {
GroupUpdateRequest,
encodeGroupUpdate,
decodeGroupUpdate,
encodeGroupUpdate2,
decodeGroupUpdate2,
GroupUpdateResponse
UpdateRequest,
encodeUpdate,
decodeUpdate,
encodeUpdate2,
decodeUpdate2,
UpdateResponse
} from '../models/update';
@Injectable({
providedIn: 'root'
@ -37,45 +27,39 @@ import {
export class GroupProtocolService {
constructor(private protocolService: ProtocolService) {}
public groupAdd(req: GroupAddRequest): Observable<GroupAddResponse> {
public add(req: AddRequest): Observable<AddResponse> {
return this.protocolService
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeGroupAdd(req))
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeAdd(req))
.pipe(
take(1),
map(res => decodeGroupAdd(res))
map(res => decodeAdd(res))
);
}
public groupDel(req: GroupDelRequest): Observable<GroupDelResponse> {
public del(req: DelRequest): Observable<DelResponse> {
return this.protocolService
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeGroupDel(req))
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeDel(req))
.pipe(
take(1),
map(res => decodeGroupDel(res))
map(res => decodeDel(res))
);
}
public groupUpdate(req: GroupUpdateRequest): Observable<GroupUpdateResponse> {
public update(req: UpdateRequest): Observable<UpdateResponse> {
return this.protocolService
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeGroupUpdate(req))
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeUpdate(req))
.pipe(
take(1),
map(res => decodeGroupUpdate(res))
map(res => decodeUpdate(res))
);
}
public groupUpdate2(
req: GroupUpdateRequest
): Observable<GroupUpdateResponse> {
public update2(req: UpdateRequest): Observable<UpdateResponse> {
return this.protocolService
.call(
SVC_TYPE_GROUP,
SSVC_TYPE_GROUP_UPD_REQ2,
...encodeGroupUpdate2(req)
)
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ2, ...encodeUpdate2(req))
.pipe(
take(1),
map(res => decodeGroupUpdate2(res))
map(res => decodeUpdate2(res))
);
}
}

View File

@ -0,0 +1,199 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
} from '@ucap-webmessenger/protocol';
import {
DeviceType,
FileTransferPermissions,
OrganizationChartPermissions,
DefaultScreen,
VideoConferenceType
} from '@ucap-webmessenger/core';
import { DeptType, DeptSearchType } from '../types/dept.type';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
export interface DeptUserRequest extends ProtocolRequest {
// DivCD(s)
divCd: string;
// 기관코드(s)
companyCode: string;
// 부서SEQ(n)
seq?: number;
// 검색string(s)
search?: string;
// 검색범위(s)
searchRange: DeptSearchType;
// 요청리스트(n) 사용안하면 0 최대 200
pageListCount?: number;
// 요청페이지(n) 사용안하면 0 처음은 1
pageCurrent?: number;
// 발신자회사코드(s)
senderCompanyCode: string;
// 발신자임직원유형(s)
senderEmployeeType: EmployeeType;
}
export interface UserInfoSS {
// 사용자SEQ
seq: number;
// 사용자명
name: string;
// 사진파일
profileImageFile: string;
// 직급
grade: string;
// 업무소개
intro: string;
// 기관코드
companyCode: string;
// 핸드폰번호
hpNumber: string;
// 내선번호
lineNumber: string;
// 이메일
email: string;
// 모바일YN
isMobile: boolean;
// 부서명
deptName: string;
// 조회순서
order: string;
// ActiveYN
isActive: boolean;
// 역할코드
roleCd: RoleCode;
// 사번
employeeNum: string;
// MADN
madn: string;
// HARDPHONE_SADN
hardSadn: string;
// FMC_SADN
fmcSadn: string;
// CALL_MODE
callMode: string;
// 사용자명(영어)
nameEn: string;
// 사용자명(중국어)
nameCn: string;
// 직급(영어)
gradeEn: string;
// 직급(중국어)
gradeCn: string;
// 부서명(영어)
deptNameEn: string;
// 부서명(중국어)
deptNameCn: string;
// 부서SEQ
deptSeq: number;
// 이용약관동의여부YN
isPrivacyAgree: boolean;
// 유효접속여부YN
isValidLogin: boolean;
// 임직원유형(s)
employeeType: EmployeeType;
}
export interface DeptUserData extends ProtocolStream {
// DivCD(s)
divCd: string;
// {부서정보-S}...
userInfos: UserInfoSS[];
}
export interface DeptUserResponse extends ProtocolResponse {
// DivCD(s)
divCd: string;
// 전체갯수(n)
pageTotalCount: number;
// 요청리스트(n)
pageListCount?: number;
// 페이지(n)
pageCurrent?: number;
}
export const encodeDeptUser: ProtocolEncoder<DeptUserRequest> = (
req: DeptUserRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.companyCode });
bodyList.push({ type: PacketBodyValue.Integer, value: req.seq || 0 });
bodyList.push({ type: PacketBodyValue.String, value: req.search || '' });
bodyList.push({ type: PacketBodyValue.String, value: req.searchRange });
bodyList.push({
type: PacketBodyValue.Integer,
value: req.pageListCount || 0
});
bodyList.push({ type: PacketBodyValue.Integer, value: req.pageCurrent || 0 });
bodyList.push({ type: PacketBodyValue.String, value: req.senderCompanyCode });
bodyList.push({
type: PacketBodyValue.String,
value: req.senderEmployeeType
});
return bodyList;
};
export const decodeDeptUserData: ProtocolDecoder<DeptUserData> = (
message: ProtocolMessage
) => {
const userInfos: UserInfoSS[] = [];
message.bodyList.slice(1).forEach(userInfo => {
const info = userInfo.split(BodyStringDivider);
let i = 0;
userInfos.push({
seq: info[i],
name: info[i++],
profileImageFile: info[i++],
grade: info[i++],
intro: info[i++],
companyCode: info[i++],
hpNumber: info[i++],
lineNumber: info[i++],
email: info[i++],
isMobile: info[i++] === 'Y' ? true : false,
deptName: info[i++],
order: info[i++],
isActive: info[i++] === 'Y' ? true : false,
roleCd: info[i++] as RoleCode,
employeeNum: info[i++],
madn: info[i++],
hardSadn: info[i++],
fmcSadn: info[i++],
callMode: info[i++],
nameEn: info[i++],
nameCn: info[i++],
gradeEn: info[i++],
gradeCn: info[i++],
deptNameEn: info[i++],
deptNameCn: info[i++],
deptSeq: info[i++],
isPrivacyAgree: info[i++] === 'Y' ? true : false,
isValidLogin: info[i++] === 'Y' ? true : false,
employeeType: info[i++] as EmployeeType
});
});
return {
divCd: message.bodyList[0],
userInfos
} as DeptUserData;
};
export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
pageTotalCount: message.bodyList[1],
pageListCount: message.bodyList[2],
pageCurrent: message.bodyList[3]
} as DeptUserResponse;
};

View File

@ -0,0 +1,95 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
} from '@ucap-webmessenger/protocol';
import { DeptType } from '../types/dept.type';
export interface DeptRequest extends ProtocolRequest {
// DivCD(s)
divCd: string;
// 기관코드(s)
companyCode: string;
}
export interface DeptInfo {
// 부서SEQ
seq: number;
// 부서명
name: string;
// 기관코드
companyCode: string;
// 부서타입
type: DeptType;
// 본부SEQ
rootSeq: number;
// 상위부서SEQ
parentSeq: number;
// 조회순서
order: string;
// 조회레벨
depth: number;
// ActiveYN
isActive: boolean;
// 부서명(영어)
nameEn: string;
// 부서명(중국어)
nameCn: string;
}
export interface DeptData extends ProtocolStream {
// DivCD(s)
divCd: string;
// {부서정보-S}...
departmentInfos: DeptInfo[];
}
export interface DeptResponse extends ProtocolResponse {
// DivCD(s)
divCd: string;
}
export const encodeDept: ProtocolEncoder<DeptRequest> = (req: DeptRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.companyCode });
return bodyList;
};
export const decodeDeptData: ProtocolDecoder<DeptData> = (
message: ProtocolMessage
) => {
const departmentInfos: DeptInfo[] = [];
message.bodyList.slice(1).forEach(deptInfo => {
const info = deptInfo.split(BodyStringDivider);
let i = 0;
departmentInfos.push({
seq: info[i],
name: info[i++],
companyCode: info[i++],
type: info[i++] as DeptType,
rootSeq: info[i++],
parentSeq: info[i++],
order: info[i++],
depth: info[i++],
isActive: info[i++] === 'Y' ? true : false,
nameEn: info[i++],
nameCn: info[i++]
});
});
return {
divCd: message.bodyList[0],
departmentInfos
} as DeptData;
};
export const decodeDept: ProtocolDecoder<DeptResponse> = (
message: ProtocolMessage
) => {
return { divCd: message.bodyList[0] } as DeptResponse;
};

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import { Observable } from 'rxjs';
import { take, map } from 'rxjs/operators';
import { take, map, takeWhile } from 'rxjs/operators';
import {
AuthRequest,
AuthResponse,
@ -10,8 +10,30 @@ import {
} from '../models/auth';
import {
SVC_TYPE_QUERY_DATA,
SSVC_TYPE_QUERY_AUTH_REQ
SSVC_TYPE_QUERY_AUTH_REQ,
SSVC_TYPE_QUERY_DEPT_REQ,
SSVC_TYPE_QUERY_DEPT_RES,
SSVC_TYPE_QUERY_DEPT_DATA,
SSVC_TYPE_QUERY_DEPT_USER_RES,
SSVC_TYPE_QUERY_DEPT_USER_DATA,
SSVC_TYPE_QUERY_DEPT_USER_REQ
} from '../types/service';
import {
DeptRequest,
DeptResponse,
encodeDept,
decodeDept,
decodeDeptData,
DeptData
} from '../models/dept';
import {
encodeDeptUser,
decodeDeptUser,
decodeDeptUserData,
DeptUserRequest,
DeptUserData,
DeptUserResponse
} from '../models/dept-user';
@Injectable({
providedIn: 'root'
@ -27,4 +49,48 @@ export class QueryProtocolService {
map(res => decodeAuth(res))
);
}
public dept(req: DeptRequest): Observable<DeptResponse | DeptData> {
return this.protocolService
.call(SVC_TYPE_QUERY_DATA, SSVC_TYPE_QUERY_DEPT_REQ, ...encodeDept(req))
.pipe(
takeWhile(res => SSVC_TYPE_QUERY_DEPT_RES !== res.subServiceType, true),
map(res => {
if (SSVC_TYPE_QUERY_DEPT_DATA === res.subServiceType) {
return { ...decodeDeptData(res), Type: SSVC_TYPE_QUERY_DEPT_DATA };
}
return { ...decodeDept(res), Type: SSVC_TYPE_QUERY_DEPT_RES };
})
);
}
public deptUser(
req: DeptUserRequest
): Observable<DeptUserResponse | DeptUserData> {
return this.protocolService
.call(
SVC_TYPE_QUERY_DATA,
SSVC_TYPE_QUERY_DEPT_USER_REQ,
...encodeDeptUser(req)
)
.pipe(
takeWhile(
res => SSVC_TYPE_QUERY_DEPT_USER_RES !== res.subServiceType,
true
),
map(res => {
if (SSVC_TYPE_QUERY_DEPT_USER_DATA === res.subServiceType) {
return {
...decodeDeptUserData(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_DATA
};
}
return {
...decodeDeptUser(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_RES
};
})
);
}
}

View File

@ -0,0 +1,19 @@
export enum DeptType {
// R: 기관Root
Root = 'R',
// D: 본부
Department = 'D',
// T: 부서
Team = 'T'
}
export enum DeptSearchType {
// A: 부서, 인원
All = 'A',
// U: 인원
User = 'U',
// D: 부서
Department = 'D',
// M: 다중부서 cf) 여러 부서(하위전체)를 쿼리할 때 1, 2, 3, 4..이렇게 부서SEQ들을, 로 연결해서 보냄 (검색string 필드를 사용함)
MultiDepartment = 'M'
}

View File

@ -3,9 +3,12 @@
*/
export * from './lib/models/auth';
export * from './lib/models/dept';
export * from './lib/models/dept-user';
export * from './lib/services/query-protocol.service';
export * from './lib/types/dept.type';
export * from './lib/types/service';
export * from './lib/ucap-query-protocol.module';

View File

@ -9,47 +9,45 @@ import {
} from '@ucap-webmessenger/protocol';
import { RoomExitType } from '../types/room.type';
export interface RoomExitRequest extends ProtocolRequest {
export interface ExitRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
}
export interface RoomExitResponse extends ProtocolResponse {
export interface ExitResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
}
export const encodeRoomExit: ProtocolEncoder<RoomExitRequest> = (
req: RoomExitRequest
) => {
export const encodeExit: ProtocolEncoder<ExitRequest> = (req: ExitRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
return bodyList;
};
export const decodeRoomExit: ProtocolDecoder<RoomExitResponse> = (
export const decodeExit: ProtocolDecoder<ExitResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomExitResponse;
} as ExitResponse;
};
export const decodeRoomExitNotification: ProtocolDecoder<RoomExitResponse> = (
export const decodeExitNotification: ProtocolDecoder<ExitResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomExitResponse;
} as ExitResponse;
};
export interface RoomExitAllRequest extends ProtocolRequest {
export interface ExitAllRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string[];
}
export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
req: RoomExitAllRequest
export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = (
req: ExitAllRequest
) => {
const bodyList: PacketBody[] = [];
@ -57,7 +55,7 @@ export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
return bodyList;
};
export interface RoomExitForcingRequest extends ProtocolRequest {
export interface ExitForcingRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 강퇴요청타입(s)
@ -68,7 +66,7 @@ export interface RoomExitForcingRequest extends ProtocolRequest {
userSeqs: number[];
}
export interface RoomExitForcingResponse extends ProtocolRequest {
export interface ExitForcingResponse extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 강퇴요청타입(s)
@ -79,8 +77,8 @@ export interface RoomExitForcingResponse extends ProtocolRequest {
userSeqs: number[];
}
export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
req: RoomExitForcingRequest
export const encodeExitForcing: ProtocolEncoder<ExitForcingRequest> = (
req: ExitForcingRequest
) => {
const bodyList: PacketBody[] = [];
@ -93,7 +91,7 @@ export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
return bodyList;
};
export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
export const decodeExitForcing: ProtocolDecoder<ExitForcingResponse> = (
message: ProtocolMessage
) => {
let userSeqs: number[] = [];
@ -105,10 +103,10 @@ export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2],
userSeqs
} as RoomExitForcingResponse;
} as ExitForcingResponse;
};
export const decodeRoomExitForcingNotification: ProtocolDecoder<
RoomExitForcingResponse
export const decodeExitForcingNotification: ProtocolDecoder<
ExitForcingResponse
> = (message: ProtocolMessage) => {
let userSeqs: number[] = [];
if (message.bodyList.length > 3) {
@ -119,5 +117,5 @@ export const decodeRoomExitForcingNotification: ProtocolDecoder<
type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2],
userSeqs
} as RoomExitForcingResponse;
} as ExitForcingResponse;
};

View File

@ -6,7 +6,8 @@ import {
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage,
BodyStringDivider
BodyStringDivider,
ProtocolStream
} from '@ucap-webmessenger/protocol';
import { LocaleCode } from '@ucap-webmessenger/core';
import { RoomType } from '../types/room.type';
@ -137,7 +138,7 @@ export interface UserInfo {
id: string;
}
export interface RoomInfoRequest extends ProtocolRequest {
export interface InfoRequest extends ProtocolRequest {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1. 상세정보여부(y)
@ -146,34 +147,32 @@ export interface RoomInfoRequest extends ProtocolRequest {
localeCode: LocaleCode;
}
export interface RoomInfoResponse extends ProtocolResponse {
export interface InfoResponse extends ProtocolResponse {
// 0. 대화방SEQ(s)
roomSeq: string;
}
export interface RoomInfoDataResponse extends ProtocolResponse {
export interface InfoData extends ProtocolStream {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1. {대화방정보}
roomInfo: RoomInfo;
}
export interface RoomUserShortDataResponse extends ProtocolResponse {
export interface UserShortData extends ProtocolStream {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1n. {참여자정보}
userInfos: UserInfoShort[];
}
export interface RoomUserDataResponse extends ProtocolResponse {
export interface UserData extends ProtocolStream {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1n. {참여자정보-D}
userInfos: UserInfo[];
}
export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
req: RoomInfoRequest
) => {
export const encodeInfo: ProtocolEncoder<InfoRequest> = (req: InfoRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
@ -186,15 +185,15 @@ export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
return bodyList;
};
export const decodeRoomInfo: ProtocolDecoder<RoomInfoResponse> = (
export const decodeInfo: ProtocolDecoder<InfoResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomInfoResponse;
} as InfoResponse;
};
export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
export const decodeInfoData: ProtocolDecoder<InfoData> = (
message: ProtocolMessage
) => {
let roomInfo: RoomInfo = null;
@ -222,12 +221,12 @@ export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
return {
roomSeq: message.bodyList[0],
roomInfo
} as RoomInfoDataResponse;
} as InfoData;
};
export const decodeRoomUserShortData: ProtocolDecoder<
RoomUserShortDataResponse
> = (message: ProtocolMessage) => {
export const decodeUserShortData: ProtocolDecoder<UserShortData> = (
message: ProtocolMessage
) => {
const userInfos: UserInfoShort[] = [];
message.bodyList.slice(1).forEach(userInfo => {
const info = userInfo.split(BodyStringDivider);
@ -252,10 +251,10 @@ export const decodeRoomUserShortData: ProtocolDecoder<
return {
roomSeq: message.bodyList[0],
userInfos
} as RoomUserShortDataResponse;
} as UserShortData;
};
export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
export const decodeUserData: ProtocolDecoder<UserData> = (
message: ProtocolMessage
) => {
const userInfos: UserInfo[] = [];
@ -298,30 +297,30 @@ export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
return {
roomSeq: message.bodyList[0],
userInfos
} as RoomUserDataResponse;
} as UserData;
};
export interface RoomUserStatusOfflineRequest extends ProtocolRequest {
export interface UserStatusOfflineRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
}
export interface RoomUserStatusOfflineResponse extends ProtocolResponse {
export interface UserStatusOfflineResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeRoomUserStatusOffline: ProtocolEncoder<
RoomUserStatusOfflineRequest
> = (req: RoomUserStatusOfflineRequest) => {
export const encodeUserStatusOffline: ProtocolEncoder<
UserStatusOfflineRequest
> = (req: UserStatusOfflineRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
return bodyList;
};
export const decodeRoomUserStatusOffline: ProtocolDecoder<
RoomUserStatusOfflineResponse
export const decodeUserStatusOffline: ProtocolDecoder<
UserStatusOfflineResponse
> = (message: ProtocolMessage) => {
let userSeqs: number[] = [];
if (message.bodyList.length > 1) {
@ -330,5 +329,5 @@ export const decodeRoomUserStatusOffline: ProtocolDecoder<
return {
roomSeq: message.bodyList[0],
userSeqs
} as RoomUserStatusOfflineResponse;
} as UserStatusOfflineResponse;
};

View File

@ -8,20 +8,20 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomInviteRequest extends ProtocolRequest {
export interface InviteRequest extends ProtocolRequest {
// 0. 대화방SEQ(s)
roomSeq: string;
// 1n. 초대자 userSeq(n)...
inviteUserSeqs: number[];
}
export interface RoomInviteResponse extends ProtocolResponse {
export interface InviteResponse extends ProtocolResponse {
// 0. 대화방SEQ(s)
roomSeq: string;
}
export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
req: RoomInviteRequest
export const encodeInvite: ProtocolEncoder<InviteRequest> = (
req: InviteRequest
) => {
const bodyList: PacketBody[] = [];
@ -33,18 +33,18 @@ export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
return bodyList;
};
export const decodeRoomInvite: ProtocolDecoder<RoomInviteResponse> = (
export const decodeInvite: ProtocolDecoder<InviteResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomInviteResponse;
} as InviteResponse;
};
export const decodeRoomInviteNotification: ProtocolDecoder<
RoomInviteResponse
> = (message: ProtocolMessage) => {
export const decodeInviteNotification: ProtocolDecoder<InviteResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomInviteResponse;
} as InviteResponse;
};

View File

@ -8,14 +8,14 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpenRequest extends ProtocolRequest {
export interface OpenRequest extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpenResponse extends ProtocolResponse {
export interface OpenResponse extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방SEQ(s)
@ -24,9 +24,7 @@ export interface RoomOpenResponse extends ProtocolResponse {
newRoom: boolean;
}
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
req: RoomOpenRequest
) => {
export const encodeOpen: ProtocolEncoder<OpenRequest> = (req: OpenRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
@ -37,17 +35,17 @@ export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
return bodyList;
};
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
export const decodeOpen: ProtocolDecoder<OpenResponse> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
roomSeq: message.bodyList[1],
newRoom: message.bodyList[2] === 'Y' ? true : false
} as RoomOpenResponse;
} as OpenResponse;
};
export interface RoomOpen2Request extends ProtocolRequest {
export interface Open2Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -56,7 +54,7 @@ export interface RoomOpen2Request extends ProtocolRequest {
userSeqs: number[];
}
export interface RoomOpen2Response extends ProtocolResponse {
export interface Open2Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -67,8 +65,8 @@ export interface RoomOpen2Response extends ProtocolResponse {
newRoom: boolean;
}
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
req: RoomOpen2Request
export const encodeOpen2: ProtocolEncoder<Open2Request> = (
req: Open2Request
) => {
const bodyList: PacketBody[] = [];
@ -81,7 +79,7 @@ export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
return bodyList;
};
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
export const decodeOpen2: ProtocolDecoder<Open2Response> = (
message: ProtocolMessage
) => {
return {
@ -89,10 +87,10 @@ export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
roomName: message.bodyList[1],
roomSeq: message.bodyList[2],
newRoom: message.bodyList[3] === 'Y' ? true : false
} as RoomOpen2Response;
} as Open2Response;
};
export interface RoomOpen3Request extends ProtocolRequest {
export interface Open3Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -105,7 +103,7 @@ export interface RoomOpen3Request extends ProtocolRequest {
userSeqs: number[];
}
export interface RoomOpen3Response extends ProtocolResponse {
export interface Open3Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -120,8 +118,8 @@ export interface RoomOpen3Response extends ProtocolResponse {
timerRoomInterval: number;
}
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
req: RoomOpen3Request
export const encodeOpen3: ProtocolEncoder<Open3Request> = (
req: Open3Request
) => {
const bodyList: PacketBody[] = [];
@ -142,7 +140,7 @@ export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
return bodyList;
};
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
export const decodeOpen3: ProtocolDecoder<Open3Response> = (
message: ProtocolMessage
) => {
return {
@ -152,10 +150,10 @@ export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
newRoom: message.bodyList[3] === 'Y' ? true : false,
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
timerRoomInterval: message.bodyList[5] || 0
} as RoomOpen3Response;
} as Open3Response;
};
export interface RoomOpen4Request extends ProtocolRequest {
export interface Open4Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -168,7 +166,7 @@ export interface RoomOpen4Request extends ProtocolRequest {
userSeqs: number[];
}
export interface RoomOpen4Response extends ProtocolResponse {
export interface Open4Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
@ -183,8 +181,8 @@ export interface RoomOpen4Response extends ProtocolResponse {
timerRoomInterval: number;
}
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
req: RoomOpen4Request
export const encodeOpen4: ProtocolEncoder<Open4Request> = (
req: Open4Request
) => {
const bodyList: PacketBody[] = [];
@ -205,7 +203,7 @@ export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
return bodyList;
};
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
export const decodeOpen4: ProtocolDecoder<Open4Response> = (
message: ProtocolMessage
) => {
return {
@ -216,5 +214,5 @@ export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
timerRoomInterval:
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
} as RoomOpen4Response;
} as Open4Response;
};

View File

@ -8,7 +8,7 @@ import {
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomUpdateRequest extends ProtocolRequest {
export interface UpdateRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 대화방제목(s)
@ -19,7 +19,7 @@ export interface RoomUpdateRequest extends ProtocolRequest {
isSyncAll: boolean;
}
export interface RoomUpdateResponse extends ProtocolResponse {
export interface UpdateResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 대화방제목(s)
@ -30,8 +30,8 @@ export interface RoomUpdateResponse extends ProtocolResponse {
isSyncAll: boolean;
}
export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
req: RoomUpdateRequest
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
req: UpdateRequest
) => {
const bodyList: PacketBody[] = [];
@ -48,7 +48,7 @@ export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
return bodyList;
};
export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage
) => {
return {
@ -56,26 +56,26 @@ export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
roomName: message.bodyList[1],
isAlarm: message.bodyList[2] === 'Y' ? true : false,
isSyncAll: message.bodyList[3] === 'Y' ? true : false
} as RoomUpdateResponse;
} as UpdateResponse;
};
export interface RoomUpdateTimerSetRequest extends ProtocolRequest {
export interface UpdateTimerSetRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 타이머시간(n)
timerInterval: number;
}
export interface RoomUpdateTimerSetResponse extends ProtocolResponse {
export interface UpdateTimerSetResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 타이머시간(n)
timerInterval: number;
}
export const encodeRoomUpdateTimerSet: ProtocolEncoder<
RoomUpdateTimerSetRequest
> = (req: RoomUpdateTimerSetRequest) => {
export const encodeUpdateTimerSet: ProtocolEncoder<UpdateTimerSetRequest> = (
req: UpdateTimerSetRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
@ -83,16 +83,16 @@ export const encodeRoomUpdateTimerSet: ProtocolEncoder<
return bodyList;
};
export const decodeRoomUpdateTimerSet: ProtocolDecoder<
RoomUpdateTimerSetResponse
> = (message: ProtocolMessage) => {
export const decodeUpdateTimerSet: ProtocolDecoder<UpdateTimerSetResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0],
timerInterval: message.bodyList[1] || 0
} as RoomUpdateTimerSetResponse;
} as UpdateTimerSetResponse;
};
export interface RoomUpdateFontRequest extends ProtocolRequest {
export interface UpdateFontRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 폰트색(s) cf)0x000000 형태의 스트링
@ -101,7 +101,7 @@ export interface RoomUpdateFontRequest extends ProtocolRequest {
senderSeq: number;
}
export interface RoomUpdateFontResponse extends ProtocolResponse {
export interface UpdateFontResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 폰트색(s) cf)0x000000 형태의 스트링
@ -110,8 +110,8 @@ export interface RoomUpdateFontResponse extends ProtocolResponse {
senderSeq: number;
}
export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
req: RoomUpdateFontRequest
export const encodeUpdateFont: ProtocolEncoder<UpdateFontRequest> = (
req: UpdateFontRequest
) => {
const bodyList: PacketBody[] = [];
@ -121,22 +121,22 @@ export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
return bodyList;
};
export const decodeRoomUpdateFont: ProtocolDecoder<RoomUpdateFontResponse> = (
export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0],
fontColor: message.bodyList[1],
senderSeq: message.bodyList[2]
} as RoomUpdateFontResponse;
} as UpdateFontResponse;
};
export const decodeRoomUpdateFontNotification: ProtocolDecoder<
RoomUpdateFontResponse
export const decodeUpdateFontNotification: ProtocolDecoder<
UpdateFontResponse
> = (message: ProtocolMessage) => {
return {
roomSeq: message.bodyList[0],
fontColor: message.bodyList[1],
senderSeq: message.bodyList[2]
} as RoomUpdateFontResponse;
} as UpdateFontResponse;
};

View File

@ -25,70 +25,70 @@ import {
SSVC_TYPE_ROOM_FONT_UPD_REQ
} from '../types/service';
import {
RoomOpenRequest,
encodeRoomOpen,
decodeRoomOpen,
RoomOpenResponse,
RoomOpen2Request,
RoomOpen2Response,
decodeRoomOpen2,
encodeRoomOpen2,
RoomOpen3Request,
RoomOpen3Response,
encodeRoomOpen3,
decodeRoomOpen3,
RoomOpen4Request,
RoomOpen4Response,
encodeRoomOpen4,
decodeRoomOpen4
OpenRequest,
encodeOpen,
decodeOpen,
OpenResponse,
Open2Request,
Open2Response,
decodeOpen2,
encodeOpen2,
Open3Request,
Open3Response,
encodeOpen3,
decodeOpen3,
Open4Request,
Open4Response,
encodeOpen4,
decodeOpen4
} from '../models/open';
import {
RoomInviteRequest,
RoomInviteResponse,
encodeRoomInvite,
decodeRoomInvite
InviteRequest,
InviteResponse,
encodeInvite,
decodeInvite
} from '../models/invite';
import {
RoomInfoRequest,
RoomInfoResponse,
RoomInfoDataResponse,
RoomUserShortDataResponse,
RoomUserDataResponse,
encodeRoomInfo,
decodeRoomInfoData,
decodeRoomInfo,
decodeRoomUserShortData,
decodeRoomUserData,
RoomUserStatusOfflineRequest,
RoomUserStatusOfflineResponse,
encodeRoomUserStatusOffline,
decodeRoomUserStatusOffline
InfoRequest,
InfoResponse,
InfoData,
UserShortData,
UserData,
encodeInfo,
decodeInfoData,
decodeInfo,
decodeUserShortData,
decodeUserData,
UserStatusOfflineRequest,
UserStatusOfflineResponse,
encodeUserStatusOffline,
decodeUserStatusOffline
} from '../models/info';
import {
RoomExitRequest,
RoomExitResponse,
encodeRoomExit,
decodeRoomExit,
RoomExitAllRequest,
encodeRoomAllExit,
RoomExitForcingRequest,
RoomExitForcingResponse,
encodeRoomExitForcing,
decodeRoomExitForcing
ExitRequest,
ExitResponse,
encodeExit,
decodeExit,
ExitAllRequest,
encodeAllExit,
ExitForcingRequest,
ExitForcingResponse,
encodeExitForcing,
decodeExitForcing
} from '../models/exit';
import {
RoomUpdateRequest,
RoomUpdateResponse,
encodeRoomUpdate,
decodeRoomUpdate,
RoomUpdateTimerSetRequest,
RoomUpdateTimerSetResponse,
encodeRoomUpdateTimerSet,
decodeRoomUpdateTimerSet,
RoomUpdateFontRequest,
RoomUpdateFontResponse,
encodeRoomUpdateFont,
decodeRoomUpdateFont
UpdateRequest,
UpdateResponse,
encodeUpdate,
decodeUpdate,
UpdateTimerSetRequest,
UpdateTimerSetResponse,
encodeUpdateTimerSet,
decodeUpdateTimerSet,
UpdateFontRequest,
UpdateFontResponse,
encodeUpdateFont,
decodeUpdateFont
} from '../models/update';
@Injectable({
@ -97,169 +97,159 @@ import {
export class RoomProtocolService {
constructor(private protocolService: ProtocolService) {}
public roomOpen(req: RoomOpenRequest): Observable<RoomOpenResponse> {
public open(req: OpenRequest): Observable<OpenResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeRoomOpen(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeOpen(req))
.pipe(
take(1),
map(res => decodeRoomOpen(res))
map(res => decodeOpen(res))
);
}
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
public open2(req: Open2Request): Observable<Open2Response> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeOpen2(req))
.pipe(
take(1),
map(res => decodeRoomOpen2(res))
map(res => decodeOpen2(res))
);
}
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
public open3(req: Open3Request): Observable<Open3Response> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeOpen3(req))
.pipe(
take(1),
map(res => decodeRoomOpen3(res))
map(res => decodeOpen3(res))
);
}
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
public open4(req: Open4Request): Observable<Open4Response> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeOpen4(req))
.pipe(
take(1),
map(res => decodeRoomOpen4(res))
map(res => decodeOpen4(res))
);
}
public roomInvite(req: RoomInviteRequest): Observable<RoomInviteResponse> {
public invite(req: InviteRequest): Observable<InviteResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeRoomInvite(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeInvite(req))
.pipe(
take(1),
map(res => decodeRoomInvite(res))
map(res => decodeInvite(res))
);
}
public roomInfo(
req: RoomInfoRequest
): Observable<
| RoomInfoResponse
| RoomInfoDataResponse
| RoomUserShortDataResponse
| RoomUserDataResponse
> {
public info(
req: InfoRequest
): Observable<InfoResponse | InfoData | UserShortData | UserData> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeInfo(req))
.pipe(
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true),
map(res => {
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
return decodeRoomInfoData(res);
return { ...decodeInfoData(res), Type: SSVC_TYPE_ROOM_INFO_ROOM };
} else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) {
return decodeRoomUserShortData(res);
return {
...decodeUserShortData(res),
Type: SSVC_TYPE_ROOM_INFO_USER
};
} else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) {
return decodeRoomUserData(res);
return { ...decodeUserData(res), Type: SSVC_TYPE_ROOM_INFO_USER2 };
}
return decodeRoomInfo(res);
return { ...decodeInfo(res), Type: SSVC_TYPE_ROOM_INFO_RES };
})
);
}
public roomUserStatusOffline(
req: RoomUserStatusOfflineRequest
): Observable<RoomUserStatusOfflineResponse> {
public userStatusOffline(
req: UserStatusOfflineRequest
): Observable<UserStatusOfflineResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_USER_STATUS_REQ,
...encodeRoomUserStatusOffline(req)
...encodeUserStatusOffline(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUserStatusOffline(res);
return decodeUserStatusOffline(res);
})
);
}
public roomExit(req: RoomExitRequest): Observable<RoomExitResponse> {
public exit(req: ExitRequest): Observable<ExitResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeRoomExit(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeExit(req))
.pipe(
map(res => {
take(1);
return decodeRoomExit(res);
return decodeExit(res);
})
);
}
public roomExitAll(req: RoomExitAllRequest): Observable<void> {
public exitAll(req: ExitAllRequest): Observable<void> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
...encodeRoomAllExit(req)
)
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_ALL_REQ, ...encodeAllExit(req))
.pipe(
map(res => {
take(1);
})
);
}
public roomExitForcing(
req: RoomExitForcingRequest
): Observable<RoomExitForcingResponse> {
public exitForcing(req: ExitForcingRequest): Observable<ExitForcingResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
...encodeRoomExitForcing(req)
...encodeExitForcing(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomExitForcing(res);
return decodeExitForcing(res);
})
);
}
public roomUpdate(req: RoomUpdateRequest): Observable<RoomUpdateResponse> {
public update(req: UpdateRequest): Observable<UpdateResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeRoomUpdate(req))
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeUpdate(req))
.pipe(
map(res => {
take(1);
return decodeRoomUpdate(res);
return decodeUpdate(res);
})
);
}
public roomUpdateTimerSet(
req: RoomUpdateTimerSetRequest
): Observable<RoomUpdateTimerSetResponse> {
public updateTimerSet(
req: UpdateTimerSetRequest
): Observable<UpdateTimerSetResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_INFO_UPD_REQ,
...encodeRoomUpdateTimerSet(req)
...encodeUpdateTimerSet(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUpdateTimerSet(res);
return decodeUpdateTimerSet(res);
})
);
}
public roomUpdateFont(
req: RoomUpdateFontRequest
): Observable<RoomUpdateFontResponse> {
public updateFont(req: UpdateFontRequest): Observable<UpdateFontResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_FONT_UPD_REQ,
...encodeRoomUpdateFont(req)
...encodeUpdateFont(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUpdateFont(res);
return decodeUpdateFont(res);
})
);
}

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map, take, takeWhile } from 'rxjs/operators';
import { map, take } from 'rxjs/operators';
import {
UserPasswordSetRequest,
UserPasswordSetResponse,