mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	refactor(server): sync service (#19559)
This commit is contained in:
		
							parent
							
								
									926ff075a3
								
							
						
					
					
						commit
						b96c95beda
					
				@ -13425,6 +13425,7 @@
 | 
				
			|||||||
        "properties": {
 | 
					        "properties": {
 | 
				
			||||||
          "acks": {
 | 
					          "acks": {
 | 
				
			||||||
            "items": {
 | 
					            "items": {
 | 
				
			||||||
 | 
					              "maxLength": 1000,
 | 
				
			||||||
              "type": "string"
 | 
					              "type": "string"
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "type": "array"
 | 
					            "type": "array"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import { ApiProperty } from '@nestjs/swagger';
 | 
					import { ApiProperty } from '@nestjs/swagger';
 | 
				
			||||||
import { IsEnum, IsInt, IsPositive, IsString } from 'class-validator';
 | 
					import { IsEnum, IsInt, IsPositive, IsString, MaxLength } from 'class-validator';
 | 
				
			||||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
 | 
					import { AssetResponseDto } from 'src/dtos/asset-response.dto';
 | 
				
			||||||
import { AlbumUserRole, AssetOrder, AssetType, AssetVisibility, SyncEntityType, SyncRequestType } from 'src/enum';
 | 
					import { AlbumUserRole, AssetOrder, AssetType, AssetVisibility, SyncEntityType, SyncRequestType } from 'src/enum';
 | 
				
			||||||
import { Optional, ValidateDate, ValidateUUID } from 'src/validation';
 | 
					import { Optional, ValidateDate, ValidateUUID } from 'src/validation';
 | 
				
			||||||
@ -217,6 +217,7 @@ export class SyncAckDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class SyncAckSetDto {
 | 
					export class SyncAckSetDto {
 | 
				
			||||||
 | 
					  @MaxLength(1000)
 | 
				
			||||||
  @IsString({ each: true })
 | 
					  @IsString({ each: true })
 | 
				
			||||||
  acks!: string[];
 | 
					  acks!: string[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -96,10 +96,7 @@ export class SyncService extends BaseService {
 | 
				
			|||||||
        throw new BadRequestException(`Invalid ack type: ${type}`);
 | 
					        throw new BadRequestException(`Invalid ack type: ${type}`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (checkpoints[type]) {
 | 
					      // TODO pick the latest ack for each type, instead of using the last one
 | 
				
			||||||
        throw new BadRequestException('Only one ack per type is allowed');
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      checkpoints[type] = { sessionId, type, ack };
 | 
					      checkpoints[type] = { sessionId, type, ack };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user