Beispiel #1
0
 def get(self, args):
     _, start, end, _ = request_event(args)
     data_list = []
     if start is not None and end is not None:
         data_list = self.collection.find(
             {'start': {
                 "$gte": start,
                 "$lt": end
             }}, sort=[('id', 1)])
     return data_list
Beispiel #2
0
    def delete(self, args):
        title, _, _, event_id = request_event(args)

        data = self.collection.find_one({'id': event_id})
        start = data['start']
        end = data['end']
        self.collection.delete_one({'id': event_id})

        # calendar 일정이 변경 되면 그에 따라서 report 내용도 update 하기 위함
        self.update_report(start=start, end=end)
        return start, end
Beispiel #3
0
    def insert(self, args):
        title, start, end, event_id = request_event(args)
        request_data = {'title': title, 'start': start, 'end': end, 'id': event_id}

        if event_id is None:
            data = self.collection.find_one(sort=[('id', -1)])
            if data:
                request_data['id'] = data['id'] + 1
            else:
                request_data['id'] = 1
            self.collection.insert_one(request_data)
        else:
            self.collection.update_one({'id': event_id}, {'$set': request_data}, upsert=True)
        # calendar 일정이 변경 되면 그에 따라서 report 내용도 update 하기 위함
        self.update_report(start=start, end=end)