From f3e662798b3b83a83c2d60dc7b4e6cf1ee4f1331 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期六, 05 八月 2023 16:35:00 +0800
Subject: [PATCH] Fixed: [弱掃] p8.2 Bad use of null-like value

---
 PAMapp/shared/services/appointment.service.ts |   84 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/PAMapp/shared/services/appointment.service.ts b/PAMapp/shared/services/appointment.service.ts
index a97c333..e56a270 100644
--- a/PAMapp/shared/services/appointment.service.ts
+++ b/PAMapp/shared/services/appointment.service.ts
@@ -1,6 +1,6 @@
 import { http } from "./httpClient";
 
-import { Appointment, AppointmentDetail, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams, updatedMemoInfo } from "~/shared/models/appointment.model";
+import { Appointment, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams,  InterviewRecordInfo, ToCloseAppointment, ToDoneAppointment, ToInformAppointment, updatedMemoInfo, UpdateInterviewRecordInfo } from "~/shared/models/appointment.model";
 
 class AppointmentService {
 
@@ -26,7 +26,7 @@
   }
 
   // �����蝝啁�
-  async getAppointmentDetail(appointmentId: number):Promise<AppointmentDetail> {
+  async getAppointmentDetail(appointmentId: number):Promise<Appointment> {
     return http.get(`/appointment/getDetail/${appointmentId}`).then((res) => res.data);
   }
 
@@ -40,20 +40,88 @@
     return http.put('/appointment', editAppointmentParams);
   }
 
-  // �憓酉閮�
-  createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> {
-    return http.post('/appointment/memo/create', memoInfo).then(res => res.data);
+  /**
+   * �憓酉閮�
+   * @param memoInfo ���憓酉閮�����隞�
+   * @returns ���憓�酉閮���
+   */
+  async createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> {
+    try {
+      const response = await http.post('/appointment/memo/create', memoInfo);
+      if (response !== null) {
+        return response.data;
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      // �隞亙甇方���隤斗����身��
+      console.error('An error occurred while creating memo:', error);
+      throw error;
+    }
   }
 
-  // 蝺刻摩閮餉��
-  updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> {
-    return http.post('/appointment/memo/update', memoInfo).then(res => res.data);
+
+  /**
+   * 蝺刻摩閮餉��
+   * @param memoInfo ��蝺刻摩閮餉������隞�
+   * @returns ����敺�酉閮���
+   */
+  async updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> {
+    try {
+      const response = await http.post('/appointment/memo/update', memoInfo);
+      if (response !== null) {
+        return response.data;
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      // �隞亙甇方���隤斗����身��
+      console.error('An error occurred while updating memo:', error);
+      throw error;
+    }
   }
+
 
   // ��閮餉��
   deleteMemo(appointmentMemoId: number) {
     return http.delete(`/appointment/memo/${appointmentMemoId}`)
   }
+
+  // ���蝯��, ��蝯��敦
+  async closeAppointment(appointmentInfo: ToDoneAppointment | ToCloseAppointment) {
+    return http.post(`/appointment/close`, appointmentInfo).then((res) => res.data);
+  }
+
+  // 蝝赤� API
+  async informAppointment(appointmentInformation: ToInformAppointment) {
+    return http.post(`/notice/send`, appointmentInformation).then((res) => res.data);
+  }
+
+  // �憓�赤閮��
+  async createInterviewRecord(interviewRecordInfo: InterviewRecordInfo) {
+    return http.post('/interview_record/create', interviewRecordInfo).then(res => res.data);
+  }
+
+  // 靽格蝝赤閮��
+  async updateInterviewRecord(updateInterviewRecordInfo: UpdateInterviewRecordInfo) {
+    return http.post('/interview_record/update', updateInterviewRecordInfo)
+  }
+
+  // ��蝝赤閮��
+  async deleteInterviewRecord(interviewRecordId) {
+    return http.delete(`/interview_record/${interviewRecordId}`);
+  }
+
+  // 摰X��������������
+  async getNotContactAppointment(): Promise<Appointment> {
+    return http.get(`/appointment/customer/expiring/newest`).then((res) => res.data);
+  }
+
+  // 憿批������������
+  async getPendingAppointmentSum(): Promise<number> {
+    return http.get(`/appointment/consultant/pending/sum`).then((res) => res.data)
+  }
+
 }
 
 export default new AppointmentService();

--
Gitblit v1.8.0