mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
Add new endpoint GET api/v1/platforms to retrieve all platforms with readPlatforms permission. This provides a simpler alternative to the existing platform endpoint that includes account counts. - Create PlatformsController with GET endpoint using readPlatforms permission - Create PlatformsModule importing PlatformModule for service reuse - Register PlatformsModule in app.module.ts - Add readPlatforms permission to USER role 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>pull/6097/head
4 changed files with 34 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
import { HasPermission } from '@ghostfolio/api/decorators/has-permission.decorator'; |
||||
|
import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; |
||||
|
import { PlatformService } from '@ghostfolio/api/app/platform/platform.service'; |
||||
|
import { permissions } from '@ghostfolio/common/permissions'; |
||||
|
|
||||
|
import { Controller, Get, UseGuards } from '@nestjs/common'; |
||||
|
import { AuthGuard } from '@nestjs/passport'; |
||||
|
import { Platform } from '@prisma/client'; |
||||
|
|
||||
|
@Controller('platforms') |
||||
|
export class PlatformsController { |
||||
|
public constructor(private readonly platformService: PlatformService) {} |
||||
|
|
||||
|
@Get() |
||||
|
@HasPermission(permissions.readPlatforms) |
||||
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
||||
|
public async getPlatforms(): Promise<Platform[]> { |
||||
|
return this.platformService.getPlatforms(); |
||||
|
} |
||||
|
} |
||||
@ -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 {} |
||||
Loading…
Reference in new issue