mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
feat: add session creation endpoint (#18295)
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
import { IsInt, IsPositive, IsString } from 'class-validator';
|
||||
import { Session } from 'src/database';
|
||||
import { Optional } from 'src/validation';
|
||||
|
||||
export class SessionCreateDto {
|
||||
/**
|
||||
* session duration, in seconds
|
||||
*/
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@Optional()
|
||||
duration?: number;
|
||||
|
||||
@IsString()
|
||||
@Optional()
|
||||
deviceType?: string;
|
||||
|
||||
@IsString()
|
||||
@Optional()
|
||||
deviceOS?: string;
|
||||
}
|
||||
|
||||
export class SessionResponseDto {
|
||||
id!: string;
|
||||
@@ -9,6 +29,10 @@ export class SessionResponseDto {
|
||||
deviceOS!: string;
|
||||
}
|
||||
|
||||
export class SessionCreateResponseDto extends SessionResponseDto {
|
||||
token!: string;
|
||||
}
|
||||
|
||||
export const mapSession = (entity: Session, currentId?: string): SessionResponseDto => ({
|
||||
id: entity.id,
|
||||
createdAt: entity.createdAt.toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user