示例#1
0
def create(call: APICall):
    identity = call.identity

    with translate_errors_context():
        fields = parse_from_call(call.data, create_fields,
                                 Project.get_fields())
        conform_tag_fields(call, fields, validate=True)

        return IdResponse(id=ProjectBLL.create(
            user=identity.user,
            company=identity.company,
            **fields,
        ))
示例#2
0
def update(call: APICall):
    """
    update

    :summary: Update project information.
              See `project.create` for parameters.
    :return: updated - `int` - number of projects updated
             fields - `[string]` - updated fields
    """
    fields = parse_from_call(call.data,
                             create_fields,
                             Project.get_fields(),
                             discard_none_values=False)
    conform_tag_fields(call, fields, validate=True)
    updated = ProjectBLL.update(company=call.identity.company,
                                project_id=call.data["project"],
                                **fields)
    conform_output_tags(call, fields)
    call.result.data_model = UpdateResponse(updated=updated, fields=fields)