쪽지 interface 수정.
// JSON 객체를 raw body 에 실어보내는 로직으로 구현.
This commit is contained in:
parent
08331aadc0
commit
6550c419a1
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
APIJsonEncoder,
|
||||
MessageAPIResponse
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { MessageType } from '../types/message.type';
|
||||
|
@ -17,22 +17,14 @@ export interface DelRequest extends APIRequest {
|
|||
msgList: { msgId: number }[];
|
||||
}
|
||||
|
||||
export interface DelResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface DelResponse extends MessageAPIResponse {}
|
||||
|
||||
const DelEncodeMap = {};
|
||||
|
||||
export const encodeDel: APIEncoder<DelRequest> = (req: DelRequest) => {
|
||||
return ParameterUtil.encode(DelEncodeMap, req);
|
||||
export const encodeDel: APIJsonEncoder<DelRequest> = (req: DelRequest) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeDel: APIDecoder<DelResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as DelResponse;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
MessageAPIResponse,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
APIJsonEncoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { MessageType } from '../types/message.type';
|
||||
|
@ -18,10 +17,7 @@ export interface DetailRequest extends APIRequest {
|
|||
msgId: number;
|
||||
}
|
||||
|
||||
export interface DetailResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
|
||||
export interface DetailResponse extends MessageAPIResponse {
|
||||
msgInfo: {
|
||||
msgId: number;
|
||||
category: CategoryType;
|
||||
|
@ -50,17 +46,14 @@ export interface DetailResponse extends APIResponse {
|
|||
}[];
|
||||
}
|
||||
|
||||
const DetailEncodeMap = {};
|
||||
|
||||
export const encodeDetail: APIEncoder<DetailRequest> = (req: DetailRequest) => {
|
||||
return ParameterUtil.encode(DetailEncodeMap, req);
|
||||
export const encodeDetail: APIJsonEncoder<DetailRequest> = (
|
||||
req: DetailRequest
|
||||
) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeDetail: APIDecoder<DetailResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
|
||||
|
@ -81,31 +74,20 @@ export interface ReadRequest extends APIRequest {
|
|||
msgId: number;
|
||||
}
|
||||
|
||||
export interface ReadResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface ReadResponse extends MessageAPIResponse {}
|
||||
|
||||
const ReadEncodeMap = {};
|
||||
|
||||
export const encodeRead: APIEncoder<ReadRequest> = (req: ReadRequest) => {
|
||||
return ParameterUtil.encode(ReadEncodeMap, req);
|
||||
export const encodeRead: APIJsonEncoder<ReadRequest> = (req: ReadRequest) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeRead: APIDecoder<ReadResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as ReadResponse;
|
||||
};
|
||||
|
||||
export interface ReadCheckResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
|
||||
export interface ReadCheckResponse extends MessageAPIResponse {
|
||||
recvList: {
|
||||
userSeq: number;
|
||||
userName: string;
|
||||
|
@ -117,9 +99,6 @@ export interface ReadCheckResponse extends APIResponse {
|
|||
|
||||
export const decodeReadCheck: APIDecoder<ReadCheckResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
|
||||
|
@ -137,22 +116,16 @@ export interface CancelRequest extends APIRequest {
|
|||
recvUserList: { userSeq: number }[];
|
||||
}
|
||||
|
||||
export interface CancelResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface CancelResponse extends MessageAPIResponse {}
|
||||
|
||||
const CancelEncodeMap = {};
|
||||
|
||||
export const encodeCancel: APIEncoder<CancelRequest> = (req: CancelRequest) => {
|
||||
return ParameterUtil.encode(CancelEncodeMap, req);
|
||||
export const encodeCancel: APIJsonEncoder<CancelRequest> = (
|
||||
req: CancelRequest
|
||||
) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeCancel: APIDecoder<CancelResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as CancelResponse;
|
||||
|
@ -167,26 +140,18 @@ export interface CancelReservationRequest extends APIRequest {
|
|||
msgId: number;
|
||||
}
|
||||
|
||||
export interface CancelReservationResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface CancelReservationResponse extends MessageAPIResponse {}
|
||||
|
||||
const CancelReservationEncodeMap = {};
|
||||
|
||||
export const encodeCancelReservation: APIEncoder<CancelReservationRequest> = (
|
||||
export const encodeCancelReservation: APIJsonEncoder<CancelReservationRequest> = (
|
||||
req: CancelReservationRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(CancelReservationEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeCancelReservation: APIDecoder<CancelReservationResponse> = (
|
||||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as CancelReservationResponse;
|
||||
|
@ -202,14 +167,12 @@ export interface RetrieveResourceFileRequest extends APIRequest {
|
|||
resUrl: string;
|
||||
}
|
||||
|
||||
export interface RetrieveResourceFileResponse extends APIResponse {}
|
||||
export interface RetrieveResourceFileResponse extends MessageAPIResponse {}
|
||||
|
||||
const RetrieveResourceFileEncodeMap = {};
|
||||
|
||||
export const encodeRetrieveResourceFile: APIEncoder<RetrieveResourceFileRequest> = (
|
||||
export const encodeRetrieveResourceFile: APIJsonEncoder<RetrieveResourceFileRequest> = (
|
||||
req: RetrieveResourceFileRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(RetrieveResourceFileEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeRetrieveResourceFile: APIDecoder<RetrieveResourceFileResponse> = (
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
MessageAPIResponse,
|
||||
APIJsonEncoder,
|
||||
APIDecoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { CategoryType } from '../types/category.type';
|
||||
|
@ -25,26 +24,18 @@ export interface EditReservationRequest extends APIRequest {
|
|||
recvUserList: { userSeq: number; userName: string }[];
|
||||
}
|
||||
|
||||
export interface EditReservationResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface EditReservationResponse extends MessageAPIResponse {}
|
||||
|
||||
const EditReservationEncodeMap = {};
|
||||
|
||||
export const encodeEditReservation: APIEncoder<EditReservationRequest> = (
|
||||
export const encodeEditReservation: APIJsonEncoder<EditReservationRequest> = (
|
||||
req: EditReservationRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(EditReservationEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeEditReservation: APIDecoder<EditReservationResponse> = (
|
||||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as EditReservationResponse;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
MessageAPIResponse,
|
||||
APIJsonEncoder,
|
||||
APIDecoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -15,22 +14,16 @@ export interface SaveMyRequest extends APIRequest {
|
|||
message: string;
|
||||
}
|
||||
|
||||
export interface SaveMyResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface SaveMyResponse extends MessageAPIResponse {}
|
||||
|
||||
const SaveMyEncodeMap = {};
|
||||
|
||||
export const encodeSaveMy: APIEncoder<SaveMyRequest> = (req: SaveMyRequest) => {
|
||||
return ParameterUtil.encode(SaveMyEncodeMap, req);
|
||||
export const encodeSaveMy: APIJsonEncoder<SaveMyRequest> = (
|
||||
req: SaveMyRequest
|
||||
) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeSaveMy: APIDecoder<SaveMyResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as SaveMyResponse;
|
||||
|
@ -44,29 +37,21 @@ export interface RetrieveMyRequest extends APIRequest {
|
|||
pageCount: number;
|
||||
}
|
||||
|
||||
export interface RetrieveMyResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
|
||||
export interface RetrieveMyResponse extends MessageAPIResponse {
|
||||
msgList: {
|
||||
msgId: number;
|
||||
message: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
const RetrieveMyEncodeMap = {};
|
||||
|
||||
export const encodeRetrieveMy: APIEncoder<RetrieveMyRequest> = (
|
||||
export const encodeRetrieveMy: APIJsonEncoder<RetrieveMyRequest> = (
|
||||
req: RetrieveMyRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(RetrieveMyEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeRetrieveMy: APIDecoder<RetrieveMyResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
|
||||
|
@ -80,22 +65,16 @@ export interface DelMyRequest extends APIRequest {
|
|||
tokenKey: string;
|
||||
}
|
||||
|
||||
export interface DelMyResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface DelMyResponse extends MessageAPIResponse {}
|
||||
|
||||
const DelMyEncodeMap = {};
|
||||
|
||||
export const encodeDelMy: APIEncoder<DelMyRequest> = (req: DelMyRequest) => {
|
||||
return ParameterUtil.encode(DelMyEncodeMap, req);
|
||||
export const encodeDelMy: APIJsonEncoder<DelMyRequest> = (
|
||||
req: DelMyRequest
|
||||
) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeDelMy: APIDecoder<DelMyResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as DelMyResponse;
|
||||
|
@ -109,22 +88,16 @@ export interface EditMyRequest extends APIRequest {
|
|||
message: string;
|
||||
}
|
||||
|
||||
export interface EditMyResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface EditMyResponse extends MessageAPIResponse {}
|
||||
|
||||
const EditMyEncodeMap = {};
|
||||
|
||||
export const encodeEditMy: APIEncoder<EditMyRequest> = (req: EditMyRequest) => {
|
||||
return ParameterUtil.encode(EditMyEncodeMap, req);
|
||||
export const encodeEditMy: APIJsonEncoder<EditMyRequest> = (
|
||||
req: EditMyRequest
|
||||
) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeEditMy: APIDecoder<EditMyResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as EditMyResponse;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
MessageAPIResponse,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
APIJsonEncoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { MessageType } from '../types/message.type';
|
||||
|
@ -23,33 +22,25 @@ export interface RetrieveSearchRequest extends RetrieveRequest {
|
|||
searchContent: string;
|
||||
}
|
||||
|
||||
export interface RetrieveResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
export interface RetrieveResponse extends MessageAPIResponse {
|
||||
totalCount: number;
|
||||
|
||||
messageList: MessageList[];
|
||||
}
|
||||
|
||||
const RetrieveEncodeMap = {};
|
||||
const RetrieveSearchEncodeMap = {};
|
||||
|
||||
export const encodeRetrieve: APIEncoder<RetrieveRequest> = (
|
||||
export const encodeRetrieve: APIJsonEncoder<RetrieveRequest> = (
|
||||
req: RetrieveRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(RetrieveEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
export const encodeRetrieveSearch: APIEncoder<RetrieveResponse> = (
|
||||
export const encodeRetrieveSearch: APIJsonEncoder<RetrieveResponse> = (
|
||||
req: RetrieveResponse
|
||||
) => {
|
||||
return ParameterUtil.encode(RetrieveSearchEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeRetrieveSend: APIDecoder<RetrieveResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
totalCount: res.totalCount,
|
||||
|
@ -61,9 +52,6 @@ export const decodeRetrieveReceive: APIDecoder<RetrieveResponse> = (
|
|||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
totalCount: res.totalCount,
|
||||
|
@ -75,9 +63,6 @@ export const decodeRetrieveReservation: APIDecoder<RetrieveResponse> = (
|
|||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
totalCount: res.totalCount,
|
||||
|
@ -89,9 +74,6 @@ export const decodeRetrieveSearch: APIDecoder<RetrieveResponse> = (
|
|||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
totalCount: res.totalCount,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
MessageAPIResponse,
|
||||
APIJsonEncoder,
|
||||
APIDecoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { CategoryType } from '../types/category.type';
|
||||
|
@ -26,24 +25,16 @@ export interface SendCopyRequest extends APIRequest {
|
|||
recvUserList: { userSeq: number; userName: string }[];
|
||||
}
|
||||
|
||||
export interface SendCopyResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface SendCopyResponse extends MessageAPIResponse {}
|
||||
|
||||
const SendCopyEncodeMap = {};
|
||||
|
||||
export const encodeSendCopy: APIEncoder<SendCopyRequest> = (
|
||||
export const encodeSendCopy: APIJsonEncoder<SendCopyRequest> = (
|
||||
req: SendCopyRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(SendCopyEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeSendCopy: APIDecoder<SendCopyResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as SendCopyResponse;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
MessageAPIResponse,
|
||||
APIJsonEncoder,
|
||||
APIDecoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { MessageType } from '../types/message.type';
|
||||
|
@ -28,22 +27,14 @@ export interface SendRequest extends APIRequest {
|
|||
recvUserList: { userSeq: number; userName: string }[];
|
||||
}
|
||||
|
||||
export interface SendResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
}
|
||||
export interface SendResponse extends MessageAPIResponse {}
|
||||
|
||||
const SendEncodeMap = {};
|
||||
|
||||
export const encodeSend: APIEncoder<SendRequest> = (req: SendRequest) => {
|
||||
return ParameterUtil.encode(SendEncodeMap, req);
|
||||
export const encodeSend: APIJsonEncoder<SendRequest> = (req: SendRequest) => {
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeSend: APIDecoder<SendResponse> = (res: any) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg
|
||||
} as SendResponse;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {
|
||||
APIRequest,
|
||||
APIResponse,
|
||||
APIEncoder,
|
||||
APIDecoder,
|
||||
ParameterUtil
|
||||
MessageAPIResponse,
|
||||
APIJsonEncoder,
|
||||
APIDecoder
|
||||
} from '@ucap-webmessenger/api';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
|
||||
|
@ -13,28 +12,20 @@ export interface UnreadCountRequest extends APIRequest {
|
|||
tokenKey: string;
|
||||
}
|
||||
|
||||
export interface UnreadCountResponse extends APIResponse {
|
||||
responseCode: string;
|
||||
responseMsg: string;
|
||||
|
||||
export interface UnreadCountResponse extends MessageAPIResponse {
|
||||
unreadCount: number;
|
||||
}
|
||||
|
||||
const UnreadCountEncodeMap = {};
|
||||
|
||||
export const encodeUnreadCount: APIEncoder<UnreadCountRequest> = (
|
||||
export const encodeUnreadCount: APIJsonEncoder<UnreadCountRequest> = (
|
||||
req: UnreadCountRequest
|
||||
) => {
|
||||
return ParameterUtil.encode(UnreadCountEncodeMap, req);
|
||||
return JSON.stringify(req);
|
||||
};
|
||||
|
||||
export const decodeUnreadCount: APIDecoder<UnreadCountResponse> = (
|
||||
res: any
|
||||
) => {
|
||||
return {
|
||||
statusCode: res.StatusCode,
|
||||
errorMessage: res.ErrorMessage,
|
||||
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
unreadCount: res.unreadCount
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
@ -92,6 +92,8 @@ import {
|
|||
export class MessageApiService {
|
||||
readonly urls: Urls;
|
||||
|
||||
headers: HttpHeaders;
|
||||
|
||||
constructor(
|
||||
@Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig,
|
||||
private httpClient: HttpClient
|
||||
|
@ -100,6 +102,10 @@ export class MessageApiService {
|
|||
this.moduleConfig.hostConfig,
|
||||
this.moduleConfig.urls
|
||||
);
|
||||
|
||||
this.headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
});
|
||||
}
|
||||
|
||||
/** retrieve */
|
||||
|
@ -107,26 +113,18 @@ export class MessageApiService {
|
|||
req: RetrieveRequest
|
||||
): Observable<RetrieveResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveSendMessageList,
|
||||
{},
|
||||
{
|
||||
params: encodeRetrieve(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveSendMessageList, encodeRetrieve(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeRetrieveSend(res)));
|
||||
}
|
||||
public retrieveReceiveMessage(
|
||||
req: RetrieveRequest
|
||||
): Observable<RetrieveResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveRecvMessageList,
|
||||
{},
|
||||
{
|
||||
params: encodeRetrieve(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveRecvMessageList, encodeRetrieve(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeRetrieveReceive(res)));
|
||||
}
|
||||
public retrieveReservationMessage(
|
||||
|
@ -135,9 +133,9 @@ export class MessageApiService {
|
|||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveReservationMessageList,
|
||||
{},
|
||||
encodeRetrieve(req),
|
||||
{
|
||||
params: encodeRetrieve(req)
|
||||
headers: this.headers
|
||||
}
|
||||
)
|
||||
.pipe(map(res => decodeRetrieveReservation(res)));
|
||||
|
@ -146,72 +144,48 @@ export class MessageApiService {
|
|||
req: RetrieveSearchRequest
|
||||
): Observable<RetrieveResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveSearchMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeRetrieve(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveSearchMessage, encodeRetrieve(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeRetrieveSearch(res)));
|
||||
}
|
||||
|
||||
/** send */
|
||||
public sendMessage(req: SendRequest): Observable<SendResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.sendNewMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeSend(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.sendNewMessage, encodeSend(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeSend(res)));
|
||||
}
|
||||
|
||||
/** detail */
|
||||
public detailMessage(req: DetailRequest): Observable<DetailResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveMessageDetail,
|
||||
{},
|
||||
{
|
||||
params: encodeDetail(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveMessageDetail, encodeDetail(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeDetail(res)));
|
||||
}
|
||||
public readMessage(req: ReadRequest): Observable<ReadResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.readMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeRead(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.readMessage, encodeRead(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeRead(res)));
|
||||
}
|
||||
public retrieveReadCheck(req: ReadRequest): Observable<ReadCheckResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveReadCheck,
|
||||
{},
|
||||
{
|
||||
params: encodeRead(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveReadCheck, encodeRead(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeReadCheck(res)));
|
||||
}
|
||||
public cancelMessage(req: CancelRequest): Observable<CancelResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.cancelMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeCancel(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.cancelMessage, encodeCancel(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeCancel(res)));
|
||||
}
|
||||
public cancelReservationMessage(
|
||||
|
@ -220,9 +194,9 @@ export class MessageApiService {
|
|||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.cancelReservationMessage,
|
||||
{},
|
||||
encodeCancelReservation(req),
|
||||
{
|
||||
params: encodeCancelReservation(req)
|
||||
headers: this.headers
|
||||
}
|
||||
)
|
||||
.pipe(map(res => decodeCancelReservation(res)));
|
||||
|
@ -233,9 +207,9 @@ export class MessageApiService {
|
|||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveResourceFile,
|
||||
{},
|
||||
encodeRetrieveResourceFile(req),
|
||||
{
|
||||
params: encodeRetrieveResourceFile(req)
|
||||
headers: this.headers
|
||||
}
|
||||
)
|
||||
.pipe(map(res => decodeRetrieveResourceFile(res)));
|
||||
|
@ -244,61 +218,41 @@ export class MessageApiService {
|
|||
/** del */
|
||||
public deleteMessage(req: DelRequest): Observable<DelResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.deleteMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeDel(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.deleteMessage, encodeDel(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeDel(res)));
|
||||
}
|
||||
|
||||
/** save my message */
|
||||
public saveMyMessage(req: SaveMyRequest): Observable<SaveMyResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.saveMyMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeSaveMy(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.saveMyMessage, encodeSaveMy(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeSaveMy(res)));
|
||||
}
|
||||
public retrieveMyMessage(
|
||||
req: RetrieveMyRequest
|
||||
): Observable<RetrieveMyResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveMyMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeRetrieveMy(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveMyMessage, encodeRetrieveMy(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeRetrieveMy(res)));
|
||||
}
|
||||
public deleteMyMessage(req: DelMyRequest): Observable<DelMyResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.deleteMyMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeDelMy(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.deleteMyMessage, encodeDelMy(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeDelMy(res)));
|
||||
}
|
||||
public editMyMessage(req: EditMyRequest): Observable<EditMyResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.editMyMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeEditMy(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.editMyMessage, encodeEditMy(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeEditMy(res)));
|
||||
}
|
||||
|
||||
|
@ -309,9 +263,9 @@ export class MessageApiService {
|
|||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.editReservationMessageEx,
|
||||
{},
|
||||
encodeEditReservation(req),
|
||||
{
|
||||
params: encodeEditReservation(req)
|
||||
headers: this.headers
|
||||
}
|
||||
)
|
||||
.pipe(map(res => decodeEditReservation(res)));
|
||||
|
@ -320,13 +274,9 @@ export class MessageApiService {
|
|||
/** send-copy(forward) */
|
||||
public sendCopyMessage(req: SendCopyRequest): Observable<SendCopyResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.sendCopyMessage,
|
||||
{},
|
||||
{
|
||||
params: encodeSendCopy(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.sendCopyMessage, encodeSendCopy(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeSendCopy(res)));
|
||||
}
|
||||
|
||||
|
@ -335,13 +285,9 @@ export class MessageApiService {
|
|||
req: UnreadCountRequest
|
||||
): Observable<UnreadCountResponse> {
|
||||
return this.httpClient
|
||||
.post<any>(
|
||||
this.urls.retrieveUnreadCount,
|
||||
{},
|
||||
{
|
||||
params: encodeUnreadCount(req)
|
||||
}
|
||||
)
|
||||
.post<any>(this.urls.retrieveUnreadCount, encodeUnreadCount(req), {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(map(res => decodeUnreadCount(res)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { HttpParams } from '@angular/common/http';
|
||||
|
||||
import { StatusCode } from '../types/status-code.type';
|
||||
import { MessageStatusCode } from '../types/message-status-code.type';
|
||||
|
||||
export interface APIRequest {
|
||||
_id?: string;
|
||||
|
@ -11,9 +12,16 @@ export interface APIResponse {
|
|||
statusCode: StatusCode;
|
||||
errorMessage: string;
|
||||
}
|
||||
export interface MessageAPIResponse {
|
||||
_id?: string;
|
||||
responseCode: MessageStatusCode;
|
||||
responseMsg: string;
|
||||
}
|
||||
|
||||
export type APIEncoder<REQ> = (req: REQ) => HttpParams;
|
||||
|
||||
export type APIJsonEncoder<REQ> = (req: REQ) => string;
|
||||
|
||||
export type APIFormDataEncoder<REQ> = (req: REQ) => FormData;
|
||||
|
||||
export type APIDecoder<RES> = (res: any) => RES;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
export enum MessageStatusCode {
|
||||
/** 성공 */
|
||||
Success = '00',
|
||||
/** 사용자 토큰이 일치하지 않을 경우 발생 (인증 실패) */
|
||||
Fail_Auth = '10',
|
||||
/** 메시지 타입이 일치하지 않을 경우 발생 */
|
||||
Fail_Msg_Type = '20',
|
||||
/** 메시지 아이디가 NULL일 경우 발생 */
|
||||
Fail_Msg_Id_Null = '21',
|
||||
/** 예약 메시지 발송 시, 예약 시간이 지정되어있지 않을 경우 발생 */
|
||||
Fail_Msg_Reservation_Time_Null = '22',
|
||||
/** 메시지 발송 시, 제목이 최대 길이보다 길 경우 발생 */
|
||||
Fail_Msg_Title_length = '23',
|
||||
/** 예약 메시지 발송 시, 현재 시간 10분 전일 경우 발생 */
|
||||
Fail_Msg_Reservation_Time_Less = '24',
|
||||
/** 예약 메시지 수정 시, 발송 시간 10분 전일 경우 발생 */
|
||||
Fail_Msg_Edit_Reservation_Time_Less = '25',
|
||||
/** 예약 메시지 수정 및 발송 취소 시, 이미 발송된 메시지일 경우 발생 */
|
||||
Fail_Msg_Edit_Cancel_Reservation_Sended = '26',
|
||||
/** 파일 업로드 시, 경로가 올바르지 않을 경우 발생 */
|
||||
Fail_File_Path = '40',
|
||||
/** 파일 업로드 시, 파일 크기가 최대 크기보다 클 경우 발생 */
|
||||
Fail_File_Size = '41',
|
||||
/** 파일 업로드 시, 업로드할 수 없는 파일 형식일 경우 발생 */
|
||||
Fail_File_Ext = '42',
|
||||
/** Exception 에러 발생 */
|
||||
Fail = '99'
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
export * from './lib/apis/api';
|
||||
|
||||
export * from './lib/types/message-status-code.type';
|
||||
export * from './lib/types/status-code.type';
|
||||
|
||||
export * from './lib/utils/json.util';
|
||||
|
|
|
@ -38,7 +38,7 @@ import {
|
|||
RetrieveRequest
|
||||
} from '@ucap-webmessenger/api-message';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { StatusCode } from '@ucap-webmessenger/api';
|
||||
import { StatusCode, MessageStatusCode } from '@ucap-webmessenger/api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout-chat-right-drawer-message-box',
|
||||
|
@ -93,7 +93,7 @@ export class MessageBoxComponent implements OnInit, OnDestroy {
|
|||
.pipe(
|
||||
map(res => {
|
||||
console.log(res);
|
||||
if (res.statusCode === StatusCode.Success) {
|
||||
if (res.responseCode === MessageStatusCode.Success) {
|
||||
} else {
|
||||
}
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue
Block a user