clj / kom2

Interface KiCad database libraries with non-ODBC systems using magic
MIT License
6 stars 1 forks source link

Perform fetches for parts with parameters enabled #6

Open clj opened 1 year ago

clj commented 1 year ago

e.g.: https://inventree.server/api/part/123/?parameters=1

clj commented 1 year ago

I can't just replace this with what I had before, since the parameters returned do not return the template_detail.

GET /api/part/31/?parameters=1

    "parameters": [
            {
                "pk": 127,
                "part": 31,
                "template": 50,
                "data": "SK33A-LTP"
            },

GET /api/part/parameter/?part=31

[
    {
        "pk": 127,
        "part": 31,
        "template": 50,
        "template_detail": {
            "pk": 50,
            "name": "Value",
            "units": "",
            "description": ""
        },
        "data": "SK33A-LTP"
    },

This might be ok, as long as I pre-fetch the templates. The templates are probably not updated a lot, so it is probably not necessary to re-fetch them. One could do that if a new ID that is not in the cache is encountered.