mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: add session creation endpoint (#18295)
This commit is contained in:
parent
585997d46f
commit
6117329057
27 changed files with 592 additions and 50 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Controller, Delete, Get, HttpCode, HttpStatus, Param } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import { SessionResponseDto } from 'src/dtos/session.dto';
|
||||
import { SessionCreateDto, SessionCreateResponseDto, SessionResponseDto } from 'src/dtos/session.dto';
|
||||
import { Permission } from 'src/enum';
|
||||
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
||||
import { SessionService } from 'src/services/session.service';
|
||||
|
|
@ -12,6 +12,12 @@ import { UUIDParamDto } from 'src/validation';
|
|||
export class SessionController {
|
||||
constructor(private service: SessionService) {}
|
||||
|
||||
@Post()
|
||||
@Authenticated({ permission: Permission.SESSION_CREATE })
|
||||
createSession(@Auth() auth: AuthDto, @Body() dto: SessionCreateDto): Promise<SessionCreateResponseDto> {
|
||||
return this.service.create(auth, dto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@Authenticated({ permission: Permission.SESSION_READ })
|
||||
getSessions(@Auth() auth: AuthDto): Promise<SessionResponseDto[]> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue