feat(server): add public API
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7726223698
commit
c4f1a93136
3 changed files with 30 additions and 1 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -17,6 +17,7 @@
|
|||
"fastify",
|
||||
"ijmap",
|
||||
"nestjs",
|
||||
"populatedchannel",
|
||||
"tsviewer",
|
||||
"uglifycss"
|
||||
],
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { AppController } from './controllers/app.controller';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TeamspeakController } from './controllers/teamspeak.controller';
|
||||
import { TeamspeakService } from './services/teamspeak.service';
|
||||
|
||||
@Module({
|
||||
providers: [TeamspeakService],
|
||||
controllers: [AppController],
|
||||
controllers: [AppController, TeamspeakController],
|
||||
exports: [],
|
||||
})
|
||||
export class ApplicationModule { }
|
27
server/src/app/controllers/teamspeak.controller.ts
Normal file
27
server/src/app/controllers/teamspeak.controller.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Controller, Get } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { IChannel } from '../interfaces/channel.interface';
|
||||
import { IClient } from '../interfaces/client.interface';
|
||||
import { IPopulatedChannel } from '../interfaces/populatedchannel.interface';
|
||||
import { TeamspeakService } from '../services/teamspeak.service';
|
||||
|
||||
@Controller('api')
|
||||
@ApiTags('teamspeak')
|
||||
export class TeamspeakController {
|
||||
constructor(private teamspeakService: TeamspeakService) {}
|
||||
|
||||
@Get('clients')
|
||||
async getClients(): Promise<IClient[]> {
|
||||
return this.teamspeakService.getClients();
|
||||
}
|
||||
|
||||
@Get('channels')
|
||||
async getChannels(): Promise<IChannel[]> {
|
||||
return this.teamspeakService.getChannels();
|
||||
}
|
||||
|
||||
@Get('populatedChannelList')
|
||||
async getPopulatedChannelList(): Promise<IPopulatedChannel[]> {
|
||||
return this.teamspeakService.getPopulatedChannelList();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue