Skip to content

Commit 2bde94e

Browse files
author
Anmol Gangwar
committed
chore(route): ⚡ refactor usecases to use load.ts
1 parent 0e67988 commit 2bde94e

File tree

18 files changed

+216
-323
lines changed

18 files changed

+216
-323
lines changed

src/app.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export class App {
5353
// this.app.use(authMiddleware)
5454
}
5555

56-
private initializeSwaggerUI() {
56+
private initializeSwaggerUI(): void {
57+
// OpenAPI documentation for v1
5758
this.app.doc31('/swagger', (c) => {
5859
const { protocol: urlProtocol, hostname, port } = new URL(c.req.url)
5960
const protocol = c.req.header('x-forwarded-proto') ? `${c.req.header('x-forwarded-proto')}:` : urlProtocol
@@ -62,39 +63,49 @@ export class App {
6263
openapi: '3.1.0',
6364
info: {
6465
version: '1.0.0',
65-
title: 'ExerciseDB API',
66-
description: `# Introduction
67-
\nExerciseDB API, accessible at [v1.exercisedb.dev](https://v1.exercisedb.dev), is an exercises API that allows users to access high-quality exercises data which consists 1300+ exercises.
68-
This API offers extensive information on each exercise, including target body parts, equipment needed, GIFs for visual guidance, and step-by-step instructions.\n`
69-
},
66+
title: 'ExerciseDB API - v1 (Open Source)',
67+
description: `**ExerciseDB API v1** is a fully open-source and developer-friendly fitness exercise database featuring over 1,500 structured exercises with **GIF-based visual media**. It includes detailed metadata like target muscles, equipment, and body parts, designed for fast integration into fitness apps, personal trainer platforms, and health tools.
68+
69+
**📝 NOTE**: This version is public, free to use, and includes both the **code and dataset metadata** — making it perfect for personal projects, prototypes, learning, and community-driven apps.
7070
71+
🔗 Useful Links:
72+
- 💬 Need full v1 Dataset access: [Chat](https://t.me/exercisedb)
73+
- 🚀 Explore our new v2 dataset: [v2.exercisedb.dev](https://v2.exercisedb.dev)
74+
- 🌐 Official Website: [exercisedb.dev](https://exercisedb.dev)`
75+
},
7176
servers: [
7277
{
7378
url: `${protocol}//${hostname}${port ? `:${port}` : ''}`,
74-
description: 'Current environment'
79+
description:
80+
'v1 Dataset (Open Source)\n• Public & open license\n• Code and metadata available on GitHub\n• GIF-based media\n• Ideal for demos, personal apps, and learning\n• chat support for full dataset access'
7581
}
7682
]
7783
}
7884
})
7985

86+
// API Documentation UI
8087
this.app.get(
8188
'/docs',
8289
Scalar({
83-
pageTitle: 'ExerciseDB API Documentation',
84-
theme: 'bluePlanet',
90+
pageTitle: 'ExerciseDB API - v1 (Open Source)',
91+
theme: 'kepler',
8592
isEditable: false,
8693
layout: 'modern',
8794
darkMode: true,
8895
url: '/swagger',
8996
favicon: 'https://cdn.exercisedb.dev/exercisedb/favicon.ico',
9097
metaData: {
91-
applicationName: 'ExerciseDB API',
92-
author: 'ExerciseDB API',
93-
creator: 'ExerciseDB API',
94-
publisher: 'ExerciseDB API',
98+
applicationName: 'ExerciseDB API - v1',
99+
author: 'Ascend API',
100+
creator: 'Ascend API',
101+
publisher: 'Ascend API',
95102
robots: 'index follow',
96-
description:
97-
'Access detailed data on over 1300+ exercises with the ExerciseDB API. This API offers extensive information on each exercise, including target body parts, equipment needed, GIFs for visual guidance, and step-by-step instructions.'
103+
description: `**ExerciseDB API v1** is a fully open-source exercise dataset offering 1,300+ exercises with rich metadata and GIF visualizations. Built for speed and ease of use, it's ideal for personal projects, prototypes, and education.
104+
105+
🔗 Useful Links:
106+
- 💬 Chat with us for full GIF access: [Telegram](https://t.me/exercisedb)
107+
- 🚀 Explore our new v2 dataset: [v2.exercisedb.dev](https://v2.exercisedb.dev)
108+
- 🌐 Official Website: [exercisedb.dev](https://exercisedb.dev)`
98109
}
99110
})
100111
)

src/data/types.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,52 @@ export interface Equipment {
33
}
44

55
export interface Exercise {
6+
/**
7+
* The id of the exercise
8+
* @example "trmte8s"
9+
*/
610
exerciseId: string
11+
12+
/**
13+
* The name of the exercise.
14+
* @example "band shrug"
15+
*/
716
name: string
17+
18+
/**
19+
* The gifUrl of the exercise.
20+
* @example "https://v1.cdn.exercisedb.dev/media/trmte8s.gif"
21+
*/
822
gifUrl: string
23+
24+
/**
25+
* List of equipment required for the exercise.
26+
* @example ["band"]
27+
*/
928
equipments: string[]
29+
30+
/**
31+
* Primary body parts targeted by the exercise.
32+
* @example ["back"]
33+
*/
1034
bodyParts: string[]
35+
36+
/**
37+
* Primary muscles targeted by the exercise.
38+
* @example ["traps"]
39+
*/
1140
targetMuscles: string[]
41+
42+
/**
43+
* Secondary muscles engaged during the exercise.
44+
* @example ["traps", "traps", "triceps"]
45+
*/
1246
secondaryMuscles: string[]
47+
48+
/**
49+
* Step-by-step instructions to perform the exercise.
50+
* @example ["Step:1 Stand with your feet shoulder-width apart and place the band under your feet, holding the ends with your hands..."]
51+
*/
1352
instructions: string[]
1453
}
1554

src/middleware/auth/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// const RESTRICTED_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE'])
1212
// const VALID_ROLES = new Set(['member', 'moderator', 'admin'])
1313

14-
1514
// interface RouteConfig {
1615
// path: string
1716
// allowedEnvs: Set<string>

src/modules/bodyparts/controllers/bodyPart.controller.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ export class BodyPartController implements Routes {
1818
createRoute({
1919
method: 'get',
2020
path: '/bodyparts',
21-
tags: ['BodyParts'],
22-
summary: 'Retrive all bodyParts.',
23-
description: 'Retrive list of all bodyparts.',
21+
tags: ['BODYPARTS'],
22+
summary: 'GetAllBodyparts',
2423
operationId: 'getBodyParts',
2524
responses: {
2625
200: {

0 commit comments

Comments
 (0)