Download apps/backend/src/api/routes/analytics.controller.ts from Leon4gr45/postio: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/Leon4gr45/postio/resolve/main/apps/backend/src/api/routes/analytics.controller.ts
- Command line
-
hf download hf://spaces/Leon4gr45/postio/apps/backend/src/api/routes/analytics.controller.ts
-
curl -L -o analytics.controller.ts https://huggingface.co/spaces/Leon4gr45/postio/resolve/main/apps/backend/src/api/routes/analytics.controller.ts
1.15 kB
| import { Controller, Get, Param, Query } from '@nestjs/common'; | |
| import { Organization } from '@prisma/client'; | |
| import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.request'; | |
| import { ApiTags } from '@nestjs/swagger'; | |
| import { IntegrationService } from '@gitroom/nestjs-libraries/database/prisma/integrations/integration.service'; | |
| import { PostsService } from '@gitroom/nestjs-libraries/database/prisma/posts/posts.service'; | |
| ('Analytics') | |
| ('/analytics') | |
| export class AnalyticsController { | |
| constructor( | |
| private _integrationService: IntegrationService, | |
| private _postsService: PostsService | |
| ) {} | |
| ('/:integration') | |
| async getIntegration( | |
| () org: Organization, | |
| ('integration') integration: string, | |
| ('date') date: string | |
| ) { | |
| return this._integrationService.checkAnalytics(org, integration, date); | |
| } | |
| ('/post/:postId') | |
| async getPostAnalytics( | |
| () org: Organization, | |
| ('postId') postId: string, | |
| ('date') date: string | |
| ) { | |
| return this._postsService.checkPostAnalytics(org.id, postId, +date); | |
| } | |
| } | |