# Template Library
Template library is built to support administrator creating new experience in Practera 2.
Administrator, author or coordinator can create a new experience from a template.
# Create Template
# Create Private(Custom) Template
- Private template is only visible to people in the same institution.
- Only Administrator(Institution Admin) can create a private template
- UI workflow
- On the "my experiences" page, click the
...
of an experience card. - Choose "Create template".
- Fill in the name of the template.
- Click "Create template".
- A private template will be created.
- On the "my experiences" page, click the
- API Logic
- When user click "Create template" button, it will send a request to GraphQL
mutation exportExperience
- Inside GraphQL, it will send a request to CORE API to get the experience data.
- Then GraphQL will send a request to template library API
POST /template
to create the template - Template library API will create the template in a global Dynamodb
- When user click "Create template" button, it will send a request to GraphQL
# Create Public Template
- Public template is visible to anyone.
- Public template can only be created via a manual request to the API by a Practera internal team member.
- There is no UI to create a public template.
- A Practera internal team member will need to send a request to GraphQL
mutation exportExperience
with a "system" jwt(role: 'system'
in payload) - API logic is same as above
# Show Template
- Templates will be displayed in the template library UI (in "my experience" page, click the button to create experience)
- GraphQL API
query templates
is used to query the templates - Inside GraphQL, it will send request to template-lib-api
GET /templates
to get the templates
# Use Template
- On the template detail page, click "Use Template" to create a new experience with the template.
query importExperienceUrl
will be requested to get a url to create the experience.- When front-end get the url, it will use this url to create an SSE event to the CORE to create the experience.
- The progress of the creation will be passed through the SSE, so that front-end will display the progress bar to indicate the progress.
- Once the creation of experience finished, front-end will redirect user to the experience design page.
# Delete Template
- Only Administrator(Institution Admin) can delete private template in the institution.
- On the template detail page, click "Delete Template" to delete the template
mutation deleteTemplate
will be requested to delete the template
- Currently there's no UI to delete a public template.
- To delete a public template, we need a Practera team member to trigger it manually.
- Similar to create public template, a "system" jwt is required to delete a public template.