Example #1
0
    def post(self):
        student_id = get_jwt_identity()
        date = request.json['date']
        reason = request.json['reason']

        GoingOutApplyModel.post_going_out_apply(student_id, date, reason)
        return Response('', 201)
Example #2
0
    def delete(self):
        student_id = get_jwt_identity()
        request_time = self.kst_now()
        if not (request_time.weekday() <= 4 or request_time.hour <= 21):
            raise ApplyTimeException()

        apply_id = request.json['applyId']

        GoingOutApplyModel.delete_going_out_apply(apply_id, student_id)

        return Response('', 200)
Example #3
0
    def patch(self):
        request_time = self.kst_now()
        date = request.json['date']
        go_out_date = datetime.strptime(date[:11], '%m-%d %H:%M')

        if request_time.weekday() == go_out_date.weekday():
            raise ApplyTimeException()

        if not (request_time.weekday() <= 4 or request_time.hour <= 21):
            raise ApplyTimeException()

        apply_id = request.json['applyId']
        reason = request.json['reason']
        student_id = get_jwt_identity()

        GoingOutApplyModel.patch_going_out_apply(apply_id, student_id, date,
                                                 reason)
        return Response('', 201)
    def test_success_get_going_out_info(self):
        apply = [
            {
                'goOutDate': '2019-01-01 12:30:00',
                'returnDate': '2019-01-01 17:30:00',
                'reason': '영화 관람'
            }
        ]

        GoingOutApplyModel.post_goingout_apply(
            'test',
            datetime(2019, 1, 1, 12, 30),
            datetime(2019, 1, 1, 17, 30),
            '영화 관람'
        )
        rv = self.request_apply_info(self.access_token)

        self.assertListEqual(apply, rv.json['goingOut'])
        return rv
Example #5
0
    def get(self):
        student_id = get_jwt_identity()

        apply_info = dict(
            extension11=ExtensionApplyModel.get_extension_apply_status(
                student_id, 11),
            extension12=ExtensionApplyModel.get_extension_apply_status(
                student_id, 12),
            goingOut=GoingOutApplyModel.get_going_out_apply(student_id),
            stay=StayApplyModel.get_stay_apply_status(student_id)['value'])
        return jsonify(apply_info)
Example #6
0
    def get(self):
        student_id = get_jwt_identity()
        going_out_applies = GoingOutApplyModel.get_going_out_apply(student_id)

        return jsonify(going_out_applies)