예제 #1
0
def get_objects(user_id, limit=20, offset=0):
    entity = task_service.get_objects(user_id=user_id,
                                      limit=limit,
                                      offset=offset)
    return BusinessResponse(is_success=True,
                            action=BusinessAction.RESOURCE_READ,
                            instance=entity)
def update(todo_bucket_entity, update_fields=None):
    to_update = {
        field: getattr(todo_bucket_entity, field)
        for field in update_fields
    }
    entity = todo_bucket_service.update(pk=todo_bucket_entity.pk, **to_update)
    return BusinessResponse(is_success=True,
                            action=BusinessAction.RESOURCE_UPDATED,
                            instance=entity)
예제 #3
0
def create(task_entity):
    entity = task_service.create(task_entity=task_entity)
    return BusinessResponse(is_success=True,
                            instance=entity,
                            action=BusinessAction.RESOURCE_CREATED)
예제 #4
0
def delete(pk):
    task_service.delete(pk=pk)
    return BusinessResponse(is_success=True,
                            action=BusinessAction.RESOURCE_DELETED)
예제 #5
0
def get(pk):
    entity = task_service.get(pk=pk)
    return BusinessResponse(is_success=True,
                            instance=entity,
                            action=BusinessAction.RESOURCE_READ)
def create(todo_bucket_entity):
    entity = todo_bucket_service.create(todo_bucket_entity=todo_bucket_entity)
    instance = BusinessResponse(is_success=True,
                                instance=entity,
                                action=BusinessAction.RESOURCE_CREATED)
    return instance