Initial commit: Meshkee CMS API
NestJS backend with Prisma, Docker Compose for Postgres/Redis, and deploy docs for the production VM.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Query, UseGuards } from '@nestjs/common';
|
||||
import { AuthUser } from '../auth/auth.types';
|
||||
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
import { DisableDomainDto } from './dto/disable-domain.dto';
|
||||
import { ListDomainsDto } from './dto/list-domains.dto';
|
||||
import { ToggleSslDto } from './dto/toggle-ssl.dto';
|
||||
import { UpdateDomainAdminDto } from './dto/update-domain-admin.dto';
|
||||
import { DomainAdminService } from './domain-admin.service';
|
||||
|
||||
@Controller('domains')
|
||||
export class DomainAdminController {
|
||||
constructor(private readonly service: DomainAdminService) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
list(@Query() query: ListDomainsDto, @CurrentUser() user: AuthUser) {
|
||||
return this.service.list(query, user);
|
||||
}
|
||||
|
||||
@Patch(':domainId')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
update(
|
||||
@Param('domainId') domainId: string,
|
||||
@Body() dto: UpdateDomainAdminDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.update(domainId, dto, user);
|
||||
}
|
||||
|
||||
@Patch(':domainId/disable')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
disable(
|
||||
@Param('domainId') domainId: string,
|
||||
@Body() dto: DisableDomainDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.disable(domainId, dto, user);
|
||||
}
|
||||
|
||||
@Patch(':domainId/ssl')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
toggleSsl(
|
||||
@Param('domainId') domainId: string,
|
||||
@Body() dto: ToggleSslDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.service.toggleSsl(domainId, dto, user);
|
||||
}
|
||||
|
||||
@Delete(':domainId')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
remove(@Param('domainId') domainId: string, @CurrentUser() user: AuthUser) {
|
||||
return this.service.remove(domainId, user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user