From fea937cd12619ab5240ae0ceb32f1f4630b10363 Mon Sep 17 00:00:00 2001 From: khk Date: Wed, 13 Nov 2019 17:46:25 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84&=EB=B7=B0?= =?UTF-8?q?=EC=96=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/messages.component.scss | 9 +- .../message-box/video.component.html | 4 +- .../message-box/video.component.scss | 23 ++- .../src/lib/components/profile.component.html | 144 ++++++++++++------ .../src/lib/components/profile.component.scss | 101 ++++++++++++ .../file-upload-queue.component.html | 34 ++--- .../file-upload-queue.component.scss | 44 ++++++ .../file-viewer/binary-viewer.component.html | 72 ++++----- .../file-viewer/binary-viewer.component.scss | 40 ++++- 9 files changed, 340 insertions(+), 131 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.scss index 5a051a2b..3788c0be 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.scss +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.scss @@ -95,12 +95,9 @@ .file-drop-zone { position: absolute; - background-color: rgb(180, 180, 180); - - top: calc(100% - 200px); - left: 20%; - width: 60%; - height: 200px; + padding:10px 10px 0 10px; + background-color: rgb(54, 54, 54, 0.8); + bottom:0 } } } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html index 4c61ae6e..fad3ada5 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/video.component.html @@ -1,7 +1,5 @@
- - -
+
+ {{ userInfo.name }} @@ -6,71 +6,125 @@ {{ userInfo.deptName }} + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+
  • - -
  • -
  • - chat + + + + {{ userInfo.intro }}
  • - email + + + + + {{ userInfo.email }}
  • - local_phone + + + + + {{ userInfo.lineNumber }}
  • - phone_android + + + + + {{ userInfo.hpNumber }}
+
- - - -
-
+ \ No newline at end of file diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.scss b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.scss index f9a5c726..d345084b 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.scss +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.scss @@ -1,3 +1,104 @@ +@mixin ellipsis($row) { + overflow: hidden; + text-overflow: ellipsis; + @if $row == 1 { + display: block; + white-space: nowrap; + word-wrap: normal; + } @else if $row >= 2 { + display: -webkit-box; + -webkit-line-clamp: $row; + -webkit-box-orient: vertical; + word-wrap: break-word; + } +} +::ng-deep .mat-card-header-text{ + width:100%; + .mat-card-subtitle{ + color: rgb(256, 256, 256, 0.7) !important; + text-align:center; + margin-top:10px !important; + } +} + .example-card { width: 400px; + padding: 0 0 20px; + position: relative; + .mat-card-header{ + justify-content: center; + padding-bottom: 40px; + background: #ce395d; + background: linear-gradient(to right, #345385, #ef4c73); + color: #ffffff; + padding-top: 20px; + width:100%; + .mat-card-title{ + margin-bottom: 12px; + max-width: 100%; + justify-content: center; + display: flex; + margin:0 20px; + span{ + @include ellipsis(1); + } + } + } + .mat-card-content{ + margin-top:-40px; + .profile-img{ + display:flex; + height:80px; + justify-content: center; + margin-bottom:20px; + img{ + widows: 80px; + height: 80px; + border-radius: 50%; + background-color:#efefef; + border:2px solid #ffffff; + } + } + .profile-option{ + display:flex; + padding:0 20px; + color:#ffffff; + margin-top: -100px; + height: 120px; + .btn-favorite{ + cursor: pointer; + .on{ + fill:yellow; + } + } + .btn-groupadd{ + margin-left:auto; + cursor: pointer; + svg{ + display:none; + &.on{ + display:block; + } + } + } + } + ul{ + padding:0 20px; + display:flex; + flex-flow: column; + margin-top:-20px; + li{ + display:inline-flex; + height:30px; + align-items: center; + flex-flow:row; + margin-bottom:20px; + + svg{ + margin-right:10px; + color:#777777; + } + } + } + } } diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.html b/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.html index db5aa429..9990fad3 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.html @@ -1,25 +1,23 @@
-
-
-
- image -
-
{{ fileUploadItem.file.name }}
+
+
+ + + + + + + +
{{ fileUploadItem.file.name }}
-
- + +
+
@@ -28,4 +26,4 @@
여기에 파일을 Drop하시면 업로드 됩니다.
-
+
\ No newline at end of file diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.scss b/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.scss index d628a704..35e07c2a 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.scss +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-upload-queue.component.scss @@ -1,4 +1,48 @@ +@mixin ellipsis($row) { + overflow: hidden; + text-overflow: ellipsis; + @if $row == 1 { + display: block; + white-space: nowrap; + word-wrap: normal; + } @else if $row >= 2 { + display: -webkit-box; + -webkit-line-clamp: $row; + -webkit-box-orient: vertical; + word-wrap: break-word; + } +} + .ucap-file-upload-queue-container { width: 100%; height: 100%; + .file-upload-item { + background-color: #eeeeee; + min-width: 200px; + margin: 0 0.5%; + margin-bottom: 10px; + width: 32%; + border-radius: 3px; + .file-upload-info { + padding: 10px; + background-color:#ffffff; + border-bottom: 1px solid #dddddd; + svg { + margin-right: 6px; + } + .file-upload-name { + height: 40px; + @include ellipsis(2); + } + } + .file-upload-progress { + padding: 6px 10px; + } + &:nth-child(3n + 1) { + margin-left: 1%; + } + &:nth-child(3n + 0) { + margin-right: 1%; + } + } } diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.html b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.html index 32a33be9..3e8b3161 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.html @@ -1,58 +1,48 @@
- - attachment + + + + + + {{ fileInfo.fileName }} - - - - +
-
-
-
+
+
+
+
+
-
+
미리보기를 지원하지 않는 파일입니다.
-
-
+
\ No newline at end of file diff --git a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.scss b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.scss index e6208221..776b1d9f 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.scss +++ b/projects/ucap-webmessenger-ui/src/lib/components/file-viewer/binary-viewer.component.scss @@ -4,29 +4,61 @@ .ucap-binary-viewer-header { width: 100%; - height: 50px; + height: 60px; + box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6); + background-color: #333333; + color:#ffffff; .ucap-binary-viewer-icon { + margin-right: 10px; } .ucap-binary-viewer-title { + font-size: 16px; } .ucap-binary-viewer-spacer { flex: 1 1 auto; } + .stroke-bar { + width: 1px; + height: 30px; + background-color: rgba(256, 256, 256, 0.3); + margin: 0 10px; + } .ucap-binary-viewer-action { + margin-left: auto; + &:hover { + opacity: 0.7; + } } } .ucap-binary-viewer-body { position: relative; width: 100%; - height: 100%; - background-color: white; + height: calc(100% - 60px); - .ucap-binary-viewer-content-wrapper { + .ucap-image-viewer-image-wrapper { + height: 100%; + padding: 20px; + background-color: rgba(0, 0, 0, 0.9); + } + .circle-box{ + display:flex; + width:140px; + height:140px; + border-radius:50%; + justify-content: center; + align-items: center; + border:2px solid #ffffff; + background-color:rgba(256, 256, 256, 0.6); + } + .guide-msg{ + font-size:16px; + margin:30px; + color:#ffffff; } } } From 0fb8a56a90ec37f81ef4c79c8eee6057da83be0f Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 14 Nov 2019 08:30:59 +0900 Subject: [PATCH 2/6] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=ED=95=A8=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../right-drawer/file-box.component.html | 24 ++++++++----------- .../right-drawer/file-box.component.ts | 20 +++++----------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.html index 2e3a5ced..8341207b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.html @@ -52,28 +52,24 @@ - Name - {{ element.info.name }} - - - Size + + Name + - {{ element.info.size | ucapBytes }} +
+ {{ element.info.name }} +
+
+ {{ element.info.size | ucapBytes }} +
- + sendDate {{ element.info.sendDate | dateToStringFormat: 'YYYY.MM.DD' }} - - receivedUser - - {{ element.info.receivedUserCount }} - - - (); fileInfoTotal: FileInfoTotal[]; @@ -69,7 +63,7 @@ export class FileBoxComponent implements OnInit, OnDestroy { select( AppStore.MessengerSelector.EventSelector.selectAllFileInfoCheckList ) - ), + ) ]) .pipe( tap(() => (this.fileInfoTotal = [])), @@ -91,7 +85,7 @@ export class FileBoxComponent implements OnInit, OnDestroy { info: fileInfo, checkInfo: fileInfoCheckList.filter( checkInfo => checkInfo.seq === fileInfo.seq - ), + ) }); }); @@ -108,10 +102,8 @@ export class FileBoxComponent implements OnInit, OnDestroy { return item.info.size; case 'sendDate': return item.info.sendDate; - case 'receivedUserCount': - return item.info.receivedUserCount; default: - return item[property]; + return item.info[property]; } }; this.dataSource.sort = this.sort; From 08331aadc0b3989391ea5da706cbe13f50ec6365 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 14 Nov 2019 10:31:23 +0900 Subject: [PATCH 3/6] =?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'; From 6550c419a1a750ecf55c65ff737cb4016a0d8f40 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 14 Nov 2019 13:30:28 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=EC=AA=BD=EC=A7=80=20interface=20=EC=88=98?= =?UTF-8?q?=EC=A0=95.=20//=20JSON=20=EA=B0=9D=EC=B2=B4=EB=A5=BC=20raw=20bo?= =?UTF-8?q?dy=20=EC=97=90=20=EC=8B=A4=EC=96=B4=EB=B3=B4=EB=82=B4=EB=8A=94?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=EC=9C=BC=EB=A1=9C=20=EA=B5=AC=ED=98=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/apis/del.ts | 18 +- .../src/lib/apis/detail.ts | 81 +++----- .../src/lib/apis/edit-reservation-ex.ts | 21 +-- .../src/lib/apis/my-message.ts | 69 +++---- .../src/lib/apis/retrieve.ts | 32 +--- .../src/lib/apis/send-copy.ts | 21 +-- .../src/lib/apis/send.ts | 21 +-- .../src/lib/apis/unread-count.ts | 21 +-- .../src/lib/services/message-api.service.ts | 174 ++++++------------ .../ucap-webmessenger-api/src/lib/apis/api.ts | 8 + .../src/lib/types/message-status-code.type.ts | 28 +++ .../ucap-webmessenger-api/src/public-api.ts | 1 + .../right-drawer/message-box.component.ts | 4 +- 13 files changed, 178 insertions(+), 321 deletions(-) create mode 100644 projects/ucap-webmessenger-api/src/lib/types/message-status-code.type.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 index bd7d889b..7f54c02f 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/del.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/del.ts @@ -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 = (req: DelRequest) => { - return ParameterUtil.encode(DelEncodeMap, req); +export const encodeDel: APIJsonEncoder = (req: DelRequest) => { + return JSON.stringify(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 index c083d85e..fdc1b655 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/detail.ts @@ -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 = (req: DetailRequest) => { - return ParameterUtil.encode(DetailEncodeMap, req); +export const encodeDetail: APIJsonEncoder = ( + req: DetailRequest +) => { + return JSON.stringify(req); }; export const decodeDetail: APIDecoder = (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 = (req: ReadRequest) => { - return ParameterUtil.encode(ReadEncodeMap, req); +export const encodeRead: APIJsonEncoder = (req: ReadRequest) => { + return JSON.stringify(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; - +export interface ReadCheckResponse extends MessageAPIResponse { recvList: { userSeq: number; userName: string; @@ -117,9 +99,6 @@ export interface ReadCheckResponse extends APIResponse { export const decodeReadCheck: APIDecoder = (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 = (req: CancelRequest) => { - return ParameterUtil.encode(CancelEncodeMap, req); +export const encodeCancel: APIJsonEncoder = ( + req: CancelRequest +) => { + return JSON.stringify(req); }; export const decodeCancel: APIDecoder = (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 = ( +export const encodeCancelReservation: APIJsonEncoder = ( req: CancelReservationRequest ) => { - return ParameterUtil.encode(CancelReservationEncodeMap, req); + return JSON.stringify(req); }; export const decodeCancelReservation: APIDecoder = ( 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 = ( +export const encodeRetrieveResourceFile: APIJsonEncoder = ( req: RetrieveResourceFileRequest ) => { - return ParameterUtil.encode(RetrieveResourceFileEncodeMap, req); + return JSON.stringify(req); }; export const decodeRetrieveResourceFile: APIDecoder = ( 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 index 2897a2b3..a18a4bb0 100644 --- 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 @@ -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 = ( +export const encodeEditReservation: APIJsonEncoder = ( req: EditReservationRequest ) => { - return ParameterUtil.encode(EditReservationEncodeMap, req); + return JSON.stringify(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 index 6d739c10..b3e3f32a 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/my-message.ts @@ -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 = (req: SaveMyRequest) => { - return ParameterUtil.encode(SaveMyEncodeMap, req); +export const encodeSaveMy: APIJsonEncoder = ( + req: SaveMyRequest +) => { + return JSON.stringify(req); }; export const decodeSaveMy: APIDecoder = (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 = ( +export const encodeRetrieveMy: APIJsonEncoder = ( req: RetrieveMyRequest ) => { - return ParameterUtil.encode(RetrieveMyEncodeMap, req); + return JSON.stringify(req); }; export const decodeRetrieveMy: APIDecoder = (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 = (req: DelMyRequest) => { - return ParameterUtil.encode(DelMyEncodeMap, req); +export const encodeDelMy: APIJsonEncoder = ( + req: DelMyRequest +) => { + return JSON.stringify(req); }; export const decodeDelMy: APIDecoder = (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 = (req: EditMyRequest) => { - return ParameterUtil.encode(EditMyEncodeMap, req); +export const encodeEditMy: APIJsonEncoder = ( + req: EditMyRequest +) => { + return JSON.stringify(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.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts index 3298f1b9..f7bffeee 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/retrieve.ts @@ -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 = ( +export const encodeRetrieve: APIJsonEncoder = ( req: RetrieveRequest ) => { - return ParameterUtil.encode(RetrieveEncodeMap, req); + return JSON.stringify(req); }; -export const encodeRetrieveSearch: APIEncoder = ( +export const encodeRetrieveSearch: APIJsonEncoder = ( req: RetrieveResponse ) => { - return ParameterUtil.encode(RetrieveSearchEncodeMap, req); + return JSON.stringify(req); }; export const decodeRetrieveSend: APIDecoder = (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 = ( 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 = ( 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 = ( res: any ) => { return { - statusCode: res.StatusCode, - errorMessage: res.ErrorMessage, - responseCode: res.responseCode, responseMsg: res.responseMsg, totalCount: res.totalCount, 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 index 6aaf198b..39f7db7c 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/send-copy.ts @@ -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 = ( +export const encodeSendCopy: APIJsonEncoder = ( req: SendCopyRequest ) => { - return ParameterUtil.encode(SendCopyEncodeMap, req); + return JSON.stringify(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 index b5b2c867..662ccfc9 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/send.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/send.ts @@ -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 = (req: SendRequest) => { - return ParameterUtil.encode(SendEncodeMap, req); +export const encodeSend: APIJsonEncoder = (req: SendRequest) => { + return JSON.stringify(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 index 9d347be7..d3f609d9 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/unread-count.ts @@ -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 = ( +export const encodeUnreadCount: APIJsonEncoder = ( req: UnreadCountRequest ) => { - return ParameterUtil.encode(UnreadCountEncodeMap, req); + return JSON.stringify(req); }; export const decodeUnreadCount: APIDecoder = ( res: any ) => { return { - statusCode: res.StatusCode, - errorMessage: res.ErrorMessage, - responseCode: res.responseCode, responseMsg: res.responseMsg, unreadCount: res.unreadCount 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 0ee338a3..3fc223d7 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 @@ -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 { return this.httpClient - .post( - this.urls.retrieveSendMessageList, - {}, - { - params: encodeRetrieve(req) - } - ) + .post(this.urls.retrieveSendMessageList, encodeRetrieve(req), { + headers: this.headers + }) .pipe(map(res => decodeRetrieveSend(res))); } public retrieveReceiveMessage( req: RetrieveRequest ): Observable { return this.httpClient - .post( - this.urls.retrieveRecvMessageList, - {}, - { - params: encodeRetrieve(req) - } - ) + .post(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( 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 { return this.httpClient - .post( - this.urls.retrieveSearchMessage, - {}, - { - params: encodeRetrieve(req) - } - ) + .post(this.urls.retrieveSearchMessage, encodeRetrieve(req), { + headers: this.headers + }) .pipe(map(res => decodeRetrieveSearch(res))); } /** send */ public sendMessage(req: SendRequest): Observable { return this.httpClient - .post( - this.urls.sendNewMessage, - {}, - { - params: encodeSend(req) - } - ) + .post(this.urls.sendNewMessage, encodeSend(req), { + headers: this.headers + }) .pipe(map(res => decodeSend(res))); } /** detail */ public detailMessage(req: DetailRequest): Observable { return this.httpClient - .post( - this.urls.retrieveMessageDetail, - {}, - { - params: encodeDetail(req) - } - ) + .post(this.urls.retrieveMessageDetail, encodeDetail(req), { + headers: this.headers + }) .pipe(map(res => decodeDetail(res))); } public readMessage(req: ReadRequest): Observable { return this.httpClient - .post( - this.urls.readMessage, - {}, - { - params: encodeRead(req) - } - ) + .post(this.urls.readMessage, encodeRead(req), { + headers: this.headers + }) .pipe(map(res => decodeRead(res))); } public retrieveReadCheck(req: ReadRequest): Observable { return this.httpClient - .post( - this.urls.retrieveReadCheck, - {}, - { - params: encodeRead(req) - } - ) + .post(this.urls.retrieveReadCheck, encodeRead(req), { + headers: this.headers + }) .pipe(map(res => decodeReadCheck(res))); } public cancelMessage(req: CancelRequest): Observable { return this.httpClient - .post( - this.urls.cancelMessage, - {}, - { - params: encodeCancel(req) - } - ) + .post(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( 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( 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 { return this.httpClient - .post( - this.urls.deleteMessage, - {}, - { - params: encodeDel(req) - } - ) + .post(this.urls.deleteMessage, encodeDel(req), { + headers: this.headers + }) .pipe(map(res => decodeDel(res))); } /** save my message */ public saveMyMessage(req: SaveMyRequest): Observable { return this.httpClient - .post( - this.urls.saveMyMessage, - {}, - { - params: encodeSaveMy(req) - } - ) + .post(this.urls.saveMyMessage, encodeSaveMy(req), { + headers: this.headers + }) .pipe(map(res => decodeSaveMy(res))); } public retrieveMyMessage( req: RetrieveMyRequest ): Observable { return this.httpClient - .post( - this.urls.retrieveMyMessage, - {}, - { - params: encodeRetrieveMy(req) - } - ) + .post(this.urls.retrieveMyMessage, encodeRetrieveMy(req), { + headers: this.headers + }) .pipe(map(res => decodeRetrieveMy(res))); } public deleteMyMessage(req: DelMyRequest): Observable { return this.httpClient - .post( - this.urls.deleteMyMessage, - {}, - { - params: encodeDelMy(req) - } - ) + .post(this.urls.deleteMyMessage, encodeDelMy(req), { + headers: this.headers + }) .pipe(map(res => decodeDelMy(res))); } public editMyMessage(req: EditMyRequest): Observable { return this.httpClient - .post( - this.urls.editMyMessage, - {}, - { - params: encodeEditMy(req) - } - ) + .post(this.urls.editMyMessage, encodeEditMy(req), { + headers: this.headers + }) .pipe(map(res => decodeEditMy(res))); } @@ -309,9 +263,9 @@ export class MessageApiService { return this.httpClient .post( 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 { return this.httpClient - .post( - this.urls.sendCopyMessage, - {}, - { - params: encodeSendCopy(req) - } - ) + .post(this.urls.sendCopyMessage, encodeSendCopy(req), { + headers: this.headers + }) .pipe(map(res => decodeSendCopy(res))); } @@ -335,13 +285,9 @@ export class MessageApiService { req: UnreadCountRequest ): Observable { return this.httpClient - .post( - this.urls.retrieveUnreadCount, - {}, - { - params: encodeUnreadCount(req) - } - ) + .post(this.urls.retrieveUnreadCount, encodeUnreadCount(req), { + headers: this.headers + }) .pipe(map(res => decodeUnreadCount(res))); } } diff --git a/projects/ucap-webmessenger-api/src/lib/apis/api.ts b/projects/ucap-webmessenger-api/src/lib/apis/api.ts index 95fef371..c4d7e709 100644 --- a/projects/ucap-webmessenger-api/src/lib/apis/api.ts +++ b/projects/ucap-webmessenger-api/src/lib/apis/api.ts @@ -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) => HttpParams; +export type APIJsonEncoder = (req: REQ) => string; + export type APIFormDataEncoder = (req: REQ) => FormData; export type APIDecoder = (res: any) => RES; diff --git a/projects/ucap-webmessenger-api/src/lib/types/message-status-code.type.ts b/projects/ucap-webmessenger-api/src/lib/types/message-status-code.type.ts new file mode 100644 index 00000000..72a13998 --- /dev/null +++ b/projects/ucap-webmessenger-api/src/lib/types/message-status-code.type.ts @@ -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' +} diff --git a/projects/ucap-webmessenger-api/src/public-api.ts b/projects/ucap-webmessenger-api/src/public-api.ts index 1482b72c..e9af4d09 100644 --- a/projects/ucap-webmessenger-api/src/public-api.ts +++ b/projects/ucap-webmessenger-api/src/public-api.ts @@ -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'; 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 5ec87174..d5735021 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 @@ -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 { } }), From 9ec163bac6207e9b558aaa2ce9a305bc0993d93a Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 14 Nov 2019 14:19:59 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=EC=8B=9C=20Alert=20=EC=B2=98=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/login.page.component.html | 2 + .../components/login.page.component.ts | 107 +++++++++++++++++- .../store/account/authentication/actions.ts | 11 +- .../store/account/authentication/effects.ts | 36 +++--- .../store/account/authentication/reducers.ts | 21 +++- .../app/store/account/authentication/state.ts | 6 + .../src/lib/utils/string.util.ts | 19 +++- .../src/lib/components/login.component.html | 21 +++- .../src/lib/components/login.component.ts | 8 ++ 9 files changed, 201 insertions(+), 30 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html index d661507a..ba2d664c 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html +++ b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.html @@ -2,6 +2,8 @@