55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
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;
|
|
};
|