diff --git a/api.planx.uk/modules/analytics/docs.yaml b/api.planx.uk/modules/analytics/docs.yaml index bfd6f25e0a..1ee84da3a0 100644 --- a/api.planx.uk/modules/analytics/docs.yaml +++ b/api.planx.uk/modules/analytics/docs.yaml @@ -2,12 +2,32 @@ openapi: 3.1.0 info: title: Planâś• API version: 0.1.0 + tags: - name: analytics + - name: metabase + components: responses: AnalyticsResponse: description: Successful response with no content. Not awaited from server as endpoint is called via the Beacon API + + schemas: + NewCollection: + type: object + required: + - slug + properties: + slug: + type: string + description: Name of the collection + description: + type: string + description: Optional description for the collection + parentId: + type: integer + description: Optional ID of the parent collection + paths: /analytics/log-user-exit: post: @@ -18,6 +38,7 @@ paths: responses: "204": $ref: "#/components/responses/AnalyticsResponse" + /analytics/log-user-resume: post: summary: Log user resume @@ -27,3 +48,36 @@ paths: responses: "204": $ref: "#/components/responses/AnalyticsResponse" + + /metabase/collection: + post: + summary: Create new Metabase collection + description: Creates a new collection in Metabase if it doesn't already exist + tags: + - metabase + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/NewCollection" + responses: + "201": + description: Collection created successfully + content: + application/json: + schema: + type: object + properties: + data: + $ref: "#/components/schemas/NewCollection" + "400": + description: Bad request or collection creation failed + content: + application/json: + schema: + type: object + properties: + error: + type: string + description: Error message diff --git a/api.planx.uk/modules/analytics/routes.ts b/api.planx.uk/modules/analytics/routes.ts index 0b34bce347..e4c9dbdb1f 100644 --- a/api.planx.uk/modules/analytics/routes.ts +++ b/api.planx.uk/modules/analytics/routes.ts @@ -21,7 +21,7 @@ router.post( logUserResumeController, ); router.post( - "/collection", + "/metabase/collection", validate(createTeamCollectionSchema), metabaseCollectionsController, );