Spaces:
Sleeping
Sleeping
Download src/controllers/activityController.ts from zerito/snowva-backend: direct link, hf CLI and curl.
- Browser
- Download file 705 Bytes
-
https://huggingface.co/spaces/zerito/snowva-backend/resolve/main/src/controllers/activityController.ts
- Command line
-
hf download hf://spaces/zerito/snowva-backend/src/controllers/activityController.ts
-
curl -L -o activityController.ts https://huggingface.co/spaces/zerito/snowva-backend/resolve/main/src/controllers/activityController.ts
705 Bytes
| import { Request, Response } from 'express'; | |
| import { ActivityModel } from '../models/ActivityModel'; | |
| export class ActivityController { | |
| /** | |
| * GET /api/activities | |
| * Returns the list of activities used by the mobile UI. | |
| */ | |
| static async listActivities(req: Request, res: Response): Promise<void> { | |
| try { | |
| const includeHidden = (req.query.includeHidden as string | undefined) === 'true'; | |
| const activities = includeHidden | |
| ? await ActivityModel.listAll() | |
| : await ActivityModel.listVisible(); | |
| res.json({ activities }); | |
| } catch (err) { | |
| console.error('Error in listActivities:', err); | |
| res.status(500).json({ error: 'Server Error' }); | |
| } | |
| } | |
| } | |