mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-01 04:49:36 +00:00
Address PR review: rename to eda_visibility, merge migrations, API versioning
Changes based on jbtronics' review of PR #1241: - Rename kicad_export -> eda_visibility (entities, forms, templates, translations, tests) with nullable bool for system default support - Merge two database migrations into one (Version20260211000000) - Rename createCachedJsonResponse -> createCacheableJsonResponse - Change bool $apiV2 -> int $apiVersion with version validation - EDA visibility field only shown for part parameters, not other entities - PopulateKicadCommand: check alternative names of footprints/categories - PopulateKicadCommand: support external JSON mapping file (--mapping-file) - Ship default mappings JSON at contrib/kicad-populate/default_mappings.json - Add system-wide defaultEdaVisibility setting in KiCadEDASettings - Add KiCad HTTP Library v2 spec link in controller docs
This commit is contained in:
parent
06c6542438
commit
ae7e31f0bd
17 changed files with 532 additions and 177 deletions
|
|
@ -62,7 +62,7 @@ class KiCadApiController extends AbstractController
|
|||
$this->denyAccessUnlessGranted('@categories.read');
|
||||
|
||||
$data = $this->kiCADHelper->getCategories();
|
||||
return $this->createCachedJsonResponse($request, $data, 300);
|
||||
return $this->createCacheableJsonResponse($request, $data, 300);
|
||||
}
|
||||
|
||||
#[Route('/parts/category/{category}.json', name: 'kicad_api_category')]
|
||||
|
|
@ -77,7 +77,7 @@ class KiCadApiController extends AbstractController
|
|||
|
||||
$minimal = $request->query->getBoolean('minimal', false);
|
||||
$data = $this->kiCADHelper->getCategoryParts($category, $minimal);
|
||||
return $this->createCachedJsonResponse($request, $data, 300);
|
||||
return $this->createCacheableJsonResponse($request, $data, 300);
|
||||
}
|
||||
|
||||
#[Route('/parts/{part}.json', name: 'kicad_api_part')]
|
||||
|
|
@ -86,14 +86,14 @@ class KiCadApiController extends AbstractController
|
|||
$this->denyAccessUnlessGranted('read', $part);
|
||||
|
||||
$data = $this->kiCADHelper->getKiCADPart($part);
|
||||
return $this->createCachedJsonResponse($request, $data, 60);
|
||||
return $this->createCacheableJsonResponse($request, $data, 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a JSON response with HTTP cache headers (ETag and Cache-Control).
|
||||
* Returns 304 Not Modified if the client's ETag matches.
|
||||
*/
|
||||
private function createCachedJsonResponse(Request $request, array $data, int $maxAge): Response
|
||||
private function createCacheableJsonResponse(Request $request, array $data, int $maxAge): Response
|
||||
{
|
||||
$response = new JsonResponse($data);
|
||||
$response->setEtag(md5(json_encode($data)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue