mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
7 changed files with 48 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||||
|
import { PlatformService } from '@ghostfolio/api/app/platform/platform.service'; |
||||
|
import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator'; |
||||
|
import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; |
||||
|
import { PlatformsResponse } from '@ghostfolio/common/interfaces'; |
||||
|
import { permissions } from '@ghostfolio/common/permissions'; |
||||
|
|
||||
|
import { Controller, Get, UseGuards } from '@nestjs/common'; |
||||
|
import { AuthGuard } from '@nestjs/passport'; |
||||
|
|
||||
|
@Controller('platforms') |
||||
|
export class PlatformsController { |
||||
|
public constructor(private readonly platformService: PlatformService) {} |
||||
|
|
||||
|
@Get() |
||||
|
@HasPermission(permissions.readPlatforms) |
||||
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
||||
|
public async getPlatforms(): Promise<PlatformsResponse> { |
||||
|
const platforms = await this.platformService.getPlatforms(); |
||||
|
|
||||
|
return { platforms }; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
import { PlatformModule } from '@ghostfolio/api/app/platform/platform.module'; |
||||
|
|
||||
|
import { Module } from '@nestjs/common'; |
||||
|
|
||||
|
import { PlatformsController } from './platforms.controller'; |
||||
|
|
||||
|
@Module({ |
||||
|
controllers: [PlatformsController], |
||||
|
imports: [PlatformModule] |
||||
|
}) |
||||
|
export class PlatformsModule {} |
||||
@ -0,0 +1,5 @@ |
|||||
|
import { Platform } from '@prisma/client'; |
||||
|
|
||||
|
export interface PlatformsResponse { |
||||
|
platforms: Platform[]; |
||||
|
} |
||||
Loading…
Reference in new issue