setTeacherMealException method

dynamic setTeacherMealException(
  1. List<MealType> mealTypeList,
  2. List<String> dateList,
  3. List<MealExceptionType> exceptionTypeList,
  4. String reason,
  5. List<int> studentUidList,
)

선생님이 학생에게 선/후밥을 부여하는 함수입니다.

Implementation

setTeacherMealException(List<MealType> mealTypeList, List<String> dateList, List<MealExceptionType> exceptionTypeList, String reason, List<int> studentUidList) async {
  try {
    Response response = await _dio.post(
      "$apiUrl/dalgeurak/exception/instead",
      options: Options(contentType: "application/json"),
      data: {
        "applier": studentUidList[0],
        "reason": reason,
        "group": studentUidList.length > 1,
        "appliers": studentUidList,
        "time": mealTypeList.map((e) => e.convertEngStr).toList(),
        "date": dateList,
        "type": exceptionTypeList.map((e) => e.convertStr).toList(),
      },
    );

    return {
      "success": true,
      "content": response.data['date']
    };
  } on DioError catch (e) {
    return {
      "success": false,
      "content": e.response?.data["message"]
    };
  }
}