@@ -410,7 +410,23 @@ myservice_router = Router(myservice_routes)
410410app.mount(" /api/env/{env_id} /services/myservice" , myservice_router)
411411```
412412
413- ** 5. Write a seed script** in ` backend/utils/seed_myservice_template.py ` that:
413+ ** 5. Register the service with the platform API** in ` src/platform/api/models.py ` .
414+ Add it to the ` Service ` enum so ` initEnv ` (and other platform endpoints that take
415+ a ` templateService ` ) will accept the new value:
416+
417+ ``` python
418+ class Service (str , Enum ):
419+ slack = " slack"
420+ linear = " linear"
421+ calendar = " calendar"
422+ box = " box"
423+ myservice = " myservice" # ← add this
424+ ```
425+
426+ If you skip this step, ` POST /api/platform/initEnv ` returns a Pydantic enum
427+ validation error even though the template rows exist and the router is mounted.
428+
429+ ** 6. Write a seed script** in ` backend/utils/seed_myservice_template.py ` that:
414430- Creates the PostgreSQL schema (e.g. ` myservice_default ` )
415431- Uses ` Base.metadata.create_all() ` to create tables
416432- Inserts seed data from a JSON file
@@ -419,10 +435,10 @@ app.mount("/api/env/{env_id}/services/myservice", myservice_router)
419435Follow ` seed_slack_template.py ` as a reference — it shows the full pattern including
420436schema creation, table ordering, and template registration.
421437
422- ** 6 . Add seed data** in ` examples/myservice/seeds/myservice_default.json ` and copy to
438+ ** 7 . Add seed data** in ` examples/myservice/seeds/myservice_default.json ` and copy to
423439` backend/seeds/myservice/ ` for Docker builds.
424440
425- ** 7 . Register the seed script** in the Docker startup command in ` ops/docker-compose.yml ` :
441+ ** 8 . Register the seed script** in the Docker startup command in ` ops/docker-compose.yml ` :
426442
427443``` yaml
428444command : >
0 commit comments