added protocol SERVICE > PW_SET

This commit is contained in:
leejh 2019-09-25 13:44:19 +09:00
parent 31129c90ac
commit ed37cacb89
3 changed files with 108 additions and 1 deletions

View File

@ -0,0 +1,54 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface UserPasswordSetRequest extends ProtocolRequest {
// LoginID(s)
loginId: string;
// LoginPW
oldLoginPw: string;
// NewPW
newLoginPw: string;
// 기관코드(s)
companyCode: string;
}
export interface UserPasswordSetResponse extends ProtocolResponse {
// LoginID(s)
loginId: string;
// LoginPW
oldLoginPw: string;
// NewPW
newLoginPw: string;
// 기관코드(s)
companyCode: string;
}
export const encodeUserPasswordSet: ProtocolEncoder<UserPasswordSetRequest> = (
req: UserPasswordSetRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.loginId });
bodyList.push({ type: PacketBodyValue.String, value: req.oldLoginPw });
bodyList.push({ type: PacketBodyValue.String, value: req.newLoginPw });
bodyList.push({ type: PacketBodyValue.String, value: req.companyCode });
return bodyList;
};
export const decodeUserPasswordSet: ProtocolDecoder<UserPasswordSetResponse> = (
message: ProtocolMessage
) => {
return {
loginId: message.bodyList[0],
oldLoginPw: message.bodyList[1],
newLoginPw: message.bodyList[2],
companyCode: message.bodyList[3]
} as UserPasswordSetResponse;
};

View File

@ -1,8 +1,36 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map, take, takeWhile } from 'rxjs/operators';
import {
UserPasswordSetRequest,
UserPasswordSetResponse,
encodeUserPasswordSet,
decodeUserPasswordSet
} from '../models/password-set';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import { SVC_TYPE_SERVICE, SSVC_TYPE_USER_PW_SET_REQ } from '../types/service';
@Injectable({
providedIn: 'root'
})
export class ServiceProtocolService {
constructor() {}
constructor(private protocolService: ProtocolService) {}
public userPasswordSet(
req: UserPasswordSetRequest
): Observable<UserPasswordSetResponse> {
return this.protocolService
.call(
SVC_TYPE_SERVICE,
SSVC_TYPE_USER_PW_SET_REQ,
...encodeUserPasswordSet(req)
)
.pipe(
take(1),
map(res => {
return decodeUserPasswordSet(res);
})
);
}
}

View File

@ -0,0 +1,25 @@
export const SVC_TYPE_SERVICE = 92;
export const SSVC_TYPE_SMART_PUSH_SEND = 1; // SmartPush 발신 발신
export const SSVC_TYPE_SMART_PUSH_RECV = 2; // SmartPush 수신 수신
export const SSVC_TYPE_SMART_PUSH_RECV_OK = 3; // SmartPush 수신 확인
export const SSVC_TYPE_EXTERN_REQ_SEND = 4; // 외부프로그램요청
export const SSVC_TYPE_EXTERN_REQ_RECV = 5; // 외부프로그램응답
export const SSVC_TYPE_USER_PW_SET_REQ = 6; // PW변경 요청
export const SSVC_TYPE_USER_PW_SET_RES = 7; // PW변경 응답
export const SSVC_TYPE_MSG_REQ_SEND = 11; // 메시지 전달 발신
export const SSVC_TYPE_MSG_REQ_RECV = 12; // 메시지 전달 수신
export const SSVC_TYPE_FMC_PUSH_REQ = 21; // FMC PUSH 요청
export const SSVC_TYPE_FMC_PUSH_NOTI = 22; // FMC PUSH 알림(PC / Web 용)
export const SSVC_TYPE_FMC_PUSH_RES = 23; // FMC PUSH 응답
export const SSVC_TYPE_BUDDY_IMPORT_REQ = 31; // 친구 목록 IMPORT 요청
export const SSVC_TYPE_BUDDY_IMPORT_RES = 32; // 친구 목록 IMPORT 응답
export const SSVC_TYPE_BUDDY_IMPORT_COMPLETE_REQ = 33; // 친구 목록 IMPORT 완료 요청
export const SSVC_TYPE_BUDDY_IMPORT_COMPLETE_NOTI = 34; // 친구 목록 IMPORT 완료 알림
export const SSVC_TYPE_BUDDY_IMPORT_COMPLETE_RES = 35; // 친구 목록 IMPORT 완료 응답
export const SSVC_TYPE_BUDDY_EXPORT_REQ = 36; // 친구 목록 EXPORT 요청
export const SSVC_TYPE_BUDDY_EXPORT_GROUP_DATA = 37; // 친구 목록 EXPORT 그룹 정보
export const SSVC_TYPE_BUDDY_EXPORT_BUDDY_DATA = 38; // 친구 목록 EXPORT 친구 정보
export const SSVC_TYPE_BUDDY_EXPORT_RES = 39; // 친구 목록 EXPORT 응답
export const SSVC_TYPE_BUDDY_INIT_REQ = 40; // 친구 초기화 요청
export const SSVC_TYPE_BUDDY_INIT_NOTI = 41; // 친구 초기화 알림
export const SSVC_TYPE_BUDDY_INIT_RES = 42; // 친구 초기화 응답