mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore: move controllers and middleware (#8119)
This commit is contained in:
parent
81f0265095
commit
40e079a247
28 changed files with 55 additions and 60 deletions
41
server/src/controllers/partner.controller.ts
Normal file
41
server/src/controllers/partner.controller.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { Body, Controller, Delete, Get, Param, Post, Put, Query } from '@nestjs/common';
|
||||
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { AuthDto } from 'src/domain/auth/auth.dto';
|
||||
import { PartnerResponseDto, UpdatePartnerDto } from 'src/domain/partner/partner.dto';
|
||||
import { PartnerService } from 'src/domain/partner/partner.service';
|
||||
import { PartnerDirection } from 'src/domain/repositories/partner.repository';
|
||||
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
||||
import { UUIDParamDto } from 'src/validation';
|
||||
|
||||
@ApiTags('Partner')
|
||||
@Controller('partner')
|
||||
@Authenticated()
|
||||
export class PartnerController {
|
||||
constructor(private service: PartnerService) {}
|
||||
|
||||
@Get()
|
||||
@ApiQuery({ name: 'direction', type: 'string', enum: PartnerDirection, required: true })
|
||||
// TODO: remove 'direction' and convert to full query dto
|
||||
getPartners(@Auth() auth: AuthDto, @Query('direction') direction: PartnerDirection): Promise<PartnerResponseDto[]> {
|
||||
return this.service.getAll(auth, direction);
|
||||
}
|
||||
|
||||
@Post(':id')
|
||||
createPartner(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<PartnerResponseDto> {
|
||||
return this.service.create(auth, id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
updatePartner(
|
||||
@Auth() auth: AuthDto,
|
||||
@Param() { id }: UUIDParamDto,
|
||||
@Body() dto: UpdatePartnerDto,
|
||||
): Promise<PartnerResponseDto> {
|
||||
return this.service.update(auth, id, dto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
removePartner(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||
return this.service.remove(auth, id);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue