mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 09:15:34 +03:00
feat: sync implementation for the user entity (#16234)
* ci: print out typeorm generation changes * feat: sync implementation for the user entity wip --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsInt, IsPositive } from 'class-validator';
|
||||
import { IsEnum, IsInt, IsPositive, IsString } from 'class-validator';
|
||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
||||
import { ValidateDate, ValidateUUID } from 'src/validation';
|
||||
import { SyncEntityType, SyncRequestType } from 'src/enum';
|
||||
import { Optional, ValidateDate, ValidateUUID } from 'src/validation';
|
||||
|
||||
export class AssetFullSyncDto {
|
||||
@ValidateUUID({ optional: true })
|
||||
@@ -32,3 +33,51 @@ export class AssetDeltaSyncResponseDto {
|
||||
upserted!: AssetResponseDto[];
|
||||
deleted!: string[];
|
||||
}
|
||||
|
||||
export class SyncUserV1 {
|
||||
id!: string;
|
||||
name!: string;
|
||||
email!: string;
|
||||
deletedAt!: Date | null;
|
||||
}
|
||||
|
||||
export class SyncUserDeleteV1 {
|
||||
userId!: string;
|
||||
}
|
||||
|
||||
export type SyncItem = {
|
||||
[SyncEntityType.UserV1]: SyncUserV1;
|
||||
[SyncEntityType.UserDeleteV1]: SyncUserDeleteV1;
|
||||
};
|
||||
|
||||
const responseDtos = [
|
||||
//
|
||||
SyncUserV1,
|
||||
SyncUserDeleteV1,
|
||||
];
|
||||
|
||||
export const extraSyncModels = responseDtos;
|
||||
|
||||
export class SyncStreamDto {
|
||||
@IsEnum(SyncRequestType, { each: true })
|
||||
@ApiProperty({ enumName: 'SyncRequestType', enum: SyncRequestType, isArray: true })
|
||||
types!: SyncRequestType[];
|
||||
}
|
||||
|
||||
export class SyncAckDto {
|
||||
@ApiProperty({ enumName: 'SyncEntityType', enum: SyncEntityType })
|
||||
type!: SyncEntityType;
|
||||
ack!: string;
|
||||
}
|
||||
|
||||
export class SyncAckSetDto {
|
||||
@IsString({ each: true })
|
||||
acks!: string[];
|
||||
}
|
||||
|
||||
export class SyncAckDeleteDto {
|
||||
@IsEnum(SyncEntityType, { each: true })
|
||||
@ApiProperty({ enumName: 'SyncEntityType', enum: SyncEntityType, isArray: true })
|
||||
@Optional()
|
||||
types?: SyncEntityType[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user