rorybyrne / aylientask

An implementation of the AYLIEN API development task
0 stars 0 forks source link

The `paint` app should have a new API for computing batches #9

Open rorybyrne opened 4 years ago

rorybyrne commented 4 years ago

This new API should be accessible at /v2/paint/batches

rorybyrne commented 4 years ago

/time 6h

(this task and the format-translation task will probably be done simultaneously)

rorybyrne commented 4 years ago

Full text version of v1

This is an extrapolated, elaborate version of the existing API.

Input

{
    "num_colors": 5,
    "num_customers": 3,
    "customers": [
        {
            "preferred_paints_count": 1,
            "preferred_paints": [
                {
                    "color_code": 1,
                    "type": "matte"
                }
            ]
        },
        {
            "preferred_paints_count": 2,
            "preferred_paints": [
                {
                    "color_code": 1,
                    "type": "glossy"
                },
                {
                    "color_code": 2,
                    "type": "glossy"
                }
            ]
        },
        {
            "preferred_paints_count": 1,
            "preferred_paints": [
                {
                    "color_code": 5,
                    "type": "glossy"
                }
            ]
        },
    ]
}

Output

{
    "batches": [
        {
            "color_code": 0,
            "type": "matte"
        },
        {
            "color_code": 1,
            "type": "glossy"
        },
        {
            "color_code": 2,
            "type": "glossy"
        },
        {
            "color_code": 3,
            "type": "glossy"
        },
        {
            "color_code": 4,
            "type": "glossy"
        },
    ]
}