diff --git a/projects/ucap-webmessenger-protocol-service/src/lib/models/password-set.ts b/projects/ucap-webmessenger-protocol-service/src/lib/models/password-set.ts new file mode 100644 index 00000000..a4d04941 --- /dev/null +++ b/projects/ucap-webmessenger-protocol-service/src/lib/models/password-set.ts @@ -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 = ( + 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 = ( + message: ProtocolMessage +) => { + return { + loginId: message.bodyList[0], + oldLoginPw: message.bodyList[1], + newLoginPw: message.bodyList[2], + companyCode: message.bodyList[3] + } as UserPasswordSetResponse; +}; diff --git a/projects/ucap-webmessenger-protocol-service/src/lib/services/service-protocol.service.ts b/projects/ucap-webmessenger-protocol-service/src/lib/services/service-protocol.service.ts index d3b26ac2..f87b9bfa 100644 --- a/projects/ucap-webmessenger-protocol-service/src/lib/services/service-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-service/src/lib/services/service-protocol.service.ts @@ -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 { + return this.protocolService + .call( + SVC_TYPE_SERVICE, + SSVC_TYPE_USER_PW_SET_REQ, + ...encodeUserPasswordSet(req) + ) + .pipe( + take(1), + map(res => { + return decodeUserPasswordSet(res); + }) + ); + } } diff --git a/projects/ucap-webmessenger-protocol-service/src/lib/types/service.ts b/projects/ucap-webmessenger-protocol-service/src/lib/types/service.ts new file mode 100644 index 00000000..edec55b9 --- /dev/null +++ b/projects/ucap-webmessenger-protocol-service/src/lib/types/service.ts @@ -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; // 친구 초기화 응답