From 08331aadc0b3989391ea5da706cbe13f50ec6365 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 14 Nov 2019 10:31:23 +0900 Subject: [PATCH] =?UTF-8?q?=EC=AA=BD=EC=A7=80=20protocol=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/apis/del.ts | 39 +++ .../src/lib/apis/detail.ts | 219 +++++++++++++ .../src/lib/apis/edit-reservation-ex.ts | 51 +++ .../src/lib/apis/my-message.ts | 131 ++++++++ .../src/lib/apis/retrieve-send.ts | 49 --- .../src/lib/apis/retrieve.ts | 100 ++++++ .../src/lib/apis/send-copy.ts | 50 +++ .../src/lib/apis/send.ts | 50 +++ .../src/lib/apis/unread-count.ts | 42 +++ .../src/lib/models/message-list.ts | 10 +- .../src/lib/services/message-api.service.ts | 308 +++++++++++++++++- .../src/public-api.ts | 8 +- .../right-drawer/message-box.component.ts | 4 +- 13 files changed, 1002 insertions(+), 59 deletions(-) create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/del.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts delete mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/retrieve-send.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/send.ts create mode 100644 projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/del.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/del.ts new file mode 100644 index 00000000..bd7d889b --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/del.ts @@ -0,0 +1,39 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { MessageType } from '../types/message.type'; + +export interface DelRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgList: { msgId: number }[]; +} + +export interface DelResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const DelEncodeMap = {}; + +export const encodeDel: APIEncoder = (req: DelRequest) => { + return ParameterUtil.encode(DelEncodeMap, req); +}; + +export const decodeDel: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as DelResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts new file mode 100644 index 00000000..c083d85e --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts @@ -0,0 +1,219 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { MessageType } from '../types/message.type'; +import { CategoryType } from '../types/category.type'; + +export interface DetailRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgId: number; +} + +export interface DetailResponse extends APIResponse { + responseCode: string; + responseMsg: string; + + msgInfo: { + msgId: number; + category: CategoryType; + title: string; + titleYn: boolean; + }; + + content: { + type: MessageType; + sendUserSeq: number; + sendUserName: string; + reservationTime: Date | null; + sendYn: boolean; + regDate: Date; + attachmentYn: boolean; + smsYn: boolean; + fileAllow: string; + }[]; + + recvList: { + userSeq: number; + userName: string; + cancelYn: boolean; + readDate: Date; + readYn: boolean; + }[]; +} + +const DetailEncodeMap = {}; + +export const encodeDetail: APIEncoder = (req: DetailRequest) => { + return ParameterUtil.encode(DetailEncodeMap, req); +}; + +export const decodeDetail: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + + msgInfo: null, + + content: [], + + recvList: [] + } as DetailResponse; +}; + +export interface ReadRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgId: number; +} + +export interface ReadResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const ReadEncodeMap = {}; + +export const encodeRead: APIEncoder = (req: ReadRequest) => { + return ParameterUtil.encode(ReadEncodeMap, req); +}; + +export const decodeRead: APIDecoder = (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; + + recvList: { + userSeq: number; + userName: string; + cancelYn: boolean; + readDate: Date; + readYn: boolean; + }[]; +} + +export const decodeReadCheck: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + + recvList: [] + } as ReadCheckResponse; +}; + +export interface CancelRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgId: number; + recvUserList: { userSeq: number }[]; +} + +export interface CancelResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const CancelEncodeMap = {}; + +export const encodeCancel: APIEncoder = (req: CancelRequest) => { + return ParameterUtil.encode(CancelEncodeMap, req); +}; + +export const decodeCancel: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as CancelResponse; +}; + +export interface CancelReservationRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgId: number; +} + +export interface CancelReservationResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const CancelReservationEncodeMap = {}; + +export const encodeCancelReservation: APIEncoder = ( + req: CancelReservationRequest +) => { + return ParameterUtil.encode(CancelReservationEncodeMap, req); +}; + +export const decodeCancelReservation: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as CancelReservationResponse; +}; + +export interface RetrieveResourceFileRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + msgId: number; + resUrl: string; +} + +export interface RetrieveResourceFileResponse extends APIResponse {} + +const RetrieveResourceFileEncodeMap = {}; + +export const encodeRetrieveResourceFile: APIEncoder = ( + req: RetrieveResourceFileRequest +) => { + return ParameterUtil.encode(RetrieveResourceFileEncodeMap, req); +}; + +export const decodeRetrieveResourceFile: APIDecoder = ( + res: any +) => { + return {} as RetrieveResourceFileResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts new file mode 100644 index 00000000..2897a2b3 --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts @@ -0,0 +1,51 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { CategoryType } from '../types/category.type'; +import { ContentType } from '../types/content.type'; + +export interface EditReservationRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + msgId: number; + category: CategoryType; + title: string; + titleYn: boolean; + listOrder: ContentType[]; + reservationTime: string; + smsYn: boolean; + + textContent: { text: string }[]; + recvUserList: { userSeq: number; userName: string }[]; +} + +export interface EditReservationResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const EditReservationEncodeMap = {}; + +export const encodeEditReservation: APIEncoder = ( + req: EditReservationRequest +) => { + return ParameterUtil.encode(EditReservationEncodeMap, req); +}; + +export const decodeEditReservation: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as EditReservationResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts new file mode 100644 index 00000000..6d739c10 --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts @@ -0,0 +1,131 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; + +export interface SaveMyRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + userName: string; + message: string; +} + +export interface SaveMyResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const SaveMyEncodeMap = {}; + +export const encodeSaveMy: APIEncoder = (req: SaveMyRequest) => { + return ParameterUtil.encode(SaveMyEncodeMap, req); +}; + +export const decodeSaveMy: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as SaveMyResponse; +}; + +export interface RetrieveMyRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + pageSize: number; + pageCount: number; +} + +export interface RetrieveMyResponse extends APIResponse { + responseCode: string; + responseMsg: string; + + msgList: { + msgId: number; + message: string; + }[]; +} + +const RetrieveMyEncodeMap = {}; + +export const encodeRetrieveMy: APIEncoder = ( + req: RetrieveMyRequest +) => { + return ParameterUtil.encode(RetrieveMyEncodeMap, req); +}; + +export const decodeRetrieveMy: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + + msgList: [] + } as RetrieveMyResponse; +}; + +export interface DelMyRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; +} + +export interface DelMyResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const DelMyEncodeMap = {}; + +export const encodeDelMy: APIEncoder = (req: DelMyRequest) => { + return ParameterUtil.encode(DelMyEncodeMap, req); +}; + +export const decodeDelMy: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as DelMyResponse; +}; + +export interface EditMyRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + msgId: number; + message: string; +} + +export interface EditMyResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const EditMyEncodeMap = {}; + +export const encodeEditMy: APIEncoder = (req: EditMyRequest) => { + return ParameterUtil.encode(EditMyEncodeMap, req); +}; + +export const decodeEditMy: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as EditMyResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve-send.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve-send.ts deleted file mode 100644 index 7fec1638..00000000 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve-send.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - APIRequest, - APIResponse, - APIEncoder, - APIDecoder, - ParameterUtil -} from '@ucap-webmessenger/api'; -import { DeviceType } from '@ucap-webmessenger/core'; -import { MessageType } from '../types/message.type'; -import { MessageList } from '../models/message-list'; - -export interface RetrieveRequest extends APIRequest { - userSeq: number; - deviceType: DeviceType; - tokenKey: string; - type: MessageType; - pageSize: number; - pageCount: number; -} - -export interface RetrieveSendResponse extends APIResponse { - responseCode: string; - responseMsg: string; - totalCount: number; - - messageList: MessageList[]; -} - -const RetrieveSendEncodeMap = {}; - -export const encodeRetrieve: APIEncoder = ( - req: RetrieveRequest -) => { - return ParameterUtil.encode(RetrieveSendEncodeMap, req); -}; - -export const decodeRetrieveSend: APIDecoder = ( - res: any -) => { - return { - statusCode: res.StatusCode, - errorMessage: res.ErrorMessage, - - responseCode: res.responseCode, - responseMsg: res.responseMsg, - totalCount: res.totalCount, - messageList: [] - } as RetrieveSendResponse; -}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts new file mode 100644 index 00000000..3298f1b9 --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts @@ -0,0 +1,100 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { MessageType } from '../types/message.type'; +import { MessageList } from '../models/message-list'; + +export interface RetrieveRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + pageSize: number; + pageCount: number; +} +export interface RetrieveSearchRequest extends RetrieveRequest { + searchTitle: string; + searchName: string; + searchContent: string; +} + +export interface RetrieveResponse extends APIResponse { + responseCode: string; + responseMsg: string; + totalCount: number; + + messageList: MessageList[]; +} + +const RetrieveEncodeMap = {}; +const RetrieveSearchEncodeMap = {}; + +export const encodeRetrieve: APIEncoder = ( + req: RetrieveRequest +) => { + return ParameterUtil.encode(RetrieveEncodeMap, req); +}; +export const encodeRetrieveSearch: APIEncoder = ( + req: RetrieveResponse +) => { + return ParameterUtil.encode(RetrieveSearchEncodeMap, req); +}; + +export const decodeRetrieveSend: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + totalCount: res.totalCount, + messageList: [] + } as RetrieveResponse; +}; + +export const decodeRetrieveReceive: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + totalCount: res.totalCount, + messageList: [] + } as RetrieveResponse; +}; + +export const decodeRetrieveReservation: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + totalCount: res.totalCount, + messageList: [] + } as RetrieveResponse; +}; + +export const decodeRetrieveSearch: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + totalCount: res.totalCount, + messageList: [] + } as RetrieveResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts new file mode 100644 index 00000000..6aaf198b --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts @@ -0,0 +1,50 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { CategoryType } from '../types/category.type'; +import { ContentType } from '../types/content.type'; + +export interface SendCopyRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + userName: string; + msgId: number; + category: CategoryType; + title: string; + titleYn: boolean; + listOrder: ContentType[]; + reservationTime: string; + smsYn: boolean; + + textContent: { text: string }[]; + recvUserList: { userSeq: number; userName: string }[]; +} + +export interface SendCopyResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const SendCopyEncodeMap = {}; + +export const encodeSendCopy: APIEncoder = ( + req: SendCopyRequest +) => { + return ParameterUtil.encode(SendCopyEncodeMap, req); +}; + +export const decodeSendCopy: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as SendCopyResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/send.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/send.ts new file mode 100644 index 00000000..b5b2c867 --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/send.ts @@ -0,0 +1,50 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; +import { MessageType } from '../types/message.type'; +import { CategoryType } from '../types/category.type'; +import { ContentType } from '../types/content.type'; + +export interface SendRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; + type: MessageType; + + userName: string; + category: CategoryType; + title: string; + titleYn: boolean; + listOrder: ContentType[]; + reservationTime: string; + smsYn: boolean; + + textContent: { text: string }[]; + recvUserList: { userSeq: number; userName: string }[]; +} + +export interface SendResponse extends APIResponse { + responseCode: string; + responseMsg: string; +} + +const SendEncodeMap = {}; + +export const encodeSend: APIEncoder = (req: SendRequest) => { + return ParameterUtil.encode(SendEncodeMap, req); +}; + +export const decodeSend: APIDecoder = (res: any) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg + } as SendResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts new file mode 100644 index 00000000..9d347be7 --- /dev/null +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts @@ -0,0 +1,42 @@ +import { + APIRequest, + APIResponse, + APIEncoder, + APIDecoder, + ParameterUtil +} from '@ucap-webmessenger/api'; +import { DeviceType } from '@ucap-webmessenger/core'; + +export interface UnreadCountRequest extends APIRequest { + userSeq: number; + deviceType: DeviceType; + tokenKey: string; +} + +export interface UnreadCountResponse extends APIResponse { + responseCode: string; + responseMsg: string; + + unreadCount: number; +} + +const UnreadCountEncodeMap = {}; + +export const encodeUnreadCount: APIEncoder = ( + req: UnreadCountRequest +) => { + return ParameterUtil.encode(UnreadCountEncodeMap, req); +}; + +export const decodeUnreadCount: APIDecoder = ( + res: any +) => { + return { + statusCode: res.StatusCode, + errorMessage: res.ErrorMessage, + + responseCode: res.responseCode, + responseMsg: res.responseMsg, + unreadCount: res.unreadCount + } as UnreadCountResponse; +}; diff --git a/projects/ucap-webmessenger-api-message/src/lib/models/message-list.ts b/projects/ucap-webmessenger-api-message/src/lib/models/message-list.ts index d5b05ca0..5e9836f3 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/models/message-list.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/models/message-list.ts @@ -14,17 +14,21 @@ export interface MessageList { /** 메시지 TYPE */ type: MessageType; /** 수신자의 시퀀스 */ - userSeq: number; + userSeq?: number; /** 수신자 */ userName: string; /** 수신자 수 */ - userCount: number; + userCount?: number; /** 읽은 사람 수 */ - userReadCount: number; + userReadCount?: number; + /** 예약시간 :: DATE 형식은 "yyyy-MM-dd HH:mm:ss" (단 초는 00고정. 예약메일은 분단위까지만) */ + reservationTime?: Date; /** 발신시간 */ regDate: Date; /** CONTENT 타입 */ resType: ContentType; /** 첨부파일 존재여부 */ attachmentYn: boolean; + /** 읽음여부 */ + readYn?: boolean; } diff --git a/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts b/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts index 4771dfe8..0ee338a3 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts @@ -10,10 +10,81 @@ import { UrlConfig } from '@ucap-webmessenger/core'; import { Urls } from '../config/urls'; import { RetrieveRequest, - RetrieveSendResponse, + RetrieveResponse, encodeRetrieve, - decodeRetrieveSend -} from '../apis/retrieve-send'; + decodeRetrieveSend, + decodeRetrieveReceive, + decodeRetrieveReservation, + RetrieveSearchRequest, + decodeRetrieveSearch +} from '../apis/retrieve'; +import { + SendRequest, + SendResponse, + encodeSend, + decodeSend +} from '../apis/send'; +import { + DetailRequest, + DetailResponse, + encodeDetail, + decodeDetail, + ReadRequest, + ReadResponse, + encodeRead, + decodeRead, + ReadCheckResponse, + decodeReadCheck, + CancelRequest, + CancelResponse, + encodeCancel, + decodeCancel, + CancelReservationRequest, + CancelReservationResponse, + encodeCancelReservation, + decodeCancelReservation, + RetrieveResourceFileRequest, + RetrieveResourceFileResponse, + encodeRetrieveResourceFile, + decodeRetrieveResourceFile +} from '../apis/detail'; +import { DelRequest, DelResponse, decodeDel, encodeDel } from '../apis/del'; +import { + SaveMyRequest, + SaveMyResponse, + encodeSaveMy, + decodeSaveMy, + RetrieveMyRequest, + RetrieveMyResponse, + encodeRetrieveMy, + decodeRetrieveMy, + DelMyRequest, + DelMyResponse, + encodeDelMy, + decodeDelMy, + EditMyRequest, + EditMyResponse, + encodeEditMy, + decodeEditMy +} from '../apis/my-message'; +import { + EditReservationRequest, + EditReservationResponse, + encodeEditReservation, + decodeEditReservation +} from '../apis/edit-reservation-ex'; +import { + SendCopyRequest, + SendCopyResponse, + encodeSendCopy, + decodeSendCopy +} from '../apis/send-copy'; +import { + UnreadCountRequest, + UnreadCountResponse, + encodeUnreadCount, + decodeUnreadCount +} from '../apis/unread-count'; @Injectable({ providedIn: 'root' @@ -31,9 +102,10 @@ export class MessageApiService { ); } + /** retrieve */ public retrieveSendMessage( req: RetrieveRequest - ): Observable { + ): Observable { return this.httpClient .post( this.urls.retrieveSendMessageList, @@ -44,4 +116,232 @@ export class MessageApiService { ) .pipe(map(res => decodeRetrieveSend(res))); } + public retrieveReceiveMessage( + req: RetrieveRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveRecvMessageList, + {}, + { + params: encodeRetrieve(req) + } + ) + .pipe(map(res => decodeRetrieveReceive(res))); + } + public retrieveReservationMessage( + req: RetrieveRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveReservationMessageList, + {}, + { + params: encodeRetrieve(req) + } + ) + .pipe(map(res => decodeRetrieveReservation(res))); + } + public retrieveSearchMessage( + req: RetrieveSearchRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveSearchMessage, + {}, + { + params: encodeRetrieve(req) + } + ) + .pipe(map(res => decodeRetrieveSearch(res))); + } + + /** send */ + public sendMessage(req: SendRequest): Observable { + return this.httpClient + .post( + this.urls.sendNewMessage, + {}, + { + params: encodeSend(req) + } + ) + .pipe(map(res => decodeSend(res))); + } + + /** detail */ + public detailMessage(req: DetailRequest): Observable { + return this.httpClient + .post( + this.urls.retrieveMessageDetail, + {}, + { + params: encodeDetail(req) + } + ) + .pipe(map(res => decodeDetail(res))); + } + public readMessage(req: ReadRequest): Observable { + return this.httpClient + .post( + this.urls.readMessage, + {}, + { + params: encodeRead(req) + } + ) + .pipe(map(res => decodeRead(res))); + } + public retrieveReadCheck(req: ReadRequest): Observable { + return this.httpClient + .post( + this.urls.retrieveReadCheck, + {}, + { + params: encodeRead(req) + } + ) + .pipe(map(res => decodeReadCheck(res))); + } + public cancelMessage(req: CancelRequest): Observable { + return this.httpClient + .post( + this.urls.cancelMessage, + {}, + { + params: encodeCancel(req) + } + ) + .pipe(map(res => decodeCancel(res))); + } + public cancelReservationMessage( + req: CancelReservationRequest + ): Observable { + return this.httpClient + .post( + this.urls.cancelReservationMessage, + {}, + { + params: encodeCancelReservation(req) + } + ) + .pipe(map(res => decodeCancelReservation(res))); + } + public retrieveResourceFile( + req: RetrieveResourceFileRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveResourceFile, + {}, + { + params: encodeRetrieveResourceFile(req) + } + ) + .pipe(map(res => decodeRetrieveResourceFile(res))); + } + + /** del */ + public deleteMessage(req: DelRequest): Observable { + return this.httpClient + .post( + this.urls.deleteMessage, + {}, + { + params: encodeDel(req) + } + ) + .pipe(map(res => decodeDel(res))); + } + + /** save my message */ + public saveMyMessage(req: SaveMyRequest): Observable { + return this.httpClient + .post( + this.urls.saveMyMessage, + {}, + { + params: encodeSaveMy(req) + } + ) + .pipe(map(res => decodeSaveMy(res))); + } + public retrieveMyMessage( + req: RetrieveMyRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveMyMessage, + {}, + { + params: encodeRetrieveMy(req) + } + ) + .pipe(map(res => decodeRetrieveMy(res))); + } + public deleteMyMessage(req: DelMyRequest): Observable { + return this.httpClient + .post( + this.urls.deleteMyMessage, + {}, + { + params: encodeDelMy(req) + } + ) + .pipe(map(res => decodeDelMy(res))); + } + public editMyMessage(req: EditMyRequest): Observable { + return this.httpClient + .post( + this.urls.editMyMessage, + {}, + { + params: encodeEditMy(req) + } + ) + .pipe(map(res => decodeEditMy(res))); + } + + /** edit reservation */ + public editReservationMessageEx( + req: EditReservationRequest + ): Observable { + return this.httpClient + .post( + this.urls.editReservationMessageEx, + {}, + { + params: encodeEditReservation(req) + } + ) + .pipe(map(res => decodeEditReservation(res))); + } + + /** send-copy(forward) */ + public sendCopyMessage(req: SendCopyRequest): Observable { + return this.httpClient + .post( + this.urls.sendCopyMessage, + {}, + { + params: encodeSendCopy(req) + } + ) + .pipe(map(res => decodeSendCopy(res))); + } + + /** unread count */ + public retrieveUnreadCount( + req: UnreadCountRequest + ): Observable { + return this.httpClient + .post( + this.urls.retrieveUnreadCount, + {}, + { + params: encodeUnreadCount(req) + } + ) + .pipe(map(res => decodeUnreadCount(res))); + } } diff --git a/projects/ucap-webmessenger-api-message/src/public-api.ts b/projects/ucap-webmessenger-api-message/src/public-api.ts index 75b9cf44..b9979746 100644 --- a/projects/ucap-webmessenger-api-message/src/public-api.ts +++ b/projects/ucap-webmessenger-api-message/src/public-api.ts @@ -1,7 +1,13 @@ /* * Public API Surface of ucap-webmessenger-api-message */ -export * from './lib/apis/retrieve-send'; +export * from './lib/apis/del'; +export * from './lib/apis/detail'; +export * from './lib/apis/edit-reservation-ex'; +export * from './lib/apis/my-message'; +export * from './lib/apis/retrieve'; +export * from './lib/apis/send-copy'; +export * from './lib/apis/send'; export * from './lib/services/message-api.service'; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/message-box.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/message-box.component.ts index 4a5c83c2..5ec87174 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/message-box.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/message-box.component.ts @@ -34,8 +34,8 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; import { MessageApiService, - RetrieveRequest, - MessageType + MessageType, + RetrieveRequest } from '@ucap-webmessenger/api-message'; import { DeviceType } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/api';