docs(testing): document plan creation via PlanAction JWT route
Plans are created by importing JWT claims with @type: PlanAction via POST /api/v2/claim, not through a dedicated plan creation endpoint. Changes: - Document POST /api/v2/claim route in localhost-testing-guide.md - Add Method 6 (PlanAction JWT import) to getting-valid-plan-ids.md - Update seed-test-projects.js with warnings about PlanAction JWT requirements - Clarify that seed script cannot create plans (requires DID signing) This reflects the actual TimeSafari API architecture where plans are created as a side effect of importing PlanAction claims.
This commit is contained in:
@@ -129,7 +129,15 @@ function generateAllTestProjects(projectIds = DEFAULT_TEST_PROJECT_IDS) {
|
||||
/**
|
||||
* Seed projects to localhost API server
|
||||
*
|
||||
* Makes POST requests to create projects in your local API
|
||||
* **IMPORTANT**: The TimeSafari API creates plans via POST `/api/v2/claim` with PlanAction JWTs.
|
||||
* This function attempts to POST to `/api/test/seed-projects` if your API has a custom test seed endpoint.
|
||||
*
|
||||
* For real TimeSafari APIs:
|
||||
* 1. Create plans via the TimeSafari app UI (recommended)
|
||||
* 2. Import PlanAction JWTs via POST `/api/v2/claim` (requires DID signing)
|
||||
* 3. Use direct database inserts (not recommended)
|
||||
*
|
||||
* This seed function is primarily for custom test endpoints or the test-api-server-with-seed.js
|
||||
*/
|
||||
function seedToLocalhost(apiUrl, projectIds = DEFAULT_TEST_PROJECT_IDS) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -140,6 +148,14 @@ function seedToLocalhost(apiUrl, projectIds = DEFAULT_TEST_PROJECT_IDS) {
|
||||
console.log(` ${index + 1}. ${project.planSummary.handleId} - ${project.planSummary.name}`);
|
||||
});
|
||||
|
||||
console.log('');
|
||||
console.log('⚠️ NOTE: This attempts to POST to /api/test/seed-projects');
|
||||
console.log(' If your API doesn\'t have this endpoint, create plans via:');
|
||||
console.log(' 1. TimeSafari App UI (easiest)');
|
||||
console.log(' 2. POST /api/v2/claim with PlanAction JWT (requires DID signing)');
|
||||
console.log(' 3. Direct database inserts');
|
||||
console.log('');
|
||||
|
||||
// If your API has a seed endpoint, use this:
|
||||
const seedUrl = `${apiUrl}/api/test/seed-projects`;
|
||||
const postData = JSON.stringify({ projects });
|
||||
|
||||
Reference in New Issue
Block a user