mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 12:18:11 +00:00
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { Body, Controller, Delete, Get, Param, Patch, Post, SetMetadata } from '@nestjs/common';
|
|
import { ApiTags, ApiBearerAuth, ApiOperation, ApiParam } from '@nestjs/swagger';
|
|
import { AppReleasesService, AppReleaseDto } from './app-releases.service';
|
|
import { PassengerStaff } from '../../common/passenger-guards';
|
|
import { PASSENGER_PERMS } from '../../seed/passenger-permissions.registry';
|
|
|
|
@ApiTags('App Releases')
|
|
@Controller('app-releases')
|
|
export class AppReleasesController {
|
|
constructor(private service: AppReleasesService) {}
|
|
|
|
@Get()
|
|
@SetMetadata('isPublic', true)
|
|
@ApiOperation({ summary: 'List all app releases (public)' })
|
|
getAll() {
|
|
return this.service.getAll();
|
|
}
|
|
|
|
@Get('latest/:os')
|
|
@SetMetadata('isPublic', true)
|
|
@ApiOperation({ summary: 'Get latest release for a given OS (public)' })
|
|
@ApiParam({ name: 'os', enum: ['android', 'ios'] })
|
|
getLatest(@Param('os') os: string) {
|
|
return this.service.getLatest(os);
|
|
}
|
|
|
|
@Post()
|
|
@PassengerStaff(PASSENGER_PERMS.admin)
|
|
@ApiBearerAuth('IAM-auth')
|
|
@ApiOperation({ summary: 'Create an app release (admin)' })
|
|
create(@Body() dto: AppReleaseDto) {
|
|
return this.service.create(dto);
|
|
}
|
|
|
|
@Patch(':id')
|
|
@PassengerStaff(PASSENGER_PERMS.admin)
|
|
@ApiBearerAuth('IAM-auth')
|
|
@ApiOperation({ summary: 'Update an app release (admin)' })
|
|
update(@Param('id') id: string, @Body() dto: Partial<AppReleaseDto>) {
|
|
return this.service.update(id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
@PassengerStaff(PASSENGER_PERMS.admin)
|
|
@ApiBearerAuth('IAM-auth')
|
|
@ApiOperation({ summary: 'Delete an app release (admin)' })
|
|
remove(@Param('id') id: string) {
|
|
return this.service.remove(id);
|
|
}
|
|
}
|