Skip to content

Commit

Permalink
feat: update route and swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-hh-aa committed Dec 19, 2024
1 parent 8f12f20 commit 85d73f4
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions api.planx.uk/modules/analytics/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -18,6 +38,7 @@ paths:
responses:
"204":
$ref: "#/components/responses/AnalyticsResponse"

/analytics/log-user-resume:
post:
summary: Log user resume
Expand All @@ -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
2 changes: 1 addition & 1 deletion api.planx.uk/modules/analytics/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ router.post(
logUserResumeController,
);
router.post(
"/collection",
"/metabase/collection",
validate(createTeamCollectionSchema),
metabaseCollectionsController,
);
Expand Down

0 comments on commit 85d73f4

Please sign in to comment.